• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Solved] Formula help again.

Level 17
Joined
Jun 2, 2009
Messages
1,141
I was thinking it would be easy but it is harder than expected. Difficult part is, taking back the %50 bonus.

Explanation if you want to know what exactly i want.
You have a 100 strength. You are buying this item and it makes your strength 150 + 50 (+50 base comes from trigger)
And if you drop this item, it should revert it and it works.
But it not works after i level up. My base strength increases from 150 to 160 but nothing happens when i drop the item.
Is someone can tell me how to do that properly?

  • StatArttir
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
    • Actions
      • Set StatSTR[(Player number of (Owner of (Triggering unit)))] = (Strength of (Triggering unit) (Exclude bonuses))
      • Hero - Modify Strength of (Triggering unit): Add ((50 x StatSTR[(Player number of (Owner of (Triggering unit)))]) / 100)
  • StatDus
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
    • Actions
      • Hero - Modify Strength of (Triggering unit): Subtract ((StatSTR[(Player number of (Owner of (Triggering unit)))] x 50) / 100)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
You need to track the amount of strength you added to the unit. This needs to be stored persistently so that when you drop the item you can look up that value and subtract the appropriate amount. This would be calculated when the item is picked up. When the player puts the item down after gaining a level then they would have the correct amount of stat removed from them, based on when they picked the item up, rather than their current stats.

If you want the item to support the player levelling up automatically then you need to effectively drop and pick up the item again after every level up, or other events that can cause the player's stats to change. For this purpose it might be a good idea to break the logic into its own functions or triggers that you run from the appropriate stat changing event and pass values to. This would allow you to simulate a drop and pickup to update the stat bonuses without physically manipulating the item.
 
Top