• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

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:
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.
Back
Top