Editing
Hex Editing - Guide
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Creatures = == Editing HotA Creatures == While most statistics of base game creatures can be edited rather effortlessly (using MMArchive to unpack H3bitmap.lod or HotA_lng.lod), HotA creatures cannot be edited this way. Their data is stored at the beginning of HotA.dat. When using custom functions or editing original code, note that all HotA (as well as some SoD monsters) have reference ID above 80, and therefore cannot be checked for using a simple check command, such as 83 FA ID. Instead, you have to use a longer command that accepts a 4-byte value (for EDX that would be 81 FA ID000000). {| class="wikitable" |- ! colspan=99 | Hex String (Start: {{unk}}, End: {{unk}}) |- | colspan=99 | 08 000000 <span style="color:orange">"monst<ref_id>"</span> 17 000000 <span style="color:red">"Monsters\monster<ref_id>.str"</span> 09 000000 00000000 04 000000 <span style="color:orange">"name_abbreviation"</span> <span style="color:teal">KK</span>000000 <span style="color:teal">"<animation_filename>.def"</span> <span style="color:blue">L1</span>000000 <span style="color:blue">"Monster_name (singular)"</span> <span style="color:blue">L2</span>000000 <span style="color:blue">"Monster name (plural)"</span> 00000000 00000000 00000000 00000000 01 74 0000 <span style="color:orange">TT</span> 000000 <span style="color:green">UL</span> 000000 <span style="color:grey">0c556700 00556700</span> <span style="color:turquoise">F1 F2 F3 F4</span> <span style="color:red">80da9e03 60da9e03 30da9e03</span> <span style="color:gold">WC</span>000000 <span style="color:gold">MC</span>000000 <span style="color:gold">OC</span>000000 <span style="color:gold">SC</span>000000 <span style="color:gold">CC</span>000000 <span style="color:gold">GeC</span>000000 <span style="color:gold">GC</span>000000 <span style="color:green">FV</span>000000 <span style="color:green">AV</span>000000 <span style="color:green">GV</span>000000 <span style="color:green">HG</span>000000 <span style="color:green">HP</span>000000 <span style="color:green">SP</span>000000 <span style="color:green">AT</span>000000 <span style="color:green">DF</span>000000 <span style="color:green">DmgL</span>000000 <span style="color:green">DmgH</span>000000 <span style="color:green">SH</span>000000 <span style="color:green">SN</span>000000 <span style="color:red">OO</span>000000 <span style="color:purple">mm</span>000000 <span style="color:purple">MM</span>000000 <span style="color:red">RR</span>000000 <span style="color:red">VV</span>000000 <span style="color:red">WW</span>000000 <span style="color:red">XX</span>000000 <span style="color:red">YY</span>000000 <span style="color:red">ZZ</span>000000 |- ! colspan=99 | Description {{HEXrow|c=orange |monst<ref_id>| The monster's reference id in decimal, f.e. monst154}} {{HEXrow|c=red |Monsters\monster<ref_id>.str| {{unk}}}} {{HEXrow|c=orange |name_abbreviation| The 4 letter abbreviation of the monster name. Never appears anywhere ever again. Note that not all abbreviations are just beginning or consonants, f.e. Haspids are written as "aspi" and nix as "nixx". This abbreviation doesn't seem to have to be unique, as Sea Serpent and Haspids have the same 4 letters here. It is worth pointing out, that base game creatures also use 4-letter abbreviations in a similar table located in h3hota HD.exe around 0x275500}} {{HEXrow|c=teal |KK| The length of the animation_filename + 4 (and therefore the length of the entire "animation_filename.def"}} {{HEXrow|c=teal |<animation_filename>.def| The file name of the set of animations, saved as .def in HotA.lod or HotA.lod.}} {{HEXrow|c=blue |L1| The length of the monster name (singular)}} {{HEXrow|c=blue |Monster_name (singular)| Text string of the singular monster's name.}} {{HEXrow|c=blue |L2| The length of the monster name (plural)}} {{HEXrow|c=blue |Monster_name (plural)| Text string of the plural monster's name.}} {{HEXrow|c=orange |TT| The reference id of the town the monster belongs to. 0x09 for Cove, 0x0a for Factory, FFFFFFFF for Neutrals and I bet if HotA ever releases a new town, it will have 0x0b as its faction code.}} {{HEXrow|c=green |UL| The unit level -1 (sidenote: this is an example of numbers being used in a list with a zero-based numbering). FFFFFFFF for monsters with no level (f.e. Citadel / Castle Towers)}} {{HEXrow|c=grey |0c556700<br>(and 00556700)| These point to a similar table with creature sprite, text and other references in h3hota HD.exe and is probably used to insert the HotA.dat's creature table into this part of the exe.}} {{HEXrow|c=turquoise |F1| The first creature ability flag * 01: 2-hex unit * 02: Flying * 04: Ranged Attack * 08: Fire breath * 10: Living * 20: Can attack city walls (cyclops, cannon) * 40: War machine * 80: Slayer (Basic)}} {{HEXrow|c=turquoise |F2| The second creature ability flag * 01: Slayer (advanced) * 02: Slayer (expert) * 04: Mind immunity * 08: shoots beam (?) * 10: No melee penalty * 20: {{unk}} * 40: Fire immunity * 80: Attacks twice}} {{HEXrow|c=turquoise |F3| The third creature ability flag * 01: No enemy retaliation * 02: Morale has no effect * 04: Undead * 08: AOE melee attack (Hydra) * 10: AOE ranged attack (Magog), AI flag only. * 20: {{unk}} * 40: {{unk}} * 80: {{unk}}}} {{HEXrow|c=turquoise |F4| The fourth creature ability flag * 01: {{unk}} * 02: {{unk}} * 04: {{unk}} * 08: {{unk}} * 10: {{unk}} * 20: {{unk}} * 40: {{unk}} * 80: Dragon (for the sake of Mutare's specialty and vial of dragon blood)}} {{HEXrow|c=red |80da9e03<br>60da9e03<br>30da9e03|{{unk}}}} {{HEXrow|c=gold |WC| Wood Cost to recruit the creature}} {{HEXrow|c=gold |MC| Mercury Cost to recruit the creature}} {{HEXrow|c=gold |OC| Ore Cost to recruit the creature}} {{HEXrow|c=gold |SC| Sulfur Cost to recruit the creature}} {{HEXrow|c=gold |CC| Crystal Cost to recruit the creature}} {{HEXrow|c=gold |GeC|Gem Cost to recruit the creature}} {{HEXrow|c=gold |GC| Gold Cost to recruit the creature. Note that all aforementioned cost values have 4 bytes to play with, so the maximum unit cost is 2147483647 gold (or of any resource).}} {{HEXrow|c=green |FV| Fight Value}} {{HEXrow|c=green |AV| AI Value}} {{HEXrow|c=green |GV| Growth}} {{HEXrow|c=green |HG| Horde Growth}} {{HEXrow|c=green |HP| Hit Points}} {{HEXrow|c=green |SP| Speed}} {{HEXrow|c=green |AT| Attack}} {{HEXrow|c=green |DF| Defense}} {{HEXrow|c=green |DmgL| The low end of the damage range}} {{HEXrow|c=green |DmgH| The high end of the damage range}} {{HEXrow|c=green |SH| Number of shots per battle}} {{HEXrow|c=green |SN| Number of spell casts per battle}} {{HEXrow|c=red |OO| {{unk}}}} {{HEXrow|c=purple |mm| Minimum number of units when randomly spawned by the map generator}} {{HEXrow|c=purple |MM| Maximum number of units when randomly spawned by the map generator.}} {{HEXrow|c=red |RR<br>VV<br>WW<br>XX<br>YY<br>ZZ| {{unk}}. Sometimes they take up 28 (!) bytes (such as for Ayssids), and sometimes don't appear at all. I suspect they reference some sort of abilities the creatures have, or their descriptions.}} |} == Editing Creature Abilities == === Magic Channel ([[Familiars]]) === Magic channel's applicable unit ID is defined at 0x1a24f6. The game uses a frankly ridiculous method of dividing by 5 (let's just say that it purposefully calls and uses a value 1717986919 to calculate 20%). Btb2 analyzed it and found a way to alter the percentage to 50% or 100% (by ignoring the horrible function before it and simply taking the mana value or moving it by 1 byte). Replace: * 0x1A24B4 -> 8b 55 98 d1 ea (for 50%, since d1 ea is a single bitwise shift to the right * 0x1A24b4 -> 8b 55 98 90 90 (no division). Let's take a look at the function. The following offset reads: * 0x1A249F: b8 *67666666* c7 45 1c 02000000 f7 e9 8b 4d 9c *d1 fa* 8b c2 c1 e8 1f 03 d0 The b8 XXXXXXXX (bolded above) function calls a hexadecimal value (note that it's in Little Endian) and saves it. The code then uses "d1 fa" (emboldened above) to divide edx by 2 before it is further used. C1 E8 1F is simply a division by 2^31 of the value. Yes, that is why the rounding may be a bit off for Magic Channel. Now let's consider replacing: * 67666666 with our custom value (for now let's imagine it's 56555555) * d1 fa with 90 90 (two nop or non-coding functions, so we basically removed this part of the code) The result is... Division by 3. Now the Magic Channel grants 33% mana return. To obtain a different value, we need to replace XXXXXXXX with another number. This has to be (2^33 / D) +1, where D is our divisor (3 for 1/3, 5 for 1/5, etc.). The 2^33 is multiplied with the variable (mana cost), but is then divided by 2^31 and moves by two bits elsewhere to account for the differences. The number is greater than the quotient by 1, to avoid the rounding downwards removing 1 mana point incorrectly. Note, that XXXXXXXX cannot be equal to or greater than 00000080 (0x80000000), as then the value will be negative. The function also calls 0x1A2498 for the minimum mana value for which Magic Channel may apply. This is equal to the value of D (0x05 in base game, 0x03 in the example above). = Buildings = Building names and descriptions (excluding HotA) are saved in BldgSpec.txt and BldgNeut.txt. Building requirements can be altered by changing their dependency tables. Address of each dependency table is located at: * 0x0EB816 - Castle * 0x0EB8B3 - Rampart * 0x0EB971 - Tower * 0x0EBA39 - Inferno * 0x0EBA48 - Necropolis * 0x0EBA5C - Dungeon * 0x0EBA70 - Stronghold * 0x0EBA84 - Fortress * 0x0EBA98 - Conflux Note, that some building requirements are changed in HotA.dll. While it shouldn't be too difficult to determine their location in that file, (look for appropriate DWORDs in HotA.dll) for now these offsets are unknown. The requirement table for Cove and Factory may be coded differently and as far as I know, haven't been found yet. Building costs can be changed in Building.txt. == HotA buildings == Building names and descriptions for HotA are saved in HotA.dat and can be edited as a text edit using f.e. the aforementioned HotA Editor. Building costs for HotA are saved in HotA.dat. The building names appear before the building costs. Each building cost contains of 28 bytes, each 4 bytes representing a 4-byte little endian number of cost for each resource (Wood, Mercury, Ore, Sulfur, Crystal, Gems, Gold). Note, that some buildings have text and description, but no written cost (either replaced with 0s or simply not having any space devoted to them). An example is Mana Generator. For now it is not known how to edit the cost of these buildings (and therefore the cost of the Mana Generator remains a mystery). == Resource Silos == Resource Silo yield tables are located at 0x288F04. Each resource value is mentioned for each town, one by one, in 4-byte values (order of resources is Wood, Mercury, Ore, Sulphur, Crystal, Gems, Gold) with towns going in order. Cove's Resource Silo simply copies the one from the Dungeon, while Factory copies Rampart. The Resource Silo table is called for in exe a few times, but HotA.dll overwrites all (or most) of these calls at 0xd37ae and 0xd37ce. As of 12:19, 19 September 2024 (UTC), it is not known how to alter the Resource Silo values for Cove and Factory. No specific offset or function have been identified. {{unk}}.
Summary:
Please note that all contributions to Heroes 3 wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
English
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Purge
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information