Reduce Gold on Hero Death

Nyrano

New Member
Reaction score
4
Hi,

I just can't figure out how to fix this.
When an hero dies, the owner of that hero gets a 25% reduction of his current gold.

This is the trigger that puts the amount of gold immediately to 0, regardless of your current gold amount. Which is false...

The reason why I use 1/4 (as for 0.25 = 25%) is because I can't insert 0.25 into the value. My first thought was to do is set Current Gold x 0.75.
Trigger:
  • Gold Reduction
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Dying unit)) Not equal to Player 9 (Gray)
        • Then - Actions
          • Set GoldAmount = (((Owner of (Dying unit)) Current gold) x (1 / 4))
          • Player - Set (Owner of (Dying unit)) Current gold to (((Owner of (Dying unit)) Current gold) - GoldAmount)
          • Set PlayerGroup = (All players matching ((Owner of (Dying unit)) Equal to (Matching player)))
          • Game - Display to PlayerGroup for 8.00 seconds the text: (You lost |cffeac11e + ((String(GoldAmount)) + |r gold.))
          • Custom script: call DestroyForce(udg_PlayerGroup)
        • Else - Actions

Player 9 = The Enemy
GoldAmount (Variable) = Amount of gold that you lose.
 

Corleone

New Member
Reaction score
44
Perhaps you could try this:

Trigger:
  • Player - Set (Owner of (Triggering unit)) Current gold to (Integer((0.75 x (Real(((Owner of (Triggering unit)) Current gold))))))


I tested it and it works.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
Trigger:
  • Set GoldAmount = (((Owner of (Dying unit)) Current gold) x (1 / 4))


I believe 1/4 will always return 0 when you are working with integers. What you want will probably look something like this:

Trigger:
  • Set GoldAmount = Integer(Real((Owner of (Dying unit)) Current gold) * (0.25))
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top