|Thread: Research: Adding and Modifying creatures|
Modding the Unmoddable
posted April 02, 2017 06:30 PM
Research: Adding and Modifying creatures
Adding creatures will be a great breaktrough for the game in general.
This is theoretical as it hasn't been done yet.
(the adding creatures. The modifying is easy as my Lich mod shows.)
We know creature abilities are hardcoded.
Which creature has what abilities is defined in the .exe, and as such ability number for creatures is static, and there is no code for this over 4. Abilities are edited by hex editing, switching one for the other, using their hexadecimal (byte).
Equilibris added some extra abilities for already existing creatures (but still not over four) like Orcs and Earth Elementals;
In 3.51 they did this by hex editing with jumps, using otherwise unused parts of heroes 4 code, and filling them with such creature code.
After the abilities list, there is another hex code listed by the creature: This is their "reference number".
Reference numbers are used by the game internal code to know which creature is which for gameplay purposes.
The creature "keyword" name is mostly used for retrieving aesthetic assets: The creature's graphics and sounds, which much use this keyword to work (that is why "devils" are "Devils" ingame, but their files list them as "archdevils")
To add a new creature, the next ingredients have to be met:
- Adding the hex code with abilities and unique creature number. Next creature would be numbered 74 and be the 75th (the last one from official Heroes is numbered 73 - actually the 74th because they start at 00)
In hex, the "73" looks as "49" (megadragon), so our next creature will be 4A.
This part is tricky because space in the .exe is already limited and it cannot be expanded, except with the .dll by expert programmers. But using empty space, this should be possible. Creature data seems to be read in a linear manner by the game code, sequentially from first to last. There is also a "00" byte dividing creature codes, which may or may not be usable to compress the section.
- Adding the keyword to the .exe
This seems easy enough. Unlike the Hex codes for abilities and creature number, this is a simple list which is done in plain text.
Those "00" are definitely unused spaces, and they even vary between the creatures. It's not unreasonable to think more can be introduced.
- Putting creature in table.
You have to make a new line in the creature table and fill all data.
This includes using the keyword you introduced at the .exe
- Use that keyboard to name all the creature's resources. THis includes:
* Adventure map sprite
* Combat sprite
* Sounds for actions (walk, attack, spellcast, etc.)
- Creature dwellings use the number (NOT the keyword) to identify which creature they actually recruit. This is true for both map dwellings and castle dwellings.
- How does the keywork get related with the number?
That is to say: How does the game know that creature "25" links with the keyword "Medusa"? It does not fit the pattern in the screenshot.
This, to me, is still a mystery, which seems important to solve.
- Even if you include all these things, will the game supoort it, or is there something else we are not seeing?
CLICK on the image to discover H4 Greatest Mod!
posted April 20, 2017 08:26 AM
|Edited by Baronus at 08:27, 20 Apr 2017.
1. In txt tables game has number eg 25 in txt tables. And for creature 25 game read 25 data line.
2. In exe file is area for creature 25, with 25 id number, with abilities. Game read this and ad abilities to statiscis, name and defs, sounds from txt.
I think thats all.
To add creature you must:
1. Add line 4A in txt tables.
2. Add area in exe with 4A id and abilities.
If you want new look.
3. Add new defs.
4. Add new sounds.
5. Add new move sequence.
Thats all I think.