As a French person I feel like it's my duty to explain strikes to you. - AdrienIer

Create an account  

 
MoM Modding: SPELLDAT.

Having developed an interest in modding masters of magic, I've been working on understanding the data file format. The eljay links were a good start, but I rapidly hit their limits, so I thought I'd share stuff I've found so far (other modders may know this stuff, but I don't see it). Starting from eljay's description, and also requires understanding save game format, further notes (some of this stuff is not tested in game, it's just by inspection):

Byte 0x15 is in fact a byte determining the type of the spell, and also controls the interpretation of bytes 0x20-0x23. Codes are as follows:
  • 0x00: normal summoning spell (all but hero/champion/torin). Byte 0x20 contains the creature summoned, 21-23 are blank.
  • 0x01: enchantment that can be cast on a friendly unit. Bytes 0x20-0x23 contain the mask for the enchantment applied (same as bytes 0x18-0x1B in the unit data structure in the save file). While no current spells do this, it is possible to set more than one bit; doing so will apply both spells, and will also prevent casting if either spell is already on the unit.
  • 0x02: enchantment hits a friendly city. Byte 0x20 contains the code for the city enchantment, in the same order as for city enchantments in the save file, but starts at 0 (0x00 is wall of fire, 0x18 is altar of battle).
  • 0x03: enchantment hits a hostile city. Byte 0x20 is the same as above.
  • 0x04: non-moddable damaging spell. Byte 0x20 is the magnitude, 0x21 is the immunity flags that apply (same as for monsters), 0x22 and 0x23 are attack flags (same as for monsters, but for byte 0x23, 0x80, listed as no effect for monsters, makes it act like warp lightning, and 0x10 makes it act like fireball. Neither flag seems to apply to critter attacks, though I haven't tried all possible combinations. Not all attack flags work for spells).
  • 0x05: unusual spells. I haven't been able to determine how they're parsed, and there are a lot of them.
  • 0x6: spells that target one wizard. 0x20 appears to be the effect (there are only four spells in this category: spell blast, cruel unminding, drain power, subversion).
  • 0x09: global enchantment. Byte 0x20 contains the code for the global enchantment, in the same order as for global enchantments in the save file, but starts at 0 (0x00 is eternal night, 0x17 is awareness).
  • 0x0a: combat globals (affect all units). Mostly, it's twice the number of the enchantment (if you want, you can add +1, and apply spells to the other side), but the instants (Call Chaos, Death Spell, Holy Word, Mass Healing, Flame Strike) would appear to be special case coded. If byte 0x21 is set, it seems to just make the spell not work in most cases (cloning flame strike does not work). Enchantment codes are:
    • 00: true light
    • 02: darkness
    • 04: warp reality
    • 06: black prayer
    • 08: wrack
    • 0a: metal fires
    • 0c: prayer
    • 0e: high prayer
    • 10: terror
    • 12: call lightning
    • 14: counter magic (which is a different bit; probably says moddable/not moddable)
    • 16: mass invisibility
    • 18: entangle
    • 1a: mana leak
    • 1c: blur
  • 0x0b: enchant item and create artifact.
  • 0x0c: spells that destroy a unit. Byte 0x21 looks like it may be a normal immunity byte, as it's 0x22 for petrify, 0x20 for disintegrate, but there's missing information here.
  • 0x0d: hostile (resisted) combat enchantments. Bytes 0x20-0x21 are a mask for what effect is created:
    • 0x0001: Warp Creature (Defense)
    • 0x0002: Warp Creature (Resistance)
    • 0x0004: Mind Twist, which is a status effect that uses the text for Mana Leak. The actual effect is apparently -1 to hit, -1 resistance (either won't reduce below 0, or the UI doesn't show negative attack modifiers).
    • 0x0008: Haste (yeah, it's not a negative effect). It looks like combat-only enchantments use a different set of bits.
    • 0x0010: Web. Applies the debuff, but either does nothing, or only removes flight (cannot determine on my test monster).
    • 0x0020: Creature Binding. Puts a counter on the unit, but doesn't actually change allegiance.
    • 0x0040: Possession. Puts a counter on the unit, but doesn't actually change allegiance.
    • 0x0080: No Apparent Effect
    • 0x0100: Vertigo
    • 0x0200: Confusion
    • 0x0400: Whirlwind (???) Puts a whirlwind counter on the unit, no apparent effect (may be related to magic vortex)
    • 0x0800: Mind Storm
    • 0x1000: Shatter
    • 0x2000: Weakness
    • 0x4000: Black Sleep
    • 0x8000: Warp Creature (-50% attack)
  • 0x0e: hostile (un-resisted) combat enchantments. Otherwise as 0x0d
  • 0x0f: friendly unit enchantment that only works on mundane units. Otherwise identical to 0x01.
  • 0x10: hostile (resisted) combat enchantments that only work on mundane units.
  • 0x12: dispel magic, dispel magic true. Max cost = base cost * 5.
  • 0x13: disenchant area, disenchant true. Max cost = base cost * 5.
  • 0x14: disjunction, disjunction true. Max cost = base cost * 5.
  • 0x15: counter magic. Max cost = base cost * 5. Functions otherwise like 0x0a, so it's likely that other area spells could be modded, though effects would likely be undefined.
  • 0x16: variable cost damage spells; max cost = base cost * 5. Otherwise identical to 0x04. The extra effect per extra mana spent is probably determined by the flags, it isn't coded here.
Reply

Interesting. thumbsup
Only the people crazy enough to think they can change the world of Arcanus and Myrror can do it. rolleye
Reply

thx for sharing.
dance!
Reply

Did some experimenting, found some more status bytes for resisted combat effects. It looks like there must be hardcoded stuff elsewhere, as no obvious bytes control visual effect (I was using black sleep as a test case, and its visual effects are easily recognized), nor other effects such as allegiance shift.
Reply

Added information about combat globals (updated original post).
Reply

In the incecticide, the 11-13 bytes become nonzero. Kyrub,what are they sign?
Reply

Anthony Wrote:Having developed an interest in modding masters of magic, I've been working on understanding the data file format.

Thanks! thumbsup

I'm incorporating the information you deduced into the tweaker.

Btw, I have one more spell category for you: 0x17 is Banish (only spell).
The variable damage spells (0x16) do a damage of: base spell strength + mana - cost.
--I like ILSe
Reply

I like Serena Wrote:The variable damage spells (0x16) do a damage of: base spell strength + mana - cost.
Ice bolt, fire bolt, and lightning bolt do that. Fireball does base + (mana-cost)/3, psionic blast does base + (mana-cost)/2. Life drain is also coded as a variable damage spell, at a resistance penalty of (mana-cost)/5, I haven't tested what byte 0x20 does (it might be a resistance mod, it might cause life drain to do damage as well as drain). On reflection, I'm not sure byte 0x23 has anything to do with byte 0x21 in the monster structure, as the only bytes I've seen set for it on combat spells have bits that are meaningless on creature attacks (0x10 is set for ice storm, fireball, fire storm, flame strike, call chaos, and apparently means 'hit all'; 0x80 is set for warp lightning and means 'repeat at successive -1s until reaches 0'. Both effects can be set for other spells). Interestingly, type 4 (and probably 16) can be used as an overland attack if byte 0x18 is 01 instead of FF, which makes me wonder about what happens if you set fireball to type 00 (fireball cities? Also, it might still do +1 damage per +3 mana, even though you could cast it for 75-375). Even better and more likely to trigger bugs, set lifedrain to overland, set its effect bytes to 00 60 08 10, and find out what happens when you kill an entire city overland with lifedrain.
Reply

Oh.
You're right.
Scratch that remark of me then.
(I just copied what I had in my notes.)
--I like ILSe
Reply

FYI, I've just uploaded a new Tweaker that includes your information in the spell table (first click Show tables, then select Spell data).

You can find the download here.
--I like ILSe
Reply



Forum Jump: