• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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 73
Joined
Aug 10, 2018
Messages
7,897
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