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 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.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » May 7 2016, 5:39

Glad you like it Baronus :)

Update:
I've added the ability to view castle objects and their scripts, and the triggered / completion scripts for quest objects.

I've also done some work with editing heroes: Can change the class, gender, portrait, name, and bio. That took some work, since I had to record the code for each hero. I want to get the skills setup so we don't have to use the H4 editor "trick" to give any hero type any starting skill.

I think I want to finish getting viewers setup for the other garrison objects (garrisons and mines), and then I'll get started on an area selection tool (select and copy/paste parts of a map)

User avatar
Duzeom_
Conscript
Conscript
Posts: 234
Joined: 07 Mar 2011

Re: Heroes 4 Map Generator / Utility

Postby Duzeom_ » May 7 2016, 10:41

The scripting tree is something which everyone wanted, I presume. When will be a release?

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » May 7 2016, 17:41

Hi Duzeom.

The scripting tree is something I decided to do because, as you said in the Megom thread, clicking around is such a waste of time. Hopefully others will find this feature useful as well :)

What kind of ideas were you thinking as far as editing scripts? For some of the simple ones I was thinking about keeping them as they are in the editor (such as increase / decrease), but for the more complicated ones, such as the conditional, I'm not sure how I want them to be edited.

For conditionals, it's annoying to have to plan out the logic before you start scripting it. Make one mistake in the ordering and you have to back out and redo it, so I'm trying to think of a way to make that easier and not require things to be scripted in order. I was thinking about making it kind of code oriented, but that might take some time to design and implement. Maybe it wouldn't be too bad though..

Unfortunately the scripting feature is not very far along. Right now I can only edit combat scripts (since I wanted to try putting a hero on it), so there is a lot more work to be done (setting up viewers for different script types).

Right now you can open an existing .h4c map or create a new one, copy / paste events between maps and objects, save / load events and quest huts to / from file (which you can copy to your map and objects), paint terrain with various brush sizes (including a really large size good for high level map design), paint "void" terrain anywhere, and edit some properties on objects (army, hero, castle, etc.).

If you would find any of that useful right now, I can send you the current version of the H4MG, but an actual release is still a little ways away. I guess I could remove the things that currently aren't implemented and release that, and then just release more features as things progress :)

User avatar
Duzeom_
Conscript
Conscript
Posts: 234
Joined: 07 Mar 2011

Re: Heroes 4 Map Generator / Utility

Postby Duzeom_ » May 8 2016, 20:17

iLiVeInAbOx05 wrote:For conditionals, it's annoying to have to plan out the logic before you start scripting it. Make one mistake in the ordering and you have to back out and redo it, so I'm trying to think of a way to make that easier and not require things to be scripted in order. I was thinking about making it kind of code oriented, but that might take some time to design and implement. Maybe it wouldn't be too bad though..

Unfortunately the scripting feature is not very far along. Right now I can only edit combat scripts (since I wanted to try putting a hero on it), so there is a lot more work to be done (setting up viewers for different script types).

Right now you can open an existing .h4c map or create a new one, copy / paste events between maps and objects, save / load events and quest huts to / from file (which you can copy to your map and objects), paint terrain with various brush sizes (including a really large size good for high level map design), paint "void" terrain anywhere, and edit some properties on objects (army, hero, castle, etc.).


It is pain in the ass if you want to change the conditional. So maybe some drag and drop? If you have implemented copying piece of script somewhere else, which is great functionality and I could just use it immediately, this shouldn't be very difficult, does it? I think all scripts should be implicitly in sequence script and they should draggable in that way:

conditional {
conditional clause
} then {
sequence { <-- drag it from here
...
}
} else {
... <-- to here for example
}

I used to make lot of event inside custom heroes as triggerable events because of lack of ability to copy placed events through different maps. I also had to make a first map of my last campaign a not part of the story because I made all scripts in carryover hero and I needed a dummy map in the beginning to have a carryover hero in the second ;p.

What is void terrain?

I could use a functionality which paints whole land with given terrain eg. dirt.

Are you implementing it in java? If yes, then maybe I could help a bit.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » May 8 2016, 21:10

Duzeom_ wrote:It is pain in the ass if you want to change the conditional. So maybe some drag and drop? If you have implemented copying piece of script somewhere else, which is great functionality and I could just use it immediately, this shouldn't be very difficult, does it? I think all scripts should be implicitly in sequence script and they should draggable in that way:

conditional {
conditional clause
} then {
sequence { <-- drag it from here
...
}
} else {
... <-- to here for example
}


Ah, I meant when scripting the conditional requirement, such as: If count == 0 AND (total number of creatures in army < 1 OR hero is dead)

If the requirements were entered in the wrong order (the parentheses above), then you have to pretty much redo the logic. I was thinking about coming up with some way to make entering and adjusting this logic in a better way, but so far I haven't come up with anything.

As far as dragging and dropping scripts within an event, that will definitely be a feature as you described. Being able to drag a script into or out of a conditional (or sequence or any other nested script) would be extremely useful.

The only problem is that java's JTree doesn't have any native support for drag and drop, so I'm going to have to create that from scratch :)

Duzeom_ wrote:I used to make lot of event inside custom heroes as triggerable events because of lack of ability to copy placed events through different maps. I also had to make a first map of my last campaign a not part of the story because I made all scripts in carryover hero and I needed a dummy map in the beginning to have a carryover hero in the second ;p.


Haha I ran into that when going from my second to third map and had to recreate all of my scripting on a carryover hero. I didn't even think about hiding a carryover hero on my first map, that would have certainly saved me some time.

Fortunately, with this tool we won't have to do things like that anymore, since we can copy / paste events between heroes :)

Duzeom_ wrote:What is void terrain?


Void terrain is the pure black terrain that you get when you paint cave or stone. With this tool we can put that black terrain wherever we want, and without the stone / cave boundaries.

Duzeom_ wrote:I could use a functionality which paints whole land with given terrain eg. dirt.


You can easily do that with this tool :) Just set the "brush size" to ludicrous, select your terrain type, and you can paint an XL map in a of couple seconds :)

Duzeom_ wrote:Are you implementing it in java? If yes, then maybe I could help a bit.


I sure am. I'll take a look and see what I could use some help with. Right now I'm still creating the various viewers. I still have garrisons and mines to replicate, and then the various script viewers, along with editing abilities.

After I get through those, I could probably use some help with some of the random generation algorithms, mostly the design, such as zones and what can potentially go where, etc.

Right now, I could use some non-java help coming up with ideas for editing the conditional logic requirements (AND, OR, NOT, etc.). The way the H4 editor handles editing conditional requirements is time consuming and can be unforgiving if you make any mistakes, so I'd like to create an alternative that's more user friendly :)

Just to be completely clear, here are a couple screen shots of what I'm talking about.

Image

And then if I select the top edit button to edit the If condition.

Image

If you have any amount of AND's, OR's, or NOT's, it can be extremely annoying if you have to change the logic, not to mention that you have to enter it in the correct order, which can sometimes be difficult if you have somewhat complex logic to deal with.

User avatar
Duzeom_
Conscript
Conscript
Posts: 234
Joined: 07 Mar 2011

Re: Heroes 4 Map Generator / Utility

Postby Duzeom_ » May 8 2016, 21:26

You could write a parser for a user scripting:
AND, OR, NOT, FALSE, TRUE, () <- function
then user could write a conditional like that:
IF ( (func1) AND (func2 OR NOT (func3)) )

func1: hero level >= 4
func2 hero colour == blue
func3: day >= 10

I could write a random map generator engine. I was doing some research about it. You can find my topic about rmg long time ago. The main problem with it that I don't have a lot of spare time, so I could tweak something or write a little functionality. If I had a lot of time I would started writing rmg myself... but life's brutal ;)


Return to “Heroes I-IV”

Who is online

Users browsing this forum: Google [Bot] and 4 guests