The simplest solution that comes to mind is setting a local int when the effect is applied, checking for it before applying effects, and deleting it at the time the effect expires:
#include "x2_inc_switches"
void main()
{
// Abort if we're not activating the item
if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE)
return;
int nType;
object oPC = GetItemActivator();
effect eLoop = GetFirstEffect(oPC);
while (GetIsEffectValid(eLoop))
{
nType = GetEffectType(eLoop);
if (nType == EFFECT_TYPE_BLINDNESS ||
nType == EFFECT_TYPE_CONFUSED ||
nType == EFFECT_TYPE_ABILITY_DECREASE)
RemoveEffect(eLoop);
eLoop = GetNextEffect(oPC);
}
if (!GetLocalInt(oPC, "WaterBottleBonus"))
{
eEffect = EffectSavingThrowIncrease(SAVING_THROW_FORT, 2);
eEffect = SupernaturalEffect(eEffect);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 400.0f);
SetLocalInt(oPC, "WaterBottleBonus", TRUE);
// Expire after 400 seconds
DelayCommand(400.0, DeleteLocalInt(oPC, "WaterBottleBonus"));
}
}
I also had some ideas about using GetEffectCreator(), but having multiple water bottles would defeat that.
Modifié par Squatting Monk, 11 août 2013 - 12:18 .