The topic title is a little misconstrued.. as it should be "How to get a custom spell to work (in a script) ?", not how to create it, as that's a topic totally of it's own.
In scripts you can use the same exact usage of the normal spell casting, but instead of using the:
31 Spell(O:Target*,I:Spell*Spell)
You just use the:
31 SpellRES(S:RES*, O:Target*)
-action, with the RES meaning what ever you name the spell with... and it needs to be 7 letters or less, not 8.
95, 113 and 114 etc actions have their own RES version.
So if you spell file is "magmiss.spl" you just make the script to utilize that file, you take a script that has similar action...
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
HaveSpell(CLERIC_MAGIC_STONE) // SPPR106.SPL (Magical Stone)
HPGT(NearestEnemyOf(Myself),20)
THEN
RESPONSE #100
Spell(NearestEnemyOf(Myself),CLERIC_MAGIC_STONE) // SPPR106.SPL (Magical Stone)
END
For example, and edit it:
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
GLOBAL("firstspelltouse","LOCALS",0)
HPGT(NearestEnemyOf(Myself),20)
THEN
RESPONSE #100
SpellRES("magmiss",NearestEnemyOf(Myself)) // SPPR106.SPL (Magical Stone)
SetGlobal("firstspelltouse","LOCALS",1)
END
And yes, the global is there to watch out that the creature has the spell ... there might be better ways to do it, but this WILL definitely work, which is important.
Edited by The Imp, 29 June 2017 - 09:45 AM.
Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit).
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.