Oh, the hulking corpses axe IS a natural attack. Stupid. The animation shows it swinging an axe, but the combat windows reveal it it a bite/claw attack. Ok, that settles it, then. It's natural attacks that the potions make you invulnerable to.
obj_f_critter_monster_category is yet another non-32bit field (you bump into those a lot lately ). No current way of manipulating it that I know. And yeah, almost 12 years after release, you can still discover lots of new things... that's ToEE Modern disassembly tools (IDA) also make it a lot easier to dive into the DLL (which is what I'm doing now).
And testing shows that it's true for the protection from outsiders potion as well, for creatures (such as yeth hounds) that use natural attacks. While I have not tested every single monster, and have no plans to, I think that is sufficient for the purposes of filling in the long descriptions of the relevant potions. EDIT: Oh, and the duration difference is not hardcoded, I realized, but is rather found in the protos entries for the different potions. The potion of protection from outsiders, 8028 has: 'Potion of protection from outsiders (INTERNAL)' domain_special 3 whereas 8030 has: 'Potion of protection from elementals (INTERNAL)' domain_special 1 So, in practice, you could create items that had the same effect with varying time spans.
Those set the spell level, not the duration in minutes right? So a 3rd level spell would need a 5th level magic user to brew, so the duration comes out to 5 minutes at 1 min/level. That always confused me. :yikes:
Yes, I was looking to finish off my transformation / reincarnation / "choose to make yourself a different race in the shop map" script, and the last lingering part was to actually change the monster type and sub-type so the pc would actually BE the new type. But the checks on those are surprisingly nonexistent in the scripts. All the checks are on obj.is_category_type( mc_type_humanoid ), but the checks for subtype are never made like for for mc_subtype_goblinoid or mc_subtype_reptilian or mc_subtype_gnoll. And most of the others spells are checking if you are NOT an undead or demon or something. So as long as I only transform into humanoid, which I am for now, it should be ok to leave their subtype as mc_subtype_elf or mc_subtype_human without any notice. If I start changing into a giant or a spider than I would need to change that main type, since then spells like Charm Person would work on the Spider and such.
Since I've been fiddling with spells myself, I'll just throw this in: the spell.id seems to be a number that I'm guessing is assigned as you cast them, so if the first thing you ever cast is, say, sleep, the game assigns it as number 1, and probably then sets aside something to say "spell number 1 should finish in x rounds". I could be completely wrong about that but I've been working with that as a theory and it's been working for me (for scenarios where I assign spell effects directly to NPCs and not by casting spells first).
That actually makes a lot of sense, since spell.duration, spell.target_list, spell.caster, etc., all clearly refer to the specific instance of that casting, as opposed to the fundamental type of spell. The spell.id could still be serving as the parameter that determines the kind of creature you receive the bonus against in this case, though. Presuming there is some kind of index of active spells, spell.id would essentially be pointing to a block of information which includes the kind of spell that was cast, and this in turn could determine the exact effects of the 'sp-Protection from Monster' condition that these four spells have in common, in order to distinguish them. If that makes sense, and I'm not being dumb.
That's precisely right, the spell.id is a serial number that acts as a key for such a registry (10AAF218 PacketStruc SpellsCast_Packets). To determine the exact effect, the code then probably checks the spell Number which is the same number as spell_enum.mes. I've seen this in practice all over the place for various things (hence my holy hardcoded batman comment ). The relevant spell numbers would be: {714}{potion_of_protection_from_outsiders} {715}{potion_of_protection_from_elementals} {716}{potion_of_protection_from_earth} {717}{potion_of_protection_from_magic} {718}{potion_of_protection_from_undead} {719}{ring_of_animal_summoning_dog} {720}{potion_of_protection_from_acid} {721}{potion_of_protection_from_electricity}