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»
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted May 01, 2023 11:24 PM
Edited by iliveinabox05 at 23:32, 01 May 2023.

relancer said:
Hello.

Is there any kind of tool/information or help with this util how can I convert h4s or h4c to data format and pack it back??? Or access adventure map object without just editing custom always different bytes???

I want to take control over adventure element, like hero army, to be able to at least select, better: to know how to modify. WITHOUT EDITOR, because map I want to do requires too much (1000+) dropdown field and very hard to restore if i lose change, I want to emit editor or access the cell.


I'm a little bit confused as to what you're asking. In your first post, it sounds like you want to be able to manipulate scripts a little better?

If that's the case, then opening the map with the advanced editor you can select armies from the "Events" tab, and then the "Objects with Events" tab. Unfortunately I don't show a point on the map when you select the army in the table, but the dialogue you get when double clicking an army will contain the row, column, and level so you can be sure you are editing the correct army object.

Once you have opened the correct army object, you can go to the events tab and go to the scripts like you would in the regular editor. The cool thing about this is that you get a tree view of the scripts, rather than having to open 1,000 dialogues to get to the script you want.

There are all sorts of things you can do in the script viewer, and some things you can't do as well. If you can be more specific as to what you're looking to do, I can tell you if it's possible or not.

relancer said:
I actually extracted gzips as inner map.. Receiving map starting with bytes
1d 00 02 00 like this document says

https://docs.google.com/document/d/1j35syvvSBywvfG54nj5WfQEaPc9nJV8ZQEFez8StKrk/edit

but there is NO information how to locate army slots...


There is plenty of information about army objects (and slots), simply ctrl + f and type in "army"  

Now, if you are wondering how to go from the beginning of the map file to an army object using some offset to locate it, that is impossible. The location of the start of map objects (adventure and army), depends on any other events and map settings that come before it, so there's not way to just look at the unzipped map file and navigate to adventure / army objects.

Again, if you're more specific with what you're trying to do, I can tell you if what you want to do is possible or not with the advanced editor.

Edit. Actually, there is a way you could find an object you're looking for, but I'm not sure what you would do with it once you locate it in a hex viewer. If you know the row, column, and level of the object, do a search in the hex viewer you're using to look at the unzipped map file. Searching for "00 00 00 00 4C 00 00 00 00 00 00 00" would be searching for an object on row 1, column 77, and level 0 (keep in mind you need to subtract 1 from the row and column since the editor displays rows and columns starting with 1, but in the file rows and columns start from 0).

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


Hired Hero
posted May 02, 2023 12:16 AM
Edited by relancer at 00:56, 02 May 2023.

an example:

I wanted to create a map, that generate me random army from random race for each slot for 2 heroes

What I needed to do???

1) create army_size variable (random x to y)
2) create variable hero1_race (random 1 to 6)
3) create 6 variables self_army1_slot{1-6} (one slot for hero, 6 slots for random army)
4) for each variable set random

how:
  if hero1_race = 1 // life:
     army1_slot1 = random (1 to 3)
     ...
  then I create recursive trigger, which give me 36 peasants if hero_race = 1 and army1_slot1=1, 16 crossbowman if hero_race=1 and army1_slot1=3, fill in all of these and calls itself trigger `army_size` times (I dont need to fill a loop, but I need to fill all possible if`s and repeat it lot of time manually)

It works. But I need to repeat and manually fill huge amount of boxes to create lt of conditions, every time to fill condition I need to fill in the dropdown within map editor. Because I need to select dropdown for every single "add variable +1" operation and so on.  

this is 6 races * 6 slots * each slot fill with click. So to create 2 random heroes with random race, but same army-town I need to fill over 2000 boxes!!! Plus if you suddenly "mouse scroll" and save, you can lose your progress and need to refill forms again!

The result for life for example it gives me 10672 archers, 6003 pikements (if army_size were randomly set to 667), on other load it can give me peasants and ballistas in proportion, it works nice, but this is very AWFUL TO WRITE such a script in THAT WAY the editor allows me.

It's a crap.
If I have access to hero slot and army slot I can easily fill it with programming where I dont need manually describe every "inc" operation, every race conditions. I can simply write a few simple loops just outside this campaign editor.

For such and similar purposes I need to know at least how to LOCATE hero/creature slots or `hero.RandomHero` or other object in this ungzipped resource that starts with 1D 00 (I found and extracted it)
, rest of job I will do myself.
____________

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


Hired Hero
posted May 02, 2023 12:34 AM
Edited by relancer at 00:36, 02 May 2023.

Here are the only small part of things I need to do for the following and fill all of these, these 2 screen I need to repeat 2 heroes * 6 races * tonn if's and other form-fill

screenshot1 - https://cdn.discordapp.com/attachments/917849808767705150/1102723200288296980/image.png

screenshot2 - https://cdn.discordapp.com/attachments/917849808767705150/1102723364918931536/image.png

If I am able to locate an object - things become much simplier. I will do myself, just need to know mechanism HOW to locate.
____________

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


Honorable
Famous Hero
posted May 02, 2023 06:19 AM
Edited by iliveinabox05 at 06:22, 02 May 2023.

relancer said:
Here are the only small part of things I need to do for the following and fill all of these, these 2 screen I need to repeat 2 heroes * 6 races * tonn if's and other form-fill

screenshot1 - https://cdn.discordapp.com/attachments/917849808767705150/1102723200288296980/image.png

screenshot2 - https://cdn.discordapp.com/attachments/917849808767705150/1102723364918931536/image.png

If I am able to locate an object - things become much simplier. I will do myself, just need to know mechanism HOW to locate.


If you've already done the scripting once, you can copy and paste events and scripts using the advanced editor. Simply go to the events tab like I mentioned before, then objects with events, then locate the army with the scripting. Copy the event (either right click and select copy, or ctrl + c). Then open up the dialogue for the army you want to paste the event to, go to the type of events and paste it (right click and select paste or ctrl + v).

As I said before, there is no certain way, other than following my documentation to parse a map file until you reach map objects, to find the various army objects you're looking for.

You can always use my code, which is freely available for anyone to take a look at here.

Feel free to look through it and use whatever you need. You'll want to start with H4CampaignParser.java and H4MapParser.java.

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


Hired Hero
posted August 06, 2023 10:34 AM
Edited by relancer at 10:49, 06 Aug 2023.

iliveinabox05 said:


You can always use my code, which is freely available for anyone to take a look at [url=https://gitlab.com/iLiVeInAbOx05/heroes-4-modding-open-source]here[/url].

Feel free to look through it and use whatever you need. You'll want to start with H4CampaignParser.java and H4MapParser.java.


I have problems with parsing Objects, before it's going ok, it also going ok in detecting the number of objects [H4ObjectParser.java:426] int numObjects = buffer.getInt(); but then on getting mRow, mCol, mlevel, mIsArmy it gives some big and crap numbers that are randomly changing if I add or remove object (number of objects re-calculates correctly when I add/remove object in map editor and save map, also I add new object below and righter than first one). What is missing there?

also if to follow the doc

For all objects:
The first int indicates how many objects have been placed on the map (that means you can have up to Integer.MAX_VALUE objects). Each object starts out with an int for the row, followed by an int for the column. After this is an int for the level (00 00 00 00 aboveground, 01 00 00 00 below ground). It seems like this value should just be a byte, but so far the previous seems to always be true. The next byte seems to indicate if the object is an army (00 no, 01 yes).

Might be something comes between numObjects and first object and I missed that in the code or this description???

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


Hired Hero
posted August 06, 2023 03:44 PM
Edited by relancer at 15:45, 06 Aug 2023.

I actually have some progress in army locator

It was a bit wierd to rewrite events correctly, but for a test map I got such a data (which is real). Artifacts is not processed and will fail but i will add later - it's not that hard as events. Entry pos is a byte position in extracted ungzipped file-map (shifted by one) and should start with 01 09 00

What it can give?
Army slots can be filled outside IF we dont have heroes (yet, I will add).

army objects in this example map:

[
   {
       "entry_pos": 219,
       "owner": 0,
       "owner_human_repr": "Red",
       "combat_slots": {
           "m_lead_short": 0,
           "m_slots": [
               {
                   "slot_start_pos": 225,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10000,
                   "num_artifacts": 0,
                   "slot_end_pos": 234
               },
               {
                   "slot_start_pos": 234,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10001,
                   "num_artifacts": 0,
                   "slot_end_pos": 243
               },
               {
                   "slot_start_pos": 243,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10002,
                   "num_artifacts": 0,
                   "slot_end_pos": 252
               },
               {
                   "slot_start_pos": 252,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10003,
                   "num_artifacts": 0,
                   "slot_end_pos": 261
               },
               {
                   "slot_start_pos": 261,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10004,
                   "num_artifacts": 0,
                   "slot_end_pos": 270
               },
               {
                   "slot_start_pos": 270,
                   "slot": 255,
                   "slot_end_pos": 271
               },
               {
                   "slot_start_pos": 271,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10005,
                   "num_artifacts": 0,
                   "slot_end_pos": 280
               }
           ]
       }
   },
   {
       "entry_pos": 514,
       "owner": 1,
       "owner_human_repr": "Blue",
       "combat_slots": {
           "m_lead_short": 0,
           "m_slots": [
               {
                   "slot_start_pos": 520,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10006,
                   "num_artifacts": 0,
                   "slot_end_pos": 529
               },
               {
                   "slot_start_pos": 529,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10007,
                   "num_artifacts": 0,
                   "slot_end_pos": 538
               },
               {
                   "slot_start_pos": 538,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10008,
                   "num_artifacts": 0,
                   "slot_end_pos": 547
               },
               {
                   "slot_start_pos": 547,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10009,
                   "num_artifacts": 0,
                   "slot_end_pos": 556
               },
               {
                   "slot_start_pos": 556,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10010,
                   "num_artifacts": 0,
                   "slot_end_pos": 565
               },
               {
                   "slot_start_pos": 565,
                   "slot": 255,
                   "slot_end_pos": 566
               },
               {
                   "slot_start_pos": 566,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 73,
                   "creature_name": "Mega Dragon",
                   "amount": 10011,
                   "num_artifacts": 0,
                   "slot_end_pos": 575
               }
           ]
       }
   },
   {
       "entry_pos": 726,
       "owner": 6,
       "owner_human_repr": "Neutral",
       "combat_slots": {
           "m_lead_short": 0,
           "m_slots": [
               {
                   "slot_start_pos": 732,
                   "slot": 0,
                   "mUnk1": 1,
                   "id": 40,
                   "creature_name": "Monk",
                   "amount": 0,
                   "num_artifacts": 0,
                   "slot_end_pos": 741
               },
               {
                   "slot_start_pos": 741,
                   "slot": 255,
                   "slot_end_pos": 742
               },
               {
                   "slot_start_pos": 742,
                   "slot": 255,
                   "slot_end_pos": 743
               },
               {
                   "slot_start_pos": 743,
                   "slot": 255,
                   "slot_end_pos": 744
               },
               {
                   "slot_start_pos": 744,
                   "slot": 255,
                   "slot_end_pos": 745
               },
               {
                   "slot_start_pos": 745,
                   "slot": 255,
                   "slot_end_pos": 746
               },
               {
                   "slot_start_pos": 746,
                   "slot": 255,
                   "slot_end_pos": 747
               }
           ]
       }
   }
]

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


Honorable
Famous Hero
posted August 06, 2023 06:19 PM
Edited by iliveinabox05 at 18:22, 06 Aug 2023.

relancer said:
I have problems with parsing Objects, before it's going ok, it also going ok in detecting the number of objects [H4ObjectParser.java:426] int numObjects = buffer.getInt(); but then on getting mRow, mCol, mlevel, mIsArmy it gives some big and crap numbers that are randomly changing if I add or remove object (number of objects re-calculates correctly when I add/remove object in map editor and save map, also I add new object below and righter than first one). What is missing there?

also if to follow the doc

For all objects:
The first int indicates how many objects have been placed on the map (that means you can have up to Integer.MAX_VALUE objects). Each object starts out with an int for the row, followed by an int for the column. After this is an int for the level (00 00 00 00 aboveground, 01 00 00 00 below ground). It seems like this value should just be a byte, but so far the previous seems to always be true. The next byte seems to indicate if the object is an army (00 no, 01 yes).

Might be something comes between numObjects and first object and I missed that in the code or this description???


If you're reading in the h4c maps using the H4CampaignParser or H4MapParser class, then you shouldn't be having any issues.

The only way there can be a problem reading in a map is if the map is NOT in WoW format. There are still some differences in format from base and TGS that I haven't gone back to figure out, so the maps you read with the advanced editor need to be in WoW format (open the map in the WoW editor and re-save it).

If you are trying to read in a map by passing it into the H4ObjectParser, that just won't work because there is a lot of stuff in the map that comes before objects. The H4ObjectParser class expects to receive the byte buffer positioned at the start of the objects.

Maybe post some of the code where you read in the map for me to take a look at if it's not any of the above.

And you know, if you're just trying to locate all armies, the advanced editor already does that. When you open a map with the advanced editor, select the "Events" tab, and then the "Object Events" sub tab. At the top of the resulting panel there is an "Armies and Heroes" sub panel with all armies and heroes on the map. All you need to do is read in the map, map.getObjectParser, then for each H4Object if it's an instance of H4ArmyObject, save the object to your own list.

Now, if you're trying to re-write all of that code in C++ or some other language.. you're on your own I'll still help you some, but I've already done all the work to get it right, so figuring out what you did wrong if you're doing a re-write is up to you.

Basically, you're being to vague when you are saying what you're doing  and then also asking vague questions, so I am having to try to answer every possible scenario. If you tell me exactly what you're doing, I can probably help you better.

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


Hired Hero
posted August 07, 2023 03:17 PM
Edited by relancer at 16:07, 07 Aug 2023.

I actually added it there and explained a bit. I did not need to rewrite it all, but I needed to copy part of parsing algoritm because I don't know bytes meanings.

source link is "https://bitbucket.org/vovavovavova/homm4-things/src/master/"

From the begining I did events, oracle_info, carryover and all other heading information parsers (that failed on events (if exists) btw, on my fault but too many time wasted for that), But I found there is a bit simplier way to access armies, so I removed unneeded functionality  (map_header is left without real reason for it) and pushed there. You can view json file and open map (intended normally for vanilla homm4).

I will continue uncompleted part when I have free time.

Probably I dont need to solve that problematic things in parsers anymore, just will need to actually do and complete that part.

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


Honorable
Famous Hero
posted August 07, 2023 04:20 PM

relancer said:
I actually added it there and explained a bit. I did not need to rewrite it all, but I needed to copy part of parsing algoritm because I don't know bytes meanings.

source link is "https://bitbucket.org/vovavovavova/homm4-things/src/master/"

From the begining I did events, oracle_info, carryover and all other heading information parsers (that failed on events (if exists) btw, on my fault but too many time wasted for that), But I found there is a bit simplier way to access armies, so I removed unneeded functionality  (map_header is left without real reason for it) and pushed there. You can view json file and open map (intended normally for vanilla homm4).

I will continue uncompleted part when I have free time.

Probably I dont need to solve that problematic things in parsers anymore, just will need to actually do and complete that part.


What you posted above is json, not the parsing code

I see you're trying to re-write in python.

If you're somehow able to bypass the map header and whatever else without reading through it and land on the start of objects, then more power to you

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


Hired Hero
posted August 07, 2023 04:24 PM
Edited by relancer at 16:33, 07 Aug 2023.

Parsing code is in script_workaround.py and it works, json is an resulting output of it's work.

If to add any army in original editor, save and run -> json will be updated
It seems it works correctly

Also it seems I'm done with a locating armies (of course if heroes dont have scripts and other small limits)

(dont sure if it work the same in equilibris but it would most likely do)

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


Hired Hero
posted August 07, 2023 05:39 PM
Edited by relancer at 17:45, 07 Aug 2023.

I might miss the meaning of 24 bytes - hero spells
why it's 24 and how we can explain them

With 36 hero skills it's clear and written in doc in "Byte locations are as follows (Byte number - skill):" section, but speels are not clear

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


Honorable
Famous Hero
posted August 07, 2023 06:36 PM

relancer said:
I might miss the meaning of 24 bytes - hero spells
why it's 24 and how we can explain them

With 36 hero skills it's clear and written in doc in "Byte locations are as follows (Byte number - skill):" section, but speels are not clear


Spells I believe are stored in bits where bit number is the index of the spell. So first byte contains spells 0 - 7, second byte 8 - 15, and so on.

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


Hired Hero
posted August 07, 2023 10:53 PM
Edited by relancer at 23:15, 07 Aug 2023.

Thanks a lot.

It was not easy, and will be harder to dynamically add the spell but I did that so we can view human_repr of spells the hero has.

Example map that is pushed to bitbucket, works fine and shows the following:

Quote:
...'skills_start_POS': 603, 'custom_skills': b'x04xffxffx04xffx04x04x04xffx02x02xffxffxffxffxffxffxffx02x02xffxffxffxffx04x04xffx04x04xffx04x04xffxffxffxff', 'custom_skills_human_repr': {'Tactics': 'GrandMaster(5)', 'Nobility': 'GrandMaster(5)', 'Order': 'GrandMaster(5)', 'Death': 'GrandMaster(5)', 'Chaos': 'GrandMaster(5)', 'Tactics.Offense': 'Expert(3)', 'Tactics.Defense': 'Expert(3)', 'Nobility.Estates': 'Expert(3)', 'Nobility.Mining': 'Expert(3)', 'Order.Enchantment': 'GrandMaster(5)', 'Order.Wizardry': 'GrandMaster(5)', 'Death.Occultism': 'GrandMaster(5)', 'Death.Demonology': 'GrandMaster(5)', 'Chaos.Conjuration': 'GrandMaster(5)', 'Chaos.Pyromancy': 'GrandMaster(5)'}, 'start_spells': 2, 'spells_start_POS': 640, 'spells_undecoded': b'tx01x00x00x00x00x00x08x00x00x00x00x00x00x00x00x00x00x00x00x00x00x81x00', 'spells_human_repr': [{'spell_name': 'Animate Dead', 'spell_id': 2}, {'spell_name': 'Armageddon', 'spell_id': 4}, {'spell_name': 'Banish', 'spell_id': 5}, {'spell_name': 'Berserk', 'spell_id': 6}, {'spell_name': 'Bind Wound', 'spell_id': 8}, {'spell_name': 'Retribution', 'spell_id': 59}, {'spell_name': 'Summon Water Elemental', 'spell_id': 176}, {'spell_name': 'Visions', 'spell_id': 183}],...


That data is true and if you add spell, save map and run a script, you will see it in this hero entry.
I might need to use spell settings and update code since i think i will be unable to insert the spell with level = 0. But might also I need to test spells "Ressurection" and "Terror" that are not available in vanila4 but sometimes hero can get them via scroll or something.

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


Hired Hero
posted August 08, 2023 09:33 PM
Edited by relancer at 21:51, 08 Aug 2023.

hi @iliveinabox05

I succeed in full armies detection, even succeeded in writing army objects (at least creature object, hero object need improvements)

I have other problem
I successfully create extracted ungzipped data (ButeBuffer in your case), but I feel some troubles in packing this object back to .H4c format, can you bring some light on it??? ( it seems back-compression work not as expected but it might  also be my fault)

I mean: I also have issues in saving back UNMODIFIED content. It looks to be tricky or what?

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


Honorable
Famous Hero
posted August 08, 2023 10:51 PM

relancer said:
hi @iliveinabox05

I succeed in full armies detection, even succeeded in writing army objects (at least creature object, hero object need improvements)

I have other problem
I successfully create extracted ungzipped data (ButeBuffer in your case), but I feel some troubles in packing this object back to .H4c format, can you bring some light on it??? ( it seems back-compression work not as expected but it might  also be my fault)

I mean: I also have issues in saving back UNMODIFIED content. It looks to be tricky or what?


You'll want to look in H4CampaignParser.java here and H4CampaignHeader.java. Each of the maps is gzipped and they go after the header.

All maps, whether single scenario or campaigns, have a campaign header. Single scenario headers are significantly shorter, which you'll see in this constructor for the campaign header parser here.

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


Hired Hero
posted August 08, 2023 11:18 PM
Edited by relancer at 23:22, 08 Aug 2023.

I'm ok there with extracting, I have issue with the opposite thing - packing it back, creating this gzipped objects from bytebyffer

for some reason it does not create same object from (that starts with gzip header) original ButeBuffer as well - might be non-code fault but I dont sure

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


Honorable
Famous Hero
posted August 08, 2023 11:27 PM

relancer said:
I'm ok there with extracting, I have issue with the opposite thing - packing it back, creating this gzipped objects from bytebyffer

for some reason it does not create same object from (that starts with gzip header) original ButeBuffer as well - might be non-code fault but I dont sure


I didn't point you to extracting, I pointed you to gzipping up the map files in H4CampaignParser.java. You also need to look at the campaign header to know what needs to go before any map files in the .h4c, which is why I pointed you to that constructor. Look at the logic and then look at the default values at the top of the class to know what you need to write for single scenarios.

If you are looking at a campaign (multiple maps) and not a single scenario, then you have the entire campaign header that needs to be filled out (or have the correct default values).

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


Hired Hero
posted August 08, 2023 11:51 PM
Edited by relancer at 23:56, 08 Aug 2023.

oh sorry that was my fault with a usage of python gzip library)
It was quite simple,
solved

only problem that I need to fix other there
might be not completely solved.

Now I need to fix fatal exception when opening modified content, original content works fine)))

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


Hired Hero
posted August 09, 2023 12:03 AM
Edited by relancer at 00:20, 09 Aug 2023.

@iliveinabox05

I partially succeed
I changed megadragon slots for 10 angels and you can see in the code

"syka_updated.h4c" file is an output, "syka.h4c" is an input

Unfortunately test loop is failing

when I tried to loop random data like:

"creature_id": random.randint(0, 73),
"amount": random.randint(1, 65500),
"artifacts": artifacts2,
"empty_slot": False,

, maybe there are some limitation, but I'm testing this, so it partially works, you can look

(python code uses only standard library, no packages required to be installed)

Might be a problem in my max amount - I can use any creature with amount 10 with no arts and will test artifacts.


Maximum count of creatures we can write is 32_767 = 2**15-1
Map won't crash on this amount.


So that's pretty nice!
in this example test scenario I got all the armies and mapped EVERY ARMY with a wild random (random creature, random amount, random artifact set)

I need to work on: hero skills, hero spells, hero artifact-set.
And I'll be able to create heroes in this manner.
THat's very fine for a future generator I described in readme
))))))))))))))))))))

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


Hired Hero
posted August 09, 2023 06:57 AM
Edited by relancer at 08:44, 09 Aug 2023.

I even played my first random gen, pretty nice

yes the scenario now is a wild random that does not count creature level, does not have heroes yet etc but you or someone can generate yourself a random army, put map to maps and try a battle.

I will clean a code a bit, will add heroes creation, will update scenario to be less full random and dependent - later

However I have doubts that's weapon type of artifact id = 196 is correct:

196: {'name': 'THROWING_SPEAR', 'art_type': 'WEAPONS'}

that was copied and adjusted from your artifacts list


I updated some example map and added auto-copy final map to maps folder (if this folder path written in settings in the top of the script exists) and here's some example screenshot(random is still wild) - https://cdn.discordapp.com/attachments/917849808767705150/1138723841380728852/image.png

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . 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.1105 seconds