Jump to content

Script: Dispel Potion


senterpat

Recommended Posts

Dispel works on magic effects as well, which are basically what all potions apply to the player. So in this case you need to use the magic effect associated with the potion and then call Dispel on it.

 

As a rough example of what I mean.. Say PotionA has a "GivePlayerMoreHealth" effect.

MagicEffect property GivePlayerMoreHealth auto
 
...Event or Function
 
GivePlayerMoreHealth.Dispel()
 
..EndEvent or EndFunction

Note that if the effects are instant, Dispel probably cant catch it.

Edited by Rasikko
Link to comment
Share on other sites

Thanks for the info, I have made a simple test script and cannot get it to compile, i get the error that dispel is not a function. Will it not work on an object reference?

Scriptname patUnequipCigaretteScript extends ObjectReference




MagicEffect Property patTobaccoCharimsa Auto


;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;Events
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Event OnUnequipped (Actor akActor)


if ( akActor == Game.GetPlayer() )
patTobaccoCharimsa.Dispel()
endIf
EndEvent
Link to comment
Share on other sites

My apologies. I should have first tested that. The reason it doesn't compile is because that version of Dispel() is not called on anything. It must be called as is, on an ActiveMagicEffect script as it is that magic effect that is to be dispelled. That is the say, from my end, I don't see a way to remove individual magic effects that don't originate from spells.

 

A different approach would be to prevent the usage of that specific potion all together and I don't know how to do that either.

Link to comment
Share on other sites

What I'm trying to accomplish is having a cigarette armor item they are smoking, that the player can put out, doing so should ideally, end the effect shortly after.

A different approach would be to prevent the usage of that specific potion all together and I don't know how to do that either.

 

I managed to do this by setting the initial potion to 0 duration with a hidden effect that equips a similar potion with duration if the conditions are met.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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