Heroes 4 Advanced Options Map Editor

The old Heroes games developed by New World Computing. Please specify which game you are referring to in your post.
User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 773
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 09 Apr 2016, 19:34

Event groups are just events that can be saved and loaded from file.

So, if you have utility events that are helpful on any map that you create, you can simply load them into the map you're working on from a file.

I'm still not sure how I want the user to be able to save / load / apply the events from the groups in the actual program. I was thinking maybe add a button to the panels that the user could potentially add new events called "Load from Group" or something like that. An example would be to put one on the "Army Properties" frame so the user could click it, and then select a group of events to apply.

The other way I was thinking was to have the group events on a tab under the events section. From there the user could load up groups of events, and then just copy the scripts they want, and paste them where they want.

Still not sure what the best way to do this would be.

I also need to come up with a good way to store them in a file, but that's not as big an issue.

I'm also going to implement saving quest hut scripts to file, so you can copy and paste scripting between quest huts :)

Oh, and to answer your question: I have not yet looked into copying one part of a map to another yet.

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

Re: Heroes 4 Map Generator / Utility

Unread postby Karmakeld » 09 Apr 2016, 22:08

Copying between quest huts is a good idea too. Basically it would be useful to be able to copy/paste between any object that can contain scripts quest guards and gates as well (different look).
About the event group, I'm leaning towards the second option, but I think I would have to play around with the program, to get a feeling of what might seem most intuitive.
Would you be able to save the 'events group' to an 'event group' map or a txt file? I don't assume the program itself would be able to store the saved events?
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: 773
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 10 Apr 2016, 03:31

That's the plan :) I was thinking about not including copying for quest guards and gates because you can copy them to the H4 editor palette, but then as you said, you have one that faces left, and one that faces right, so it would still be useful.

I sent you the program, so you can give it a whirl :) The only thing you need to do is install the Java JRE just download the most recent version (I sent you the link). I'll continue thinking about what would be a good way to do it. It end up being a mix of what has already been described.

The event groups will be saved to a file, and when you start the program, it will check the location where it expects event groups to be, and load them into the program. There will still be an option to load event groups so that you can load event groups if you have saved them in another location.

Since this program already knows how to save / load events to / from .h4c files, it will be very simple to save / load only events to another file. I'll probably give them an extension other than .txt just so I can easily differentiate my file types. Same goes for saving quest huts to a file :)

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

Re: Heroes 4 Map Generator / Utility

Unread postby Karmakeld » 10 Apr 2016, 08:49

Awsome. I'll give it a try some time during the next week, hopefully, and give you some feedback :)
Just a thought, is it possible to easily add some kind of error message, if one attempts to copy/paste a script to a place where it can't go?
Like copying a hero/army script to a placed event, but that particular script isn't available as a placed event. Like you wrote, either it will just do nothing or it might cause a crash. If this is something that is hard to setup, or take alot of time having to crosscheck, it might not be worth looking into.
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: 773
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 10 Apr 2016, 18:27

I already have the method which adds the events to my event class checking the type that is being added, so it should actually be pretty simple to add an error message. If the type doesn't match, I can simply add the name of the bad event to a list and return that to the calling method, who can then show the error dialogue with the list of bad event names.

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 11 Apr 2016, 05:02

The H4MG can now generate a new .h4c map / campaign completely independent of the H4 Editor :D

There are still 4 bytes at the beginning of the map files that I have no idea what they represent. I can create two maps that are exactly the same in the H4 editor and those 4 bytes are always different, so it's very difficult to figure out what they mean, but that also means they might not be important. Maybe just some sort of book-keeping in the editor.

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

Re: Heroes 4 Map Generator / Utility

Unread postby Karmakeld » 12 Apr 2016, 19:58

that's great :)
Just a thought, if those two 'exactly identical' maps are both placed in the same folder, don't they have separate names in the folder?
Have you looked at what happens if you overwrite, if the 4 bytes then change or remains the same?
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: 773
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 13 Apr 2016, 01:40

I initially thought it was something to do with the file name when you save it, but I think it has to already have those bytes filled out for the map to be viewable in the editor, so it seems that they are filled in when the map is generated after selecting "new" and "ok."

Now, whenever you generate a new map with the H4 editor, it comes up h4cmp1, h4cmp2, etc., but I just tried closing and opening the editor, and then generating a new map, but the 4 bytes were different again.

Anyway, the editor doesn't seem to much care what those numbers are. I just used the numbers from one of the already generated maps as the default value for new maps that the H4MG creates and it seems to work just fine.

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 16 Apr 2016, 04:09

I have successfully saved / loaded just events to / from file, and copied / pasted the events to a map. After saving the map and then loading it in the H4 editor, the events are all present :)

We can create new event groups, copy and paste events to these event groups, and then save them to a file. On startup, any of these event group files in the data directory will be automatically loaded. So far I have only implemented this for map events, but hero and army events are just more of the same.

There will also be an option to load event groups if you've saved them to some location other than where the program expects.

I'm a bit tired at the moment, so I'll get some screen shots posted up sometime tomorrow.

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

Re: Heroes 4 Map Generator / Utility

Unread postby Baronus » 16 Apr 2016, 06:20

Ok rest :-) It will be big tutorial to this editor.

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 16 Apr 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: 1126
Joined: 12 Nov 2011

Re: Heroes 4 Map Generator / Utility

Unread postby Karmakeld » 16 Apr 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: 773
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 16 Apr 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: 773
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 18 Apr 2016, 02: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: 773
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 18 Apr 2016, 05: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: 773
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 20 Apr 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: 773
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 21 Apr 2016, 03: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

Unread postby Baronus » 21 Apr 2016, 08: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: 773
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 21 Apr 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

Unread postby Baronus » 22 Apr 2016, 12:51

Ofcourse. Good RMG first.


Return to “Heroes I-IV”

Who is online

Users browsing this forum: No registered users and 19 guests