Quite promising indeed, if I could get it to work correctly. As it is I am wondering if it actually means what I think it means…
Essentially what I am trying to do is have a spell that when cast at an NPC will put a script on them. I then want that script to start immediately and do its thing until they either die or whatever other script I mess around with removes it (but most likely when they die.)
So, I made this simple spell script to attempt to do just that:
scn phitestscript
ref ttarget ; the NPC
ref scriptid ; the script I'm putting on them
begin ScriptEffectStart
set ttarget to GetSelf
set scriptid to MyNPCScript ; set my script ID to a variable (?)
ttarget.SetScript scriptid
ttarget.RunScriptLine "%q%i%q" 1 ; this is supposed to start the script (?)
end
ref ttarget ; the NPC
ref scriptid ; the script I'm putting on them
begin ScriptEffectStart
set ttarget to GetSelf
set scriptid to MyNPCScript ; set my script ID to a variable (?)
ttarget.SetScript scriptid
ttarget.RunScriptLine "%q%i%q" 1 ; this is supposed to start the script (?)
end
The reason I set the script name to a variable like that is because according to the wiki page for this command, there is no variable type for scripts, so you have to pass the ID to the SetScript function that way. I don't know if I'm exactly doing it right however. I tried using the actual ID but it complained.
http://cs.elderscrolls.com/constwiki/index.php/SetScript
Anyway, it seems like the script either never gets added or never starts. I don't know if that RunScriptLine thing is right or the best way to force the script to start, but I put a basic "kill me if I'm alive" code in the script I added so I'd know immediately if it worked (because the NPC would keel over.)
Any ideas would be very much appreciated.