Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 4 - Lands of Axeoth > Thread: Heroes 4 Advanced Options Map Editor
Thread: Heroes 4 Advanced Options Map Editor This thread is 7 pages long: 1 2 3 4 5 6 7 · «PREV / NEXT»
NimoStar
NimoStar


Responsible
Legendary Hero
Modding the Unmoddable
posted September 28, 2023 10:55 AM
Edited by NimoStar at 10:55, 28 Sep 2023.

I already did something like that since the beginning. I added a timed event in each monster that converts from neutral into a player. Sadly, the event doesn't actually trigger.



This is a problem in the base game.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted September 28, 2023 03:47 PM
Edited by iliveinabox05 at 17:38, 28 Sep 2023.

NimoStar said:
I already did something like that since the beginning. I added a timed event in each monster that converts from neutral into a player. Sadly, the event doesn't actually trigger.

This is a problem in the base game.


Bro I literally showed you with screenshots that it can easily be done. I also practically told you how to do it.. unless you're saying I manipulated the images that I posted and am lying ?

It can very easily be done, as I demonstrated in my images in my previous post. I only use the base game for testing things.

Here's the next hint: Read my first hint below, and then read what you posted in response. That should tell you everything you need to know to figure it out

iliveinabox05 said:
This is easily done with the normal game's editor. Here's a hint: You need one map timed event with a single script, and one triggerable event on each random monster object with a single script.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NimoStar
NimoStar


Responsible
Legendary Hero
Modding the Unmoddable
posted September 28, 2023 04:29 PM

That is not very helpful. I never play riddles with people when telling about things I have discovered. There is a reason the object "Sphinx" never made it into the final game.

But I will find out anyways.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted September 28, 2023 05:38 PM
Edited by iliveinabox05 at 05:58, 29 Sep 2023.

NimoStar said:
That is not very helpful. I never play riddles with people when telling about things I have discovered. There is a reason the object "Sphinx" never made it into the final game.

But I will find out anyways.


It's not riddle, buddy! I literally told you how to do it

The only thing I omitted were names for the timed and triggerable events, which are for you to choose. It's really not even a hint and just plain tells you what to do, since you clearly know to use the change owner script.

One more time:

iliveinabox05 said:
You need one map timed event with a single script, and one triggerable event on each random monster object with a single script.


Edit. I also realized - and later verified - there is a better way to do this than the map timed event + army triggerable event combo: Army continuous events. Army continuous events do work, while army timed events do not.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
relancer
relancer


Hired Hero
posted October 01, 2023 09:27 AM
Edited by relancer at 09:48, 01 Oct 2023.

iliveinabox05 said:


Just kidding! This is easily done with the normal game's editor. Here's a hint: You need one map timed event with a single script, and one triggerable event on each random monster object with a single script.

Come on buddy, with the amount of H4 experience you have I expect you to be able to solve stuff like this in seconds!

Now you can finish up your new duel map


I think this can be too much work (an example I needed is for 400 objects, maybe less if remove player's armies but anyway can be a lot over 300)

Since how the random monster is constructed (below), there is no place for owner, if try to put forcely, map will crash

{random_text_length: 2b}{"Random creatures.Random monster"|"Random creatures.RandomLv"{1-4}}{patrol_settings 1b|3b}{6 events}{"none"|"player"|"town"}{0b|player_id: 1b| town_name_len: 2b town_name: town_name_len*1b}{min_strength: 4b}{max_strength: 4b}

as it usually follows after {mRow: 4b}{mCol: 4b}{mLevel: 4b = 00|01 00 00 00}, {mIsArmy: 1b= 00|01} and random creature object.is army is always 0, so it does not count as an army so it cannot have owner (force set the `is_army` to 1 for a random_creature causes a game crash)

Except fully or partially conditionally replacing for  creature object. (like I did in example xl map, making 7-slot generic armies and giving enemy heroes 3 times more army) but still I dont have proper filters.

And probably some script translator from normal program language to H4Script lang, but it seems too hard to do.

I.e it would be not bad if we can write some script converter like:

a = random (3)
if a==0: give_creature(peasant, amount)
else if a == 1: give_creature(squire, amount)
elise if a == 2: give_creature(archer, amount)

instead of manual box filling for defining every random variable, and further every filling the conditional and else boxes rapidly

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
karmakeld
karmakeld


Responsible
Supreme Hero
posted October 01, 2023 10:34 AM

iliveinabox05 said:
NimoStar said:
Speaking of that, will/have you added a mechanism to allow random monsters of level X come with an owner? Because by default, they can only be neutral


Currently in progress with the advanced editor:





Just kidding! This is easily done with the normal game's editor. Here's a hint: You need one map timed event with a single script, and one triggerable event on each random monster object with a single script.

Come on buddy, with the amount of H4 experience you have I expect you to be able to solve stuff like this in seconds!

Now you can finish up your new duel map


Yeah I even believe it is mentioned in the script library file on CH, old news
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
karmakeld
karmakeld


Responsible
Supreme Hero
posted October 01, 2023 10:38 AM

iliveinabox05 said:
NimoStar said:
That is not very helpful. I never play riddles with people when telling about things I have discovered. There is a reason the object "Sphinx" never made it into the final game.

But I will find out anyways.


It's not riddle, buddy! I literally told you how to do it

The only thing I omitted were names for the timed and triggerable events, which are for you to choose. It's really not even a hint and just plain tells you what to do, since you clearly know to use the change owner script.

One more time:

iliveinabox05 said:
You need one map timed event with a single script, and one triggerable event on each random monster object with a single script.


Edit. I also realized - and later verified - there is a better way to do this than the map timed event + army triggerable event combo: Army continuous events. Army continuous events do work, while army timed events do not.


I did a test of these long ago, and recall timed events might not run on neutral armies. Anyway its a quick job testing which run and which doesnt.
Also tested various ways of changing owner, can upload it if you need it, Nimo..
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
relancer
relancer


Hired Hero
posted October 01, 2023 11:36 AM
Edited by relancer at 11:43, 01 Oct 2023.

karmakeld said:


I did a test of these long ago, and recall timed events might not run on neutral armies. Anyway its a quick job testing which run and which doesnt.
Also tested various ways of changing owner, can upload it if you need it, Nimo..


I yet said one moment, random army IS NOT an army object, it cannot have an owner itself by it's essense

Derrick might need also some replacer, that he showed is ok for 2 armies, but that's only 2! You might have issues for 10-20-30 neutral armies to set owners?





But I might miss the detail, might be for that duel map it can be ok with joining 2-4 objects were owner is changed by a script for every duel player.


Another question, random_monster can have calendar event `change_owner`. if you follow this way why just not set it for every army you need????

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted October 01, 2023 04:31 PM

First, an update on the duel map generator: It's almost ready for an initial release! I just have one more scripting bug to hunt down and correct, and then it'll be ready to go for some testing and balancing

It won't have bonuses for useless battle skills, such as Nobility, but that will come next (and suggestions are welcome). All third secondary skills are currently banned, but we could enable them at some point if there are reasonable bonuses for all.

Then I'll get to making it look pretty I'll start looking at adding some random map generation type methods based on Gus Smedstad's algorithm for making boundaries look more natural and stuff like that.

karmakeld said:
I did a test of these long ago, and recall timed events might not run on neutral armies. Anyway its a quick job testing which run and which doesnt.
Also tested various ways of changing owner, can upload it if you need it, Nimo..


It's definitely well known that army timed events don't work, so gotta use a different combination of events if you need something timed on an army

relancer said:
I think this can be too much work (an example I needed is for 400 objects, maybe less if remove player's armies but anyway can be a lot over 300)

Since how the random monster is constructed (below), there is no place for owner, if try to put forcely, map will crash

Except fully or partially conditionally replacing for  creature object. (like I did in example xl map, making 7-slot generic armies and giving enemy heroes 3 times more army) but still I dont have proper filters.


Yes, random monsters do not have an owner field, which is what has prompted all this discussion

Giving random monster objects an owner can easily be accomplished using the events and scripting that I mentioned previously, either manually in the game's editor, or it could be added in the advanced editor. The advanced editor can already add any events and scripting to any objects and conditionals.

relancer said:
And probably some script translator from normal program language to H4Script lang, but it seems too hard to do.

I.e it would be not bad if we can write some script converter like:

a = random (3)
if a==0: give_creature(peasant, amount)
else if a == 1: give_creature(squire, amount)
elise if a == 2: give_creature(archer, amount)

instead of manual box filling for defining every random variable, and further every filling the conditional and else boxes rapidly


The advanced editor can already do what you want to do:
int rand = Math.random(); // scaled from 0 to 73
H4CreatureType ct = H4CreatureType.fromInt(rand);
H4Creature creature = new H4Creature();
creature.setId(ct.VALUE);
creature.setAmount(amount);
army.getTroops().addCreature(creature);

Note. H4CreatureType isn't strictly needed in this small example, but having access to the creature fields via the enum is helpful if you need to do anything else with the creature.

relancer said:
I yet said one moment, random army IS NOT an army object, it cannot have an owner itself by it's essense

Derrick might need also some replacer, that he showed is ok for 2 armies, but that's only 2! You might have issues for 10-20-30 neutral armies to set owners?

But I might miss the detail, might be for that duel map it can be ok with joining 2-4 objects were owner is changed by a script for every duel player.


I just want to mention first that the events and scripting we are discussing above are being added using the normal game editor, NOT the advanced editor.

Having said that, you seem to keep forgetting that we have the .h4c format fully reversed and coded If you wanted to set an owner on all random monster armies on the map, it could easily be done. Just loop through each object on the map, and if it's a random monster object, add the events and scripting (only one event is needed since army continuous events work).

Setting specific random monsters with an owner would also be a simple thing to do: Add a check box on random monster objects in the advanced editor to set an owner. When the user selects "Okay", add the continuous event to the random monster object.

relancer said:
Another question, random_monster can have calendar event `change_owner`. if you follow this way why just not set it for every army you need????


Calendar events (aka Timed events) don't work on armies. They never get called. Thus why I have been saying use a map timed event instead But army continuous events work, and using them is a much cleaner solution.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
relancer
relancer


Hired Hero
posted October 01, 2023 07:19 PM
Edited by relancer at 19:27, 01 Oct 2023.

iliveinabox05 said:

The advanced editor can already do what you want to do:
int rand = Math.random(); // scaled from 0 to 73
H4CreatureType ct = H4CreatureType.fromInt(rand);
H4Creature creature = new H4Creature();
creature.setId(ct.VALUE);
creature.setAmount(amount);
army.getTroops().addCreature(creature);



I meant other thing.. for example some linguistic translator
that can convert for example <if..else..> logic to the series of {event_heading{=131072}...seq{num_commands}..op1..op2} that can be written as script outside the editor. So it can complete like what I wanted to do in the begining (i dont need it more but just an example. It was a set of variables with recursive trigger for giving growth*randval amount of creatures[other random from example peasant, squire, archer]) with native h4script lang. But I was needed for fill 2000 (maybe more even 5000 boxes for only 1-2 heroes). But it seems very hard to do.

But honestly I dont have a clear idea (only have vague semi-ideas) where to use such linguistic translator for now.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted October 01, 2023 08:17 PM

relancer said:
I meant other thing.. for example some linguistic translator
that can convert for example <if..else..> logic to the series of {event_heading{=131072}...seq{num_commands}..op1..op2} that can be written as script outside the editor. So it can complete like what I wanted to do in the begining (i dont need it more but just an example. It was a set of variables with recursive trigger for giving growth*randval amount of creatures[other random from example peasant, squire, archer]) with native h4script lang. But I was needed for fill 2000 (maybe more even 5000 boxes for only 1-2 heroes). But it seems very hard to do.

But honestly I dont have a clear idea (only have vague semi-ideas) where to use such linguistic translator for now.


Don't need to translate something that can already be done, haha

What you're talking about is just re-writing more of the h4c specification in python. Ultimately you would be better off if you just spent the time writing everything from my libraries that has to do with h4c files in a new python library. Otherwise you're going to continue to be in the same boat that you currently are where everything you want to do is difficult to impossible.

Those few lines of code I wrote are all that would need to be done for the example you wrote. And I am creating a lot of events with complex scripting outside of the game's editor (using the advanced editor), for duel maps.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
relancer
relancer


Hired Hero
posted October 02, 2023 09:35 AM
Edited by relancer at 09:52, 02 Oct 2023.

iliveinabox05 said:

Don't need to translate something that can already be done, haha

What you're talking about is just re-writing more of the h4c specification in python. Ultimately you would be better off if you just spent the time writing everything from my libraries that has to do with h4c files in a new python library. Otherwise you're going to continue to be in the same boat that you currently are where everything you want to do is difficult to impossible.

Those few lines of code I wrote are all that would need to be done for the example you wrote. And I am creating a lot of events with complex scripting outside of the game's editor (using the advanced editor), for duel maps.


if to try to explain detally

there is a user and user wants to write script that gives 6 slots to selected army

instead of filling boxes he opens something in editor/whereever else and write javascript style for example:


rand_race = random(0, 5)
rand_amount = random (1, 100);
if (random_race == 0){  // life for example
   rand_unit1_type = random(0,2);
   if (rand_unit1_type == 0) {give_creature(peasant_id, 36 * rand_amount}
   else if (rand_unit1_type==1){give_creature(squire_id, 21* rand_amount)}
   else if (rand_unit1_type==2){give_creature(archer_id, 16*rand_amount)}
   // if for level2 creature
  //if for level3 creature
  // if for level4 creature
  //something for other slots
}
else if (random_race==1){
   // death for example
}

And this to be converted to
{'seq'.length}seq{num_commands}Variable{'rand_race'.length rand_race}rand{low_bound high_bound}...if...give_creature... and so on

So finally you need to write linear javascript like code instead of box filling and this to be converted to h4script


Like translator from javascript to h4script so someone can easily write in normal scripting language that will be translated to h4script. (H4 random lower_bound seems begins from 1 to x but this easily adjustable)

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted October 02, 2023 04:38 PM
Edited by iliveinabox05 at 19:08, 02 Oct 2023.

relancer said:
if to try to explain detally

there is a user and user wants to write script that gives 6 slots to selected army

instead of filling boxes he opens something in editor/whereever else and write javascript style for example:


rand_race = random(0, 5)
rand_amount = random (1, 100);
if (random_race == 0){  // life for example
   rand_unit1_type = random(0,2);
   if (rand_unit1_type == 0) {give_creature(peasant_id, 36 * rand_amount}
   else if (rand_unit1_type==1){give_creature(squire_id, 21* rand_amount)}
   else if (rand_unit1_type==2){give_creature(archer_id, 16*rand_amount)}
   // if for level2 creature
  //if for level3 creature
  // if for level4 creature
  //something for other slots
}
else if (random_race==1){
   // death for example
}

And this to be converted to
{'seq'.length}seq{num_commands}Variable{'rand_race'.length rand_race}rand{low_bound high_bound}...if...give_creature... and so on

So finally you need to write linear javascript like code instead of box filling and this to be converted to h4script


Like translator from javascript to h4script so someone can easily write in normal scripting language that will be translated to h4script. (H4 random lower_bound seems begins from 1 to x but this easily adjustable)


Yep, I see what you're saying, and my answer doesn't change: It can pretty easily be done if you are using my h4c libraries.

I'm actually doing almost exactly what you're asking for above with the duel map generator. This is what I'm adding to each player's hero in a triggerable event:

if player is chaos
add first level 4 chaos creature, amount
add second level 4 chaos creature, amount
... repeat for other slots

if player is life
add first level 4 life creature, amount
add second level 4 life creature, amount
... repeat for other slots

... repeat for other factions

Instead of checking the player alignment, all that would need to be done would first be to get a random int and then change the conditionals to check the int variable and choose the faction that way.

The only thing that would take a little thought for the best way to do is for using a random amount, since the give creature script can't take a variable as the amount.

I don't think selecting one single number for the amount makes sense, since then you could have an army with 1 Peasant and 1 Angel. I think it would make more sense to use a number of weekly growth, which is what I'm doing in the duel maps instead of just adding specific numbers of each creature.

Then you could get some more realistic looking armies with the same relative growth across each creature slot.

So to choose a random amount you would just add a script to set the numeric variable numWeeksGrowth to a random number between 2 numbers and call the triggerable event to add the creatures.

Yes, this can be instead added to all neutral stacks (or whatever you want to add it to) on a map or you can replace random monster objects with a neutral army and add this scripting, etc.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
relancer
relancer


Hired Hero
posted October 02, 2023 07:37 PM

iliveinabox05 said:

The only thing that would take a little thought for the best way to do is for using a random amount, since the give creature script can't take a variable as the amount.



I did it through recursive trigger - define random variable, and then trigger give one growth, decrease this variable, if variable greater than 0 then call trigger again and it works that way.

But most think is for example heroes 5 has stripped Lua language that someone can use (it's stripped very strongly, most of normal lua functions do not work)

Here some translator could have similar function, i.e for example in heroes5 user does not need to compile anything, he write code text to lua file and it runs. Here I think should be at least function that can convert custom javascript-like code to H4Script.

Otherwice user script cannot be absolutely custom and depends on developer.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted October 02, 2023 07:51 PM

relancer said:
I did it through recursive trigger - define random variable, and then trigger give one growth, decrease this variable, if variable greater than 0 then call trigger again and it works that way.

But most think is for example heroes 5 has stripped Lua language that someone can use (it's stripped very strongly, most of normal lua functions do not work)

Here some translator could have similar function, i.e for example in heroes5 user does not need to compile anything, he write code text to lua file and it runs. Here I think should be at least function that can convert custom javascript-like code to H4Script.

Otherwice user script cannot be absolutely custom and depends on developer.


Yes, triggerable events using recursion is what I described

Nothing would need to be compiled by the user. You would just open up a map, Maybe have a menu Advanced->Randomize Armies, and it goes through the map and adds the scripting. Even more simple to add settings to customize.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
relancer
relancer


Hired Hero
posted October 02, 2023 08:00 PM
Edited by relancer at 20:08, 02 Oct 2023.

iliveinabox05 said:


Nothing would need to be compiled by the user. You would just open up a map, Maybe have a menu Advanced->Randomize Armies, and it goes through the map and adds the scripting. Even more simple to add settings to customize.


I am more about programabble (!) writing a script to hero (absolutely custom map and absolutely custom desired script), not java/python scripting (it can only translate pseudo-lang to h4script, but without any map logic done by java/python except select_script,translate_pseudo and write_script), not filling the boxes, final script can be h4script bytes written to hero.

Something like java translator to bytecode
Might be very useful, just I think it is a bit hard.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted October 02, 2023 08:40 PM

relancer said:
I am more about programabble (!) writing a script to hero (absolutely custom map and absolutely custom desired script), not java/python scripting (it can only translate pseudo-lang to h4script, but without any map logic done by java/python except select_script,translate_pseudo and write_script), not filling the boxes, final script can be h4script bytes written to hero.

Something like java translator to bytecode
Might be very useful, just I think it is a bit hard.


I think I see what you're asking. You want something that can read a file that has c-like code that can be converted into events and scripts for any of the H4 scripts.

Could it be done? Sure, but it would be a massive amount of work to cover all scripts and you'd basically need to come up with your own scripting language for it (or use something like what h4util does).

You also have 0% chance to accomplish it without re-writing the entire h4c specification into your desired language to do the converting and adding. Not trying to be rude, just being realistic.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
relancer
relancer


Hired Hero
posted October 02, 2023 10:35 PM
Edited by relancer at 23:03, 02 Oct 2023.

iliveinabox05 said:


Could it be done? Sure, but it would be a massive amount of work to cover all scripts and you'd basically need to come up with your own scripting language for it (or use something like what h4util does).



It seems not that unreal after sorting the commands by type and then defining it semantic (i grouped to: cmp operators, logical operators, math operators, set/clear operators, check_bool_state operators, other check operators, incr/decr operators, take/give operators, calendar-dependent operators, definitions, single executive actions)

There are only 97 commands and I still have troubles in understanding the meaning (what are they for) the below ones:

   LITERAL="lit",
   PLAYER="player", # ??? (suspicion: player player_id belongs_to fraction_id)
   
   REMOVE_THIS="rem_this", # ? what is it?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted October 02, 2023 11:07 PM

relancer said:

It seems not that unreal after sorting the commands by type and then defining it semantic (i grouped to: cmp operators, logical operators, math operators, set/clear operators, check_bool_state operators, other check operators, incr/decr operators, take/give operators, calendar-dependent operators, definitions, single executive actions)

There are only 97 commands and I still have troubles in understanding the meaning (what are they for) the below ones:

   LITERAL="lit",
   PLAYER="player", # ??? (suspicion: player player_id belongs_to fraction_id)
   
   REMOVE_THIS="rem_this", # ? what is it?


H4Script.java and H4ScriptUtil.java should have everything in them. Good luck

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
relancer
relancer


Hired Hero
posted October 02, 2023 11:36 PM

iliveinabox05 said:


   LITERAL="lit",
   PLAYER="player", # ??? (suspicion: player player_id belongs_to fraction_id)
   
   REMOVE_THIS="rem_this", # ? what is it?


H4Script.java and H4ScriptUtil.java should have everything in them. Good luck


I mean I need to understand the meaning of this what does it mean as an editor option

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: Next Thread » This thread is 7 pages long: 1 2 3 4 5 6 7 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.1175 seconds