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: 788
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 04 Jun 2016, 23:23

Here's a quick example of copying and pasting scripts.

First, open up two events, and go to their script tabs.

Image

Next, select the scripts you would like to copy, then right click and select copy.

Image

Finally, go to the other event, right click in the window, and select paste.

Image

Image

Make sure you click the "OK" button for your changes to take effect, and you've copied scripts between events :) Although I just found a bug if you highlight part of a script which contains more scripts >.<

Edit: Fixed the bug.

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

Re: Heroes 4 Map Generator / Utility

Unread postby Karmakeld » 05 Jun 2016, 07:50

You're truly a wiz
I'm silent in seven languages - and I got all my familys fear.
Everytime you throw dirt, you loose a little ground

User avatar
Steven Aus
War Dancer
War Dancer
Posts: 350
Joined: 08 Feb 2006
Location: Perth, Australia
Contact:

Re: Heroes 4 Map Generator / Utility

Unread postby Steven Aus » 05 Jun 2016, 08:21

A WizInABox. :)
My Life Purpose Is To Teach The World To Fish For Life. I AM Steven Russell Lynch Abundance That I AM. Empowerment And Fostering Self-Responsibility Is My Game.

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 06 Jun 2016, 13:59

~_~

Found and fixed a couple more bugs in the implementation of dragging and dropping scripts in the tree view.

Unfortunately I didn't have a lot of time to work on things this weekend, so I didn't get much done. I do, however, think that I have come up with the solution for updating the scripts when we drag / drop so I'll try to get that in place soon :)

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 10 Jun 2016, 03:27

Good news! It appears I have the drag and drop ability working so that it also moves the scripts to their proper location! Turned out to not be as hard as I thought, since really you can only move scripts around inside of a sequence, or to another sequence.

I'll try to get some screen captures of this feature in action tomorrow :)

I think that just leaves adding / removing scripts on the list of what needs to be somewhat working before the initial release :)

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

Re: Heroes 4 Map Generator / Utility

Unread postby Baronus » 10 Jun 2016, 07:05

Good. Easy ways are better for all. Map creating process will be nice...

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 11 Jun 2016, 00:32

Okay! So here's a quick example of drag and drop in play. Open up a map, and select / open an event and its scripts. Highlight the script(s) to move.

Image

Next, click and drag the script(s) to the sequence node (or under a sequence node if there are already scripts there) you want to move them to. In the example below, I have dragged to the highlighted sequence (can't see the mouse in the screen capture).

Image

Now, release the mouse button to drop the script(s) in place. The scripts will be moved, and right now the node will collapse and you will have to hit the expand icon to see the scripts.

Image

Finally, hit the save button (or save as somewhere else), and view the editor to see that the script or scripts were moved. In the example below, I have to click and open MANY scripts in order to get to the script in question. No more need to do that if I just want to move a script :)

Image

Here's an example of when this feature would be really helpful: Say you have created several scripts, but forget that the scripts should only be run for a particular hero. No! We used to have to create a conditional, and then redo the scripts under the conditional. Now all we have to do is create the conditional, and then drag and drop the scripts where they need to be.

And I just found a bug with drag and drop that I'll have to address >.< It happens when you select one or more scripts and try to drag and drop them into the same sequence. I probably introduced that bug when I was fixing another.. Oh well I'll get it taken care of.

Edit: I believe I have fixed the bug mentioned above.

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

Re: Heroes 4 Map Generator / Utility

Unread postby Baronus » 11 Jun 2016, 10:23

Super! Good thing will be copy this forum guide to pdf? format and add to MG. The best learning is using examples... Very, very good!:-)

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 12 Jun 2016, 04:37

Got deleting scripts working and am now working on adding new scripts.

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 16 Jun 2016, 03:27

I can add new scripts now, but I have an issue to solve before I can change one script type to another, such as changing a display script to a conditional script.

Once that's done and working, I need to make it so that we can paste scripts to any sequence, rather than just the top level sequence, since I've already done that for adding new scripts.

I also want to add key bindings so that ctrl + c and ctrl + v work, which should be pretty simple and straightforward.

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 19 Jun 2016, 17:30

Good news! I came up with a solution to the problem of changing a script from one type to another (which required a small infrastructure overhaul) and have retested all the important pieces (and fixed the bugs from the infrastructure change).

I've also updated the script tree so that scripts can be pasted to any sequence script (the sequence must be highlighted or the scripts will be pasted to the top level sequence).

I've added key bindings for ctrl + c and ctrl + v to the script tree, so all that is left is to get the key bindings in place for events. Then, I'll message Kalah and get the initial release of the H4MG out :)

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 20 Jun 2016, 04:25

I believe all key bindings for ctrl + c and ctrl + v. I also found a couple additional bugs which I fixed as well.

I think I'm ready to go ahead and put out the initial release of the H4MG. I've sent Kalah a private message so that he can tell me where to send the zip file and description of the tool.

If anyone finds bugs (which there are bound to be), please follow the instructions in the readme, or just post here / send me a pm and I'd be more than happy to walk you through what would be most helpful in finding and fixing the bugs.

And of course, if you have any features to request (or to move up in priority), just let me know here.

Right now, the next thing on the list to implement is selecting an area of the map and giving options such as copy and paste.

User avatar
Kalah
Retired Admin
Retired Admin
Posts: 20078
Joined: 24 Nov 2005

Re: Heroes 4 Map Generator / Utility

Unread postby Kalah » 20 Jun 2016, 20:32

I have created a dedicated page for the mod here. It can be spruced up with pictures if you want to.
In War: Resolution, In Defeat: Defiance, In Victory: Magnanimity, In Peace: Goodwill.

dlevin
Lurker
Lurker
Posts: 2
Joined: 21 Jun 2016

Re: Heroes 4 Map Generator / Utility

Unread postby dlevin » 21 Jun 2016, 06:21

Hi, I have a question for iLiVeInAbOx05.
I 'm looking for an opportunity to create a game bot for Heroes 4. Now I 'm trying to find coordinates of map objects in unzipped gzip map file (within .h4c file). Would you please explain where these bytes are?

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 21 Jun 2016, 13:57

Kalah wrote:I have created a dedicated page for the mod here. It can be spruced up with pictures if you want to.
Thanks Kalah! Is it possible to navigate to it from the main page? Also, would it be possible to make a small announcement somewhere?

Edit: I see the announcement and was able to navigate to the page under general / all articles, thanks Kalah!
dlevin wrote:Hi, I have a question for iLiVeInAbOx05.
I 'm looking for an opportunity to create a game bot for Heroes 4. Now I 'm trying to find coordinates of map objects in unzipped gzip map file (within .h4c file). Would you please explain where these bytes are?
Hi dlevin :) A couple questions first:

1) What programming language are you looking to use when creating this game bot?
2) Do you know how to get to the block in the .h4c files that contains the objects?

If you go to the original post in this thread, I have a link to my documentation of .h4c files. If you open that up, you can search for the following heading: "Adventure / landscape objects:" Each object starts with an int (4 bytes) indicating the row, followed by an int indicating the column, and then another int indicating the level (above ground 00 00 00 00, or below ground 01 00 00 00). The objects block starts with an int indicating how many objects follow.

For my first question, I have libraries for java that I will eventually make available to anyone that is interested. There is still work for me to do to make them more complete before I do so, but I can easily get a list of objects for the above and below ground, then for each object you have methods available to get the row, column, and level.

For my second question, unfortunately I do not know a way to locate the starting point of the map objects that will work every time. My parsing libraries step through .h4c files section by section, which is how the files seem to be arranged. There isn't any special sequence of bytes that indicates the start of each section.

Hope this helps. Let me know if you have any other questions :)


I have updated the original post here to add a link to the H4MG description / download page.

dlevin
Lurker
Lurker
Posts: 2
Joined: 21 Jun 2016

Re: Heroes 4 Map Generator / Utility

Unread postby dlevin » 22 Jun 2016, 08:58

iLiVeInAbOx05 wrote: Hi dlevin :) A couple questions first:

1) What programming language are you looking to use when creating this game bot?
2) Do you know how to get to the block in the .h4c files that contains the objects?
For your first question, I prefer Python. For your second question, I have read your documentation, but it is not so clear to me where is the start of object block. Please specify in the attached code fragment. The code begins with int 00 00 f8 00( block with artifact properties according to your documentation).

Code: Select all

00 00 f8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5e 17 00 00 5d 00 00 00 25 00 00 00 01 00 00 00 00 19 00 69 6e 74 65 72 6e 61 6c 2e 57 61 6c 6c 73 2e 63 61 76 65 72 6e 2e 31 30 62 00 00 56 00 0d 00 73 79 73 74 65 6d 5f 6f 62 6a 65 63 74 00 00 04 00 77 61 6c 6c 00 00 00 00 00 00 3e 00 00 00 7c 00 00 00 01 00 00 00 00 19 00 69 6e 74 65 72 6e 61 6c 2e 57 61 6c 6c 73 2e 63 61 76 65 72 6e 2e 30 38 64 00 00 56 00 0d 00 73 79 73 74 65 6d 5f 6f 62 6a 65 63 74 00 00 04 00 77 61 6c 6c 00 00 00 00 00 00 41 00 00 00 7d 00 00 00 01 00 00 00 00 18 00 69 6e 74 65 72 6e 61 6c 2e 57

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 22 Jun 2016, 15:01

dlevin wrote:For your first question, I prefer Python.
Okay, I was just asking to see if my libraries could make your life easier :)
dlevin wrote:For your second question, I have read your documentation, but it is not so clear to me where is the start of object block. Please specify in the attached code fragment. The code begins with int 00 00 f8 00( block with artifact properties according to your documentation).

Code: Select all

00 00 f8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5e 17 00 00 5d 00 00 00 25 00 00 00 01 00 00 00 00 19 00 69 6e 74 65 72 6e 61 6c 2e 57 61 6c 6c 73 2e 63 61 76 65 72 6e 2e 31 30 62 00 00 56 00 0d 00 73 79 73 74 65 6d 5f 6f 62 6a 65 63 74 00 00 04 00 77 61 6c 6c 00 00 00 00 00 00 3e 00 00 00 7c 00 00 00 01 00 00 00 00 19 00 69 6e 74 65 72 6e 61 6c 2e 57 61 6c 6c 73 2e 63 61 76 65 72 6e 2e 30 38 64 00 00 56 00 0d 00 73 79 73 74 65 6d 5f 6f 62 6a 65 63 74 00 00 04 00 77 61 6c 6c 00 00 00 00 00 00 41 00 00 00 7d 00 00 00 01 00 00 00 00 18 00 69 6e 74 65 72 6e 61 6c 2e 57
Hmm, is there another 00 00 f8 00 followed by 31 bytes before this snippet? I may have something wrong in my documentation and I'd like to have a look at that particular map if you don't mind. I'll pm you my email. Assuming there is another 00 00 f8 00, I have one extra 00 unaccounted for while going through these bytes using what I have documented. If there's not another 00 00 f8 00, that additional 00 probably means either carry in or carry out artifacts is unchecked (don't remember which), which I'll need to fix in my documentation.

Either way, your objects should start at 5e 17 00 00 (number of objects placed on the map). Then for the first object, its row is 5d 00 00 00, its column is 25 00 00 00, and its level is 01 00 00 00 (underground).

Your next object appears to be at 41 00 00 00 7d 00 00 00 01 00 00 00

Also, something important which I don't seem to mention in my documentation: byte ordering for .h4c files is little endian. I added this little tidbit to the beginning of the documentation.
Last edited by Anonymous on 23 Jun 2016, 13:29, edited 1 time in total.

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 23 Jun 2016, 03:58

So my documentation was almost correct. The AI artifact properties are preceded by 00 00, not just 00. My code had it correct, but I must have forgotten to go back and update the documentation.

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 26 Jun 2016, 05:20

So I noticed after I sent the initial delivery to Kalah that I forgot to implement adding new events, so I went ahead and got that taken care of.

I also started on the area selection tool, and have implemented the drawing portion. There's a new icon on the toolbar for this (see below).

Image

Once you have clicked the selection tool icon, simply left click and drag to enclose the area you would like to select.

Image

The freeform will close itself on mouse release. If you left click and drag a second time, it will clear the old selected area and you will be drawing a new one.

So far that's all it does. I need to determine how I'm going to approach grabbing everything inside the boundary so it's done in a reasonable way. I'll also need to decide how I will determine if the selected area is right clicked to view more options (probably if the user right clicks inside or near the drawn area).

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

Re: Heroes 4 Map Generator / Utility

Unread postby iLiVeInAbOx05 » 29 Jun 2016, 03:57

Update: I got to the point where I am able to copy all objects within a selected area. I haven't done a paste yet to another map, but that will be simple.

Next I'll need to work on getting the terrain rows and columns that are selected and save those. After that is elevation, but I'll probably leave that until later.

I also need to get the mechanism in place to actually tell the H4MG to "Copy selected area", which will likely consist of a context menu that can be accessed by right clicking.


Return to “Heroes I-IV”

Who is online

Users browsing this forum: No registered users and 4 guests