• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

percentage gold loss after death

Status
Not open for further replies.
Level 7
Joined
May 30, 2018
Messages
290
Hello guys,

I need a trigger, which makes a player lose 40% of his current gold after his hero dies.

  • Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Not equal to Protector
    • Actions
      • Set VariableSet Real_Gold = (1 / 40)
      • Player - Add (((Owner of (Dying unit)) Current gold) - (((Owner of (Dying unit)) Current gold) x Real_Gold)) to (Owner of (Dying unit)).Current gold
Thats all I could come up with, Iam having a problem with the mathematic functions :s Maybe somebody could help out!

Thanks in advance :)
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
Edit:
  • Example
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set VariableSet TempReal = ((Real(((Triggering player) Current gold))) x 0.60)
      • Player - Set (Triggering player).Current gold to (Integer(TempReal))
So you convert the Player's gold to a Real and multiply it by 0.60.

Then set their gold to this amount.

You need to use Conversion - Convert Integer to Real in order to turn the Gold (Integer) to a Real.
 
Last edited:
Status
Not open for further replies.
Top