senterpat Posted October 17, 2018 Share Posted October 17, 2018 Is there a script equivalent of dispel that I can use for potions? Dispel only accepts spells, and unequip doesn't work either. Link to comment Share on other sites More sharing options...
Evangela Posted October 17, 2018 Share Posted October 17, 2018 (edited) 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 October 17, 2018 by Rasikko Link to comment Share on other sites More sharing options...
senterpat Posted October 18, 2018 Author Share Posted October 18, 2018 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 More sharing options...
Evangela Posted October 18, 2018 Share Posted October 18, 2018 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 More sharing options...
senterpat Posted October 18, 2018 Author Share Posted October 18, 2018 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 More sharing options...
Recommended Posts