share gold

Po0gles

New Member
Reaction score
0
hi in my map i want the heroes to share their money , means if you kill a unit , lets say it gives 80 gold . there are 4 heroes and i want everyone to get 20 . how do i do that ?
 

Xan_Kriegor

I can change this now in User CP.
Reaction score
12
Something like this should work:
Trigger:
  • Shared gold
    • Events
    • Unit - A unit Dies
    • Conditions
    • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
    • Set Point = (Position of (Dying unit))
    • Set ugTemp = (Units within 1000.00 of Point matching (((Owner of (Matching unit)) is an enemy of (Owner of (Dying unit))) Equal to True))
    • Unit Group - Pick every unit in ugTemp and do (Actions)
    • Loop - Actions
    • Player Group - Add (Owner of (Picked unit)) to pgTemp
    • Player Group - Pick every player in pgTemp and do (Actions)
    • Loop - Actions
    • Player - Add ((Level of (Dying unit)) / (Number of players in pgTemp)) to (Picked player) Current gold
    • Custom script: call RemoveLocation(udg_Point)
    • Custom script: call DestroyGroup(udg_ugTemp)
    • Custom script: call DestroyForce(udg_pgTemp)
It's not able to directly reference the bounty of the unit, so you'll have to find something else to control the gold given. In the example I used the unit's level, but you can also use food used by/provided, point value, custom value, or level of ability for unit. Also if you want to only give to players that have heroes in the area you'd need to put that in the unit group picking.

EDIT: Doing some actually maptesting, and it's being finicky. For one, the DestroyForce(udg_pgTemp) is just supposed to clean up leaks but is somehow making it only work once.
 

Po0gles

New Member
Reaction score
0
thanks for the effort , does that mean i mustnt use DestroyForce(udg_pgTemp) ? and can i somehow copy the trigger in my world editor? sorry i am not good at making maps i dont know how you created the udg_temp variable :(
 

dianamod27

Member
Reaction score
1
EDIT: Doing some actually maptesting, and it's being finicky. For one, the DestroyForce(udg_pgTemp) is just supposed to clean up leaks but is somehow making it only work once.
I have no idea why that happens either. I use a TempUnitGroup global for almost everything but I tried it with a different one once and nope. Please let me know if you find out what's up with that
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top