Author Topic: Adding and removing effects with equipped items  (Read 367 times)

Legacy_Nebril2

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Adding and removing effects with equipped items
« on: November 19, 2014, 12:31:41 am »


               

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 '<img'>



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Adding and removing effects with equipped items
« Reply #1 on: November 19, 2014, 01:07:26 am »


               

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.


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Adding and removing effects with equipped items
« Reply #2 on: November 19, 2014, 08:30:24 am »


               

Read this and this.



               
               

               
            

Legacy_Nebril2

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Adding and removing effects with equipped items
« Reply #3 on: November 19, 2014, 02:49:27 pm »


               

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!!