When a unit is being attacked, the trigger "attacking begins" runs, and will run "check for gold updates" trigger by setting boolred/blue to true.
Owner of attacking unit should be set to the player setting off the action, while owner of attacked unit should NOT equal to team mates, or yourself for that matter.
-
attacking begins
-

Events
-


Unit - A unit Is attacked
-

Conditions
-

Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Owner of (Attacking unit)) Equal to Player 1 (Red)
-




(Owner of (Attacked unit)) Not equal to Player 1 (Red)
-




(Owner of (Attacked unit)) Not equal to Player 2 (Blue)
-




(Owner of (Attacked unit)) Not equal to Player 3 (Teal)
-




(Owner of (Attacked unit)) Not equal to Player 4 (Purple)
-



Then - Actions
-




Set boolred = True
-




Trigger - Turn on check for gold updates red <gen>
-



Else - Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Owner of (Attacking unit)) Equal to Player 2 (Blue)
-




(Owner of (Attacked unit)) Not equal to Player 1 (Red)
-




(Owner of (Attacked unit)) Not equal to Player 2 (Blue)
-




(Owner of (Attacked unit)) Not equal to Player 3 (Teal)
-




(Owner of (Attacked unit)) Not equal to Player 4 (Purple)
-



Then - Actions
-




Set boolblue = True
-




Trigger - Turn on check for gold updates blue <gen>
-



Else - Actions
When a unit dies boolred will be set to off, so that "check for goldupdates" doesn't run for infinity.
"redgoldint 2" is calculated by red's current gold, after the kill, minus red's gold before the kill through the integer "redgoldint". You might want to make redgoldint, bluegoldint, tealgoldint and purpgoldint variables indo indexes. this way you'll have half as many variables. Like I did with tealgoldint & purpgoldint.
Now while we're waiting from the attack begins till a unit dies by an attack, there's a gap where gold given by allied, other triggers, selling or buying items etc, could eventually screw up the amount of gold passed to redgoldint2. Therefore the check for gold updates triggers are created.
-
unit dies
-

Events
-

Conditions
-

Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Owner of (Killing unit)) Equal to Player 1 (Red)
-




(Owner of (Dying unit)) Not equal to Player 1 (Red)
-




(Owner of (Dying unit)) Not equal to Player 2 (Blue)
-




(Owner of (Dying unit)) Not equal to Player 3 (Teal)
-




(Owner of (Dying unit)) Not equal to Player 4 (Purple)
-



Then - Actions
-




Set boolred = False
-




Set redgoldint2 = ((Player 1 (Red) Current gold) - redgoldint)
-




Set redgoldint = (Player 1 (Red) Current gold)
-




Player Group - Pick every player in (All players matching ((Color of (Picked player)) Not equal to Red)) and do (Player - Add redgoldint2 to (Picked player) Current gold)
-




Set bluegoldint = ((Player 2 (Blue) Current gold) + redgoldint2)
-




Set tealgoldint[1] = ((Player 3 (Teal) Current gold) + redgoldint2)
-




Set purpgoldint[1] = ((Player 4 (Purple) Current gold) + redgoldint2)
-



Else - Actions
While boolred/boolblue is true, we're waiting for the unit to die we're checking every 10 seconds for a gold change, and then updating the redgoldint/bluegoldint to the players current gold. When the current gold has changed, the trigger runs itself once more until a unit dies.
-
check for gold updates red
-

Events
-

Conditions
-

Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-



Then - Actions
-




Wait until (redgoldint Not equal to (Player 1 (Red) Current gold)), checking every 0.10 seconds
-




Set redgoldint = (Player 1 (Red) Current gold)
-




Trigger - Run (This trigger) (checking conditions)
-



Else - Actions
-
check for gold updates blue
-

Events
-

Conditions
-

Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-



Then - Actions
-




Wait until (bluegoldint Not equal to (Player 2 (Blue) Current gold)), checking every 0.10 seconds
-




Set bluegoldint = (Player 2 (Blue) Current gold)
-




Trigger - Run (This trigger) (checking conditions)
-



Else - Actions
This should work for you, then you don't need to manually randomize gold bounty of every unit in your desire.
EDIT:
red/blue/teal/purpgoldint are integer variables.
boolred/blue are boolean variables set to false by default.
Players could be added to a player could to shorten conditions.