NPC compatible spells
Jump to navigation
Jump to search
Tools used in this tutorial
Required |
Tutorial: NPC compatible Spell EffectTimer
aaBlazesVarQuest is the non-running quest that stores the variables (replace with name of your Quest)
aaBlazesVarQuest.SpellCaster is the spell caster storage ref (SpellCaster is the ref var that retrievers the caster info)
SpellCaster can be replaced with another ref var to store caster of certain spell
aaBlazesVarQuest.EmptyRef is the blank ref variable that is used to reset the
aaBlazesVarQuest.SpellCaster ref
Stuff for on target script part:
float timestarted short success begin ScriptEffectUpdate if(aaBlazesVarQuest.SpellCaster!=aaBlazesVarQuest.EmptyRef&&success==0) ;After Caster info is sent initialyze ;do any ScriptEffectStart things not already done (like retrieving caster info) ;Caster info can be sent by on self effect set timestarted to ScriptEffectElapsedSeconds set success to 1 endif if(success) ;Place code here to run after all info sent if((ScriptEffectElapsedSeconds-timestarted)>=3); 3 is the maximum amount to run effect(replace 3 with time you wish effect to last) ;place stuff to run after the effects over set aaBlazesVarQuest.SpellCaster to aaBlazesVarQuest.EmptyRef set success to 2 endif endif endif
Stuff for on self script (Script for retrieving caster info):
; sends caster variable ref self short done begin ScriptEffectStart set self to getself set done to 0 end begin ScriptEffectUpdate if(aaBlazesVarQuest.SpellCaster==aaBlazesVarQuest.EmptyRef&&done!=1) set aaBlazesVarQuest.SpellCaster to self set done to 1 endif end
Sample Quest script(don't need to run quest at start-only for storage)
scn aaBlazesVarQuestscriptsample ref EmptyRef ref SpellCaster ref TeleportCaster ref SwapCaster
Here is a non-timed NCP swap spell:
On target script of:
scn aaBlazesSwapPositionScript ; Caster switches position with target (This is NCP compatible) ref self ref caster short success float selfx float selfy float selfz float casterx float castery float casterz begin ScriptEffectStart set self to getself set success to 0 end begin ScriptEffectUpdate if(aaBlazesVarQuest.SwapCaster!=aaBlazesVarQuest.EmptyRef&&success!=1) set caster to aaBlazesVarQuest.SwapCaster set selfx to self.getpos x set selfy to self.getpos y set selfz to self.getpos z set casterx to caster.getpos x set castery to caster.getpos y set casterz to caster.getpos z self.setpos x casterx self.setpos y castery self.setpos z casterz caster.setpos x selfx caster.setpos y selfy caster.setpos z selfz set aaBlazesVarQuest.SwapCaster to aaBlazesVarQuest.EmptyRef set success to 1 endif end
On self script of:
scn aaBlazesSwapSendVarscript ; sends caster variable ref self short done begin ScriptEffectStart set self to getself set done to 0 end begin ScriptEffectUpdate if(aaBlazesVarQuest.SwapCaster==aaBlazesVarQuest.EmptyRef&&done!=1) set aaBlazesVarQuest.SwapCaster to self set done to 1 endif end