Aller au contenu

Photo

Adding and removing effects with equipped items


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
Nebril2

Nebril2
  • Members
  • 59 messages

Hi all!!

 

 

 

Im trying to get a permanent  movement speed boost effect when boots are equipped. 

 

I did this using "OnPlayerEquipItem" module event.

 

 

if (GetResRef(oItem) == "boots")

    {
 
 
      ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectMovementSpeedIncrease(15), oPC);
 
    }

 

This works ok, but... when the player unequipes its boots, it wont loose the effect. 

 

So i tried using the "OnPlayerUnequipItem" to remove the effect but theres where im stuck! 

 

In general i would like to know how to make this, so an item equiped gives an effect only when equipped and when unequiped the effect goes. 

 

Thnak you :)



#2
meaglyn

meaglyn
  • Members
  • 812 messages

In general, this is done using the existing item properties. If the item is equippable you get the effect when equipped and lose it when you unequip I believe.   That would be the simple way... but there is no increase movement speed item property by default in the toolset. You can use haste but that is more than you want.

 

So you need walk through the effects on the PC when she un-equips the boots.  Take a look at the lexicon pages for GetFirstEffect and especially RemoveEffect. The latter has a nice example of what you are looking for.  This will remove any and all movement speed increase effects though so if that's an issue you may want to use a specific effect creator object to create the effect and then only remove those created by that object in the unequip event.



#3
Shadooow

Shadooow
  • Members
  • 4 471 messages

Read this and this.


  • meaglyn aime ceci

#4
Nebril2

Nebril2
  • Members
  • 59 messages

Ohhh this is awesome!

 

 

Assigning command to the item so it gets the creator of the effect and the using the remove effect on the effects created by the object unequipped worked!!

 

Thanks man, i have to read more it seems, the thing is that in english might be a little harder for me to understand. 

 

Thank you!!