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
Karmakeld
CH Staff
CH Staff
Posts: 1099
Joined: 12 Nov 2011

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » May 12 2016, 21:31

Leave it to us 'common' people to test and comment on the user-friendliness for non programmers ;) of course this would require an actual setup and not just the theory of it. You start loosing me on those parts.
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: 578
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » May 13 2016, 16:13

Fear not, there won't be any actual typing involved (there would be too much event handling and too many cases to check). You will still need to select the script type you want to add.

I'm leaning toward my description at the end of my last post. Putting the requirements in a java Tree might be slightly confusing due to the orientation, so I'll probably try to stick to something that's visually linear (left to right).

Oh, and H4MG just stands for Heroes 4 Map Generator. It was going to be H4RMG, but it's already more than just a random map generator. Probably still needs a better name :)

Some good things to think about from your post Duzeom.

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

Re: Heroes 4 Map Generator / Utility

Postby Karmakeld » May 14 2016, 20:07

Just a quick note, from my short test of it, you should add the Rock Terrain Tool. Minor detail, but that seems to be lacking atm.
I successfully created a new map using the H4MG, and got no problems loading and saving new edits between the MG and the editor. The colums also fits nicely, although the small brush paints Tetris blocks instead of a single 1x1 tile, and as you mentioned, it completely square. So perhaps add an 'extra small' 1x1 brush? Creating a new map, it reads in the editable objects I've placed, as well as a quest hut name perfectly.
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: 578
Joined: 21 Jul 2014

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » May 15 2016, 5:35

The rock terrain tool might be a little tough (or might just take some time) because I have to also place the rock / cave objects on the boundaries. I can certainly come up with an algorithm to go around the rock / terrain boundary and place the rock / cave object, I'll just have to map the boundary faces to the correct object faces.

As far as the brushes and sizes of the brushes, I plan to add a square brush that is oriented the way the terrain brush in the editor is :)

Also, I fixed a couple more bugs causing me to be unable to load certain maps in the H4MG. I happened to have missed a couple scripts and had another bug where I was using an incorrect index.

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

Re: Heroes 4 Map Generator / Utility

Postby iLiVeInAbOx05 » May 22 2016, 6:47

Update: I believe I have viewers for all objects with events, as well as the ability to copy events between them. I also have support for editing some of the other major fields for the objects (such as name fields).

I do kind of want to redo the way I handled copying and pasting events, since I implemented my own way, rather than using the Clipboard (forgot to check for java support of the Clipboard, and they do have support for it). It would clean up quite a bit of code, but I may wait until later to switch it up.

As far as scripting features Something else I thought of that would be quite nice has to do with calling a custom triggered event from another event. It would be really convenient if we could open up that custom event to view / edit from the event we are currently looking at, rather than having to go back into the events to find it and open it. I'm thinking I'll probably add an edit button to the "Trigger Custom Event" panel which will open up an event edit frame for the custom triggered event which defaults to the script panel.

User avatar
iLiVeInAbOx05
Equilibris Team
Equilibris Team
Posts: 578
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: 578
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: 578
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: 578
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: 40
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: 1099
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: 578
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: 578
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: 578
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: 578
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: 1099
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: 345
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: 578
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 :)


Return to “Heroes I-IV”

Who is online

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