Kyle8497 Posted June 6, 2014 Share Posted June 6, 2014 (edited) What I'm trying to do, script objective is in bold: Player gets burn effect applied on them by dragons breath > player jumps into local pool of water > activates a trigger box in the water that dispels the burn effect. Buuuuut it's not working for some reason: "Dispel is not a function or does not exist" Scriptname RidleyDispelFirePool extends ObjectReference ObjectReference Property DispelPool Auto MagicEffect Property Burn Auto Event OnTriggerEnter(ObjectReference DispelPool) Burn.Dispel() EndEvent Edited June 6, 2014 by Kyle8497 Link to comment Share on other sites More sharing options...
lofgren Posted June 6, 2014 Share Posted June 6, 2014 I believe dispel is a spell function, not a magic effect function. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 6, 2014 Share Posted June 6, 2014 Not sure if this will work. First thing I noticed was that you wanted it to happen for the player, but the script would have attempted to run with any actor. Second, the script only needs to continue processing if the actor actually has the effect in question. Third, Burn is defined as a MagicEffect whereas Dispel is on the ActiveMagicEffect script. So casting Burn as an ActiveMagicEffect might allow it to work. But this is just theory and should be taken with a grain of salt, I've never dealt with magic effects (active or otherwise). At worst, I would expect this to compile but not function... Scriptname RidleyDispelFirePool extends ObjectReference MagicEffect Property Burn Auto Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() If Game.GetPlayer().HasMagicEffect(Burn) (Burn as ActiveMagicEffect).Dispel() EndIf EndIf EndEvent Link to comment Share on other sites More sharing options...
lofgren Posted June 6, 2014 Share Posted June 6, 2014 (edited) I'm not sure you can cast magic effects as activemagiceffect. Honestly, I think the easiest way to do this is to create a spell with an empty magic effect with the keyword that you want to dispel, and then cast that on the actor. Like so: spell Property BurnDispel Auto Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() BurnDispel.Cast(akActionRef) EndIf EndEvent Edited June 6, 2014 by lofgren Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 6, 2014 Share Posted June 6, 2014 How do the shrines work? They "dispel" diseases and the like. Diseases are magic effects. Probably best to look towards them for guidance. Link to comment Share on other sites More sharing options...
lofgren Posted June 6, 2014 Share Posted June 6, 2014 (edited) Cure disease is a specific archetype, so that won't help. However, the shrines also remove all of the effects of other shrines. The spell that each shrine casts has the MagicBlessing keyword, and the "Dispel Effects with these Keywords" box checked. So basically exactly like I described above. If there is only a single spell that uses this effect, you could use this function on akActionREF: http://www.creationkit.com/DispelSpell_-_Actor If you want to dispel multiple spells that all use the same effect, then casting a dispelling spell is the way to go. Edited June 6, 2014 by lofgren Link to comment Share on other sites More sharing options...
Kyle8497 Posted June 6, 2014 Author Share Posted June 6, 2014 (edited) OK, I believe I've worked it out... I mixed the code between the both of your posts and came up with: EDIT: I just explained how I came across this code when originally typing this reply, but it got erased when I posted it, so I'm just going to summarize what I typed here: it works. I used a combination of the code you both provided. Thanks. Scriptname RidleyDispelFirePool extends ObjectReference Spell Property DispelPoolSpell Auto MagicEffect Property Burn Auto Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() If Game.GetPlayer().HasMagicEffect(Burn) DispelPoolSpell.Cast(akActionRef) EndIf EndIf EndEvent Edited June 6, 2014 by Kyle8497 Link to comment Share on other sites More sharing options...
lofgren Posted June 6, 2014 Share Posted June 6, 2014 It's not really necessary to check if the player has the effect, unless you want to be absolutely certain they don't get the dispel spell cast twice on them. Link to comment Share on other sites More sharing options...
Kyle8497 Posted June 6, 2014 Author Share Posted June 6, 2014 (edited) Well, I want it so the player can only be healed by the spell if they're burning. Edited June 6, 2014 by Kyle8497 Link to comment Share on other sites More sharing options...
lofgren Posted June 6, 2014 Share Posted June 6, 2014 ah, I did not realize it was a healing spell. Link to comment Share on other sites More sharing options...
Recommended Posts