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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » May 31 2016, 21:12

Update: I have implemented the ability to view and edit most scripts. I have also implemented the ability to "step into" and view / edit custom events from a separate event. Here are some screen shots to illustrate what I'm talking about.

First, open up a map that has event scripting which calls a custom event via the "Trigger custom event" script. Then navigate to an event which has one of these scripts in it.

Image

View the event (by double clicking it) and select the "Trigger custom event" script.

Image

Open it (by double clicking) and you will see the following:

Image

I've added a button "Edit Event". Clicking it will open up an Event Properties dialogue for the selected custom event and default to the "Script" tab.

Image

No more hunting around to find a custom event when you're trying to trace your events to debug or see how another map maker did his/her scripting, simply open it from the event you are looking at :)

I'm likely going to add a context menu so that right clicking on a "Trigger custom event" script in the script viewer will give you the option to go to the custom event so that we don't have to open the script dialogue first (fewer clicks).

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Jun 1 2016, 0:57

Another update: I've begun copying and pasting scripts between events! We can also copy and paste scripts to the same event. I'll probably work on adding new scripts and changing the type of other scripts next. Then I'll look at moving scripts by dragging them (and allow scripts to be moved into or out of other scripts, such as a conditional).

Then the area selection tool, although I think before that I may update my old copy / paste implementation to use the system clipboard, which is significantly easier and better than what I initially implemented. In fact, I may do that first..

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Jun 1 2016, 5:00

Okay, I fixed the copy / paste implementation to use the system clipboard, which cleaned up a LOT of code, besides being the correct way to do things. It will be a simple thing to implement copying / pasting of pretty much anything else useful now that I know how to use the clipboard :)

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Jun 1 2016, 9:43

Maybe something like a pen to draw copied area borders?

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Jun 1 2016, 13:40

Baronus, I do plan to make it so you can draw on the map to create the area to copy, so you will be able to see the borders on the map you copy from :) I should also be able to put the same outline on any map you paste to.

User avatar
CTPAHHuK
Leprechaun
Leprechaun
Posts: 37
Joined: 30 Nov 2008
Location: Russia, Saint-Petersburg

Re: Heroes 4 Map Generator / Utility

Postby CTPAHHuK » Jun 1 2016, 15:03

is there exe file?

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Jun 1 2016, 15:41

Those are great news. Brilliant to come up with an easy solution, of tracking triggered scripts. Will be very useful. Also can't wait to try out the map copying part.
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: 566
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Jun 1 2016, 16:34

Hi CTPAHHuK, there isn't an exe file since I'm using Java to create this application. So unfortunately, when I release the H4MG, it will require anyone who wishes to use it to download and install Java. Once that's done, all you have to do is double click the java icon in the H4MG folder :)

I think I will ask Kalah to do an initial release once I finish with the scripting stuff I'm currently working on (adding new scripts, changing script type, and dragging / dropping).

Glad you like it Michael :) I just recalled how annoying it was to try to locate scripts when I haven't looked at them in a while!

Once I finish with the scripting stuff and get the initial release out, I'll focus on copying parts of one map to another (or copying to the same map in a different location / moving the selected area around).

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Jun 2 2016, 13:31

Alright, well yesterday I found a good example of how to add drag and drop to a JTree and so I have drag and drop currently working :) I thought that was going to be the difficult part, but it was actually pretty easy with an example. I'm just going to have to tweak some things so they fit a little better.

Then, the hard part, will be updating the list of scripts based on the JTree, since the JTree itself isn't backed by the list that I pass in, so I'll just have to play around with some debug to figure out the best way to get that linked in. Then, I'll test as much as possible and message Kalah to make an initial release of the H4MG available here :)

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

Re: Heroes 4 Map Generator / Utility

Postby Baronus » Jun 2 2016, 19:28

Problems are defeat...It will very good MG as I see :-)

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Jun 4 2016, 18:19

Well, I think I have all the cases for drag and drop in the script tree covered. Basically, you can drag a script to any other sequence script or change the order of scripts within a sequence script. You cannot drag a script if it is the first script under a "Then" / "Else", "Yes" / "No", or "Victorious" / "Defeated" block. I also added a case to prevent things like dragging an Ask script into its "Yes" or "No" sequence scripts.

I still have the difficult task of determining the best way to translate these tree node movements into an actual change in the script list, which is the next item on my list :)

I also realized that I didn't show a little example of copying and pasting scripts, so I'll take a couple screen caps for that later today. Admittedly it's pretty much the same as copying / pasting events, but I'll show it anyway :)

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Jun 4 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: 1092
Joined: 12 Nov 2011

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » Jun 5 2016, 7: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

Steven Aus
Demon
Demon
Posts: 325
Joined: 08 Feb 2006
Location: Australia

Re: Heroes 4 Map Generator / Utility

Postby Steven Aus » Jun 5 2016, 8:21

A WizInABox. :)

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Jun 6 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: 566
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Jun 10 2016, 3: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

Postby Baronus » Jun 10 2016, 7:05

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

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Jun 11 2016, 0: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

Postby Baronus » Jun 11 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: 566
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » Jun 12 2016, 4:37

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


Return to “Heroes I-IV”

Who is online

Users browsing this forum: No registered users and 7 guests