So, my next mini project is, I think, going to be to create a special version of resist elements that will allow me to create wands and potions keyed to specific elements (since the radial menu doesn't allow this right now with items). Then, if that works, move on to protection from elements. So, my question is, looking at spell_enum.mes, is there any particular limitation on what range new spells can go into? Would just after 804 be fine, for example?
From what I've seen in the DLL, there's definitely some hard-coding going on in that regard. I've seen the spell number compared against 600, 700 and 729 so far, though I can't yet say what each range means exactly. I *think* the best practice would be below 729 since that's the number that appears in the "remove spell condition" section of the code, but then again it might have some other unintended consequences. I'm not aware of any thorough documentation on this aspect but then I haven't searched carefully.
So, first weird thing; I put a new Potion of Protection from Cold spell at index 744, as a first test, and it seemed to do nothing. I moved it to 599, and it's still not having the effect I want, but with a weird side effect: when it was at 744, when I used the potion, it let me target others. When I put it at 599, using the potion automatically targeted myself.
Just to communicate findings so far, I have two new spells at 744 and 745 that function perfectly well after extensive testing. That's not a guarantee that there is no problem about those cutoffs, and I will probably move them to a lower id just to be safe (there are still about two dozen openings at lower spots), but I thought it was worth trying.
Further testing hasn't revealed any problem with spells created at id 799 or below. Again, not a guarantee. Trying to use a spell at id 805 (the next available blank slot) results in CTD.
We were never able to get VP's spells (800-804) to work properly. I've been trying to get Tanglefoot bags working (yet again) and have to say, moving it from 782 to 597 didn't help
So, moving the Snowball Swarm spell from number 803 to number 799 changed it from causing a CTD to simply not having any effect. I'm not sure why it's not having any effect, but there definitely seems to be a hard line there.
So, I've got the snowball swarm spell working now, sort of. It was trying to use particle effects that aren't in temple.dll; specifically 'sp-Snowball Swarm-proj' and 'sp-Snowball Swarm-Hit'. By changing its particle effects to fireball, and moving it to spell id 799, it now works. It just visually looks like a fireball. Obviously, one doesn't want it to look like a fireball, but I'm stumped as to what those visual effects are referring to. Were there custom made ones at some point?
Got it looking pretty decent by borrowing graphics from ray of frost. I'll put it in the next version of my little mod.
One more update: the hard line for me seems to be exactly 801. Several custom spells work fine on 801, but cause CTD when at 802 or later. No idea why 801 is the last id that works, as opposed to 800 or 799, but there you have it.
I've found some corroboration for the 802 limit - there's at least one places where the game reads spell data into an int array of size... you guessed it... 802. Shouldn't be hard to lift that restriction though, it's just a matter of preallocating a bigger array. Does 5,000 sound good enough? (I'm going for 5000 because looking at spell_enum.mes the ranges seem to come in clumps of 5000)
Sorry to hijack, but could something similar be done with maps, which seem to be capped at 200 currently?
Yeah, you don't want to go over 5,000 for exactly that reason. That would be awesome if you could do it.
Actually, I wouldn't go over 4000. Index 4000-4023 in spell.mes are used for domain names. I think 4000 should be enough, though