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!
Can someone quickly create for me a trigger that gives "x" player "a" amount of gold "y" player receives from selling an item (so both players receive same amount of money).
I suppose you need to have a loop trigger to count the current gold of the player(s). Then once the item is sold you calculate the difference between the old gold and the current gold. Divide that by 2 and you get how much you should abstract from the selling player and how much you should add to the other player.
Okay I made a temporary solution by simply moving gold between the players. I would also like to see that floating text for both players when selling items. That can be hard to code.
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
gold Greater than or equal to (Player 1 (Red) Current gold)
Then - Actions
Set calc = (gold - (Player 1 (Red) Current gold))
Else - Actions
Set calc = ((Player 1 (Red) Current gold) - gold)
Set calc = (calc / 2)
Player - Add calc to Player 2 (Blue) Current gold
Player - Add (calc - (calc x 2)) to Player 1 (Red) Current gold
with floating text:
System
Events
Unit - A unit Pawns an item (to shop)
Conditions
Actions
Set gold = (Player 1 (Red) Current gold)
Wait 0.00 seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
gold Greater than or equal to (Player 1 (Red) Current gold)
Then - Actions
Set calc = (gold - (Player 1 (Red) Current gold))
Else - Actions
Set calc = ((Player 1 (Red) Current gold) - gold)
Set calc = (calc / 2)
Player - Add calc to Player 2 (Blue) Current gold
Player - Add (calc - (calc x 2)) to Player 1 (Red) Current gold
Custom script: if GetLocalPlayer() == Player(0) then
Floating Text - Create floating text that reads (+ + (String(calc))) at (Position of (Triggering unit)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
That system is imperfect. The player could earn gold from kills or mining which would also carry over during that time. They could also be mean and spend it on items, units or upgrades before the other player gets it. You will probably need a 0 second timer to prevent this from happening.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.