Rizalgar Posted December 30, 2018 Share Posted December 30, 2018 Is it possible to use a script that updates a global variable when a spell is cast? My attempts so far have proven futile, or it could be the way my Quest is setup to check for the spell, since I'm not even getting debug with the spell cast. Quest is set up as Start Game Enabled, no other changes.Does Run Once need to be checked? I need it to check everytime the spell is cast though so I'm not sure, I've heard different opinions on this.Here is the bit of script I am using to get the check, which again, I have not gotten working. (This is based off the Wikipedia for OnSpellCast, which I am most certain has to actually be attached to the spell, but I'm not sure of what other way to get the check) Event OnSpellCast(Form akSpell) Spell spellCast = akSpell as Spell If spellCast == AirStrike Debug.Notification("Broke") EndIf EndEvent Link to comment Share on other sites More sharing options...
Reneer Posted December 30, 2018 Share Posted December 30, 2018 OnSpellCast is placed on an ObjectReference, not a Quest. You would need to use a script on the Magic Effect itself and use something like OnEffectStart. Link to comment Share on other sites More sharing options...
Rizalgar Posted December 30, 2018 Author Share Posted December 30, 2018 (edited) Ah, I figured as much. I'm rewriting the whole thing using custom functions to see if I can maybe get a call that way. But probably not :laugh: Edit - One more question... Would it be possible then, to instead, have one script on multiple spells, that only casts the effects of the spell currently equipped? Edited December 30, 2018 by Rizalgar Link to comment Share on other sites More sharing options...
foamyesque Posted December 30, 2018 Share Posted December 30, 2018 Ah, I figured as much. I'm rewriting the whole thing using custom functions to see if I can maybe get a call that way. But probably not :laugh: Edit - One more question... Would it be possible then, to instead, have one script on multiple spells, that only casts the effects of the spell currently equipped? Could you explain a bit further? You can definitely put the same script on a bunch of spells to catch when they're cast, and it won't interfere with their ordinary effects, but it may not be the best way. Are you looking to track spells cast by a specific actor, such as the player? Link to comment Share on other sites More sharing options...
Rizalgar Posted December 30, 2018 Author Share Posted December 30, 2018 (edited) My bad. The spells themself have no defined effect, the effect is determined by the script. So I'm wondering if I can have multiple spell effects in a script, with each effect for a specific spell, but the specified effect only triggers when the proper spell is cast. So say I have 'Damage A' and 'Damage B' in a script. Then I have 'Spell A' and 'Spell B'. If I cast 'A' is it possible to have the script read that specific spell was cast, and only do the function for that spell, or would it trigger 'B' effect as well? This is for player specific spells. Edited December 30, 2018 by Rizalgar Link to comment Share on other sites More sharing options...
Rizalgar Posted December 31, 2018 Author Share Posted December 31, 2018 (edited) Hmm, I just had a thought. Maybe I could just create a 'framework' that contains all of the information, then just create a script for each spell that calls to said framework. That sounds plausible, yeah? It would save a tremendous amount of time over not setting properties 4+ times for each spell. Instead I could just make one script, set all the properties and spell effects, then have the spell script call from this script. Edited December 31, 2018 by Rizalgar Link to comment Share on other sites More sharing options...
Recommended Posts