Jump to content

What Am I Doing Wrong With This Script?


Kyle8497

Recommended Posts

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 by Kyle8497
Link to comment
Share on other sites

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

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 by lofgren
Link to comment
Share on other sites

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 by lofgren
Link to comment
Share on other sites

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 by Kyle8497
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...