after reading what you wrote i modified my tagbased
#include "x2_inc_switches"
void main()
{
object oPC = GetPCItemLastEquippedBy();
object oItem = GetPCItemLastEquipped();
int nEvent = GetUserDefinedItemEventNumber();
int nSpeed = 30;
if(GetLevelByclass(class_TYPE_MONK, oPC)>=6)// ._.
{
nSpeed-= 25;
}
if (nEvent == X2_ITEM_EVENT_EQUIP)
{
AssignCommand(oItem,ApplyEffectToObject(DURATION_TYPE_PERMANENT,
SupernaturalEffect(EffectMovementSpeedIncrease(nSpeed)), oPC));
return;
}
else if (nEvent == X2_ITEM_EVENT_UNEQUIP)
{
effect Effect = EffectMovementSpeedIncrease(nSpeed);
effect eEffect = GetFirstEffect(oPC);
while (GetIsEffectValid(eEffect))
{
if(GetEffectCreator(eEffect) == oItem)
{
if (GetEffectType(eEffect) == EFFECT_TYPE_MOVEMENT_SPEED_INCREASE)
{
RemoveEffect(oPC, eEffect);
eEffect = GetNextEffect(oPC);
}
}
}
}
}
I have not tested yet.
are still very confused about how to act,anyway i put this code On Lv UP
-cut-
object oPC = GetPCLevellingUp();
if (!GetIsPC(oPC)) return;
if(IsInConversation(oPC)== TRUE)return;
//object oPC = GetPCItemLastEquippedBy();
object oItem = GetPCItemLastEquipped();
-cut-
if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
{
SetUserDefinedItemEventNumber(X2_ITEM_EVENT_EQUIP);
object oBra = GetItemInSlot(INVENTORY_SLOT_ARMS, oPC);
//object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
//object oWeap = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
int nRet = ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
if(GetTag(oBra) == "1_brac_speed")
{
//effect eEffect = EffectMovementSpeedIncrease(30);
AssignCommand(oItem, ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectMovementSpeedIncrease(30)), oPC));
}
if (nRet == X2_EXECUTE_SCRIPT_END)
{
return;
}
}
in this way the effect remains.
But i'm not sure this is the right way to re-apply the effects.
The problem is that I am experiencing other errors
Modifié par Cursed_Eclipse, 15 mai 2012 - 06:05 .