I have this code in the module "on_activate". It turns the user of the item into "plot" on first use, and removes "plot" on the second use.
void main()
{
object oUsed = GetItemActivated();
// * Script for activation of item
if (GetTag(oUsed) == "item")
{
effect eVis = SupernaturalEffect(EffectVisualEffect(VFX_DUR_AURA_BLUE));
effect eEffect;
object oSelf = GetItemActivator();
object oTarget = GetItemActivatedTarget();
if (oSelf == oTarget)
{
if (GetPlotFlag(oSelf))
// * Unplot user and remove specific visual effect
{
SetPlotFlag(oSelf, FALSE);
eEffect = GetFirstEffect(oSelf);
while (GetIsEffectValid(eEffect))
{
if (eEffect == eVis){
RemoveEffect(oSelf, eEffect);
}
eEffect = GetNextEffect(oSelf);
}
}
else
// * Turn user into plot and apply visual effect
{
SetPlotFlag(oSelf, TRUE);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, oSelf);
}
}
}
}
The script has no problem applying the visual effect, but it fails to find the visual effect when trying to remove it. Does anyone know why?
Sorry for spamming the forum. I'm a pure noob at scripting.