Heroes 4 Map Generator / Utility

The old Heroes games developed by New World Computing. Please specify which game you are referring to in your post.

Moderator: Moderators

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 16 2016, 22:24

Greetings. A few screen captures from my previous update. Here's a look at the Event Group Panel, which is part of the Events panel. It's not tied to any particular map so it might make more sense to put it on its own tab, but we'll see.

Image

To create a new event group, simply click "New," and then give your new event group a name and select the type.

Image

We've created our first event group! It is a Map event group, with the shown event types.

Image

Now, lets load up a map that has some utility events that we can copy to our event group. I chose one of my template maps which has all of my utility scripting, and starts covered in water so I can raise the elevation of the entire map as I see fit (now made obsolete by the H4MG). I'll copy the triggered events here.

Image

Now we'll switch back to the Event Group tab and paste our events under the "Triggerable" type.

Image

Bam, now our event group has our triggerable scripts. I'll copy / paste the rest over as well.

Image

Finally, we can save our Utility Events by clicking on the save button, and then navigating to the location you want to save the file, or - recommended - save it here. On startup, this is where the H4MG checks for event groups and automatically loads them.

Image

Now we are able to copy and paste these events to any map of our choosing - we don't have to open up a particular map and copy / paste those events. I'll probably need to gzip these files to reduce their footprint, even though they aren't all that big.

The load button isn't implemented yet, but that will be simple :) I also have some more work to do with being able to open a frame to look at carryover heroes / etc. so that we can copy and paste those events as well. I'll likely include some of my utility events with the H4MG.

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1092
Joined: 12 Nov 2011

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Apr 16 2016, 22:42

Might I suggest that if people has some utility scripts they would like to share, they could add them to a script library? There was a lot of discussion about various scripts to help improve AI and if he interested in it, PatFx could share his easy testing script. Scripts like these might be useful to compile in an included script library. People could the choose to delete them if they don't need them.
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 16 2016, 23:06

Sure, that would be a nice idea, and it could be released / updated separately from the H4MG, like maps now. All you'd have to do is copy the various group files to your data/event_groups directory (wherever the H4MG lives). That could maybe just be a zipped file with the various groups hosted here on CH.

We could either have people send me the map and tell me which scripts to copy, or once the H4MG is released for testing they can send me their events group files.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 18 2016, 2:44

Okay, I can display events for armies, heroes, carryover heroes, and prisons. For armies and carryover heroes you can see most of the fields that you can in the H4 editor, but for prisons and heroes only the events tab is functional.

I think I'll work on displaying quest huts / gates / guards next. Once I get that up and running, I'll work on saving / loading quest hut info between quest huts.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 18 2016, 5:23

I'm now able to display quest huts, guards, and gates (I forgot to actually test viewing a gate and a guard, but they should work). Time to sleep!

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 20 2016, 22:14

We can save / load quest huts, guards, and gates :) I added a file menu with save and load options to the frames for viewing quest huts / guards / gates. I'll post some screen caps later, but it's very simple :)

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 21 2016, 3:59

Alrighty, time for some screen caps for saving and loading quest huts. First load up a map that has a quest hut you would like to save, navigate to the Events tab, then navigate to the Object Events sub tab, then right click your quest hut and select edit.

Image

Here's the quest hut frame, which is just emulating the one from the H4 editor. Still haven't gotten to showing scripts with the H4MG yet, so only the tabs which display text currently do anything.

Image

Now we go to the file menu, and select Save Quest.

Image

Now we can name it what we want (the default that comes up is the site name of the quest hut), and then save.

Image

Now, open up a second map with a quest hut of a different type, navigate to the Object Events tab, and select and edit the quest hut.

Image

Next we go to File and select Load Quest.

Image

We'll select the quest hut "The Curious Chemist" shop that we just saved, and then open.

Image

Now this different type of quest hut has all of the information and scripting of the other :) Don't forget to save! (Still only "Save as" implemented).

Image

Lastly, we can go to the H4 editor to verify that the quest hut info has indeed been copied over. I copied from the quest hut type on the left (in a different map), to the quest hut on the right.

Image

This also works for both quest guards and toll gates. I also made some tweaks to the terrain colors so that they're closer to the mini-map colors in the H4 editor.

I think next I'm going to work on putting a hero onto a triggered combat script to see if that can work. After that, I'll start working on a selection tool so we can start trying to copy / paste / move portions of one map to another map (or just somewhere else on the same map).

User avatar
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Apr 21 2016, 8:27

Description is very important.
And I think about situation when you generate random map and after 2 months playing you see you cant finished it because eg. there is no road, becouse all are hills. And will be good if editor can read saves and you can replace hills to road and finish scenario...

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 21 2016, 15:34

I'll eventually get to looking at the save file format :) I'm hoping that when I do get to working on the random generation side of things, that I'll be able to come up with a way to make sure all players can reach each other so you don't get into a situation like that.

User avatar
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Apr 22 2016, 12:51

Ofcourse. Good RMG first.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 23 2016, 3:31

Okay, so before I can easily try to put a hero on a combat script, I need to actually be able to view scripts in the H4MG, so that's currently what I'm working on. I'm probably going to use a Tree View to show the scripts (like a file system where you can expand and collapse nodes) and eventually add options to copy and paste individual scripts, as well as the ability to move scripts in and out of conditionals / ask.

Are there any suggestions on a better way to show / add scripts than what is currently in the editor? Meaning, if you could change the editor where scripting is concerned, what would you like to see, if anything?

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1092
Joined: 12 Nov 2011

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Apr 23 2016, 11:40

I think it would be a good and reasonable solution to display scripts similar to the editor, as it might make it easier to maneuver around, if the RMG and the editor look alike with a similar setup/display. So no better suggestion from my side. I still gotta test it, though before I can give you proper feedback.
But I actually intended to ask if you'd make an option to copy/paste individual scripts within a script aswell, but you just gave that away :)
I'm silent in seven languages - and I got all my familys fear.

Everytime you throw dirt, you loose a little ground

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 23 2016, 20:24

I think a tree view of the scripts will be a lot better than what is in the H4 editor. I'm thinking the tree will start completely expanded so that you can see all scripts, and then you can click the minus to hide scripts under conditionals and other scripts that contain scripts.

It looks like I'm going to have to create my own custom behavior, with some help from google, for dragging and moving scripts around inside of the tree.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 24 2016, 20:50

Got scripts displayed in tree form, with some minor things I still need to fix as far as what is displayed on some script nodes.

The tree view has the following advantages over the H4 editor way: 1) If you have a lot of nested scripts (scripts inside of scripts), you don't have to open a million windows to finally reach the script you're looking for, you can scroll right to it. 2) The H4 Editor bug that doesn't allow you to see all nested scripts is fixed by default.

I also added buttons to show or hide all scripts.

And now the sad news: I was able to put a hero on a triggered combat script, BUT, the game doesn't recognize the hero and only the creature will show up in the actual combat :( I tried removing the creature so only the hero was present, but that just resulted in a battle against no enemies :( No crash, but no workie either :(

User avatar
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Apr 25 2016, 8:02

I think the best is a pack of typical scripts to choice and people who cant write scripts will change only numbers. Eg. give AI 1000 gold a day. They can change to 2000.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 25 2016, 14:10

Well, as far as the AI scripting is concerned, the user will probably be able to set custom values, such as the amount of gold to give the AI per turn (or per week), or they can just use the default values. There should be no need, at least in this particular case, for someone to actually have to go into a script and edit it :)

As far as other types of scripts, I agree. I'll be including a lot of the scripts that I use, most of which don't require any editing, but some will require the name of the hero to be changed to the hero it will apply to. In that case, I'm going to add functionality to the H4MG that will simply let the user change the name, and then the H4MG will change the name everywhere needed in the script.

User avatar
Karmakeld
CH Staff
CH Staff
Posts: 1092
Joined: 12 Nov 2011

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Apr 26 2016, 16:47

Perhaps the Equilibris team might be able to find a way to include a hero in a triggered Battle?
I'm silent in seven languages - and I got all my familys fear.

Everytime you throw dirt, you loose a little ground

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 26 2016, 18:19

That would certainly be nice :)

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 567
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Apr 29 2016, 2:07

Okay, so here are a couple screens showing the event and script displays. I've added an "Edit" option to the event tables like so:

Image

Navigate to the script tab and voila, we have the scripts in a tree view. We can collapse or expand as needed (all scripts are expanded by default).

Image

By clicking the "Hide All" button, we can collapse all scripts down to open only the path that we wish to see. This can be helpful for a script with lots of conditionals and conditionals within conditionals.

Image

To manually expand a node, simply click the little expand icon next to the script info.

Image

As I said before, with the tree view, there's no more need to open several scripts before you finally get to the one you want to edit, you simply go right to it :)

All for now :)

User avatar
Baronus
Assassin
Assassin
Posts: 288
Joined: 06 Jun 2015

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Apr 30 2016, 9:50

Script tree? Good idea! Now all looks cleary. Thats it what we need.


Return to “Heroes I-IV”

Who is online

Users browsing this forum: No registered users and 7 guests