• 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.

Gold Kill Share

Status
Not open for further replies.
Level 2
Joined
Dec 25, 2023
Messages
6
Hello im newbie editor and i need some help. I wanna add to my map gold sharing function.
I want to to work like when u kill player 12 units , players 1-10 heroes get gold when they are near killed unit. So far i managed to create 2 triggers but those doesnt work. I would be really grateful for clear instruction how to create working gold sharing triggers because im not really all that familliar with editing and I want to learn.
 

Attachments

  • obraz_2023-12-25_165505410.png
    obraz_2023-12-25_165505410.png
    11.1 KB · Views: 23
  • obraz_2023-12-25_165518982.png
    obraz_2023-12-25_165518982.png
    11.3 KB · Views: 24
Last edited:
Level 2
Joined
Dec 25, 2023
Messages
6
It seems after removing or changing condition to owner of (killing unit) every player keep getting constanly gold even while not doing anything
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
First off: How To Post Your Trigger and Things That Leak (to explain what I'm calling a leak and why I'm dealing with it the way I am in my example triggers).

Second: well, yeah... because you have no condition to filter out specific players from the player group when awarding gold. Triggers aren't arcane magic. They do exactly what they say they will do and follow logic rigorously. So find things that say they'll do/apply how/when you want them to. Your initial post specifies giving gold for nearby players. I presume these players have heroes, and simply having a minion unit nearby the killed unit isn't sufficient to award gold. There are two ways you could go about doing this:
  • Have a group that contains players 1-10's heroes. When a unit is killed, check the distance between each of those heroes and the killed unit, awarding bounty to any player whose hero is close enough.
  • Check for heroes in a radius around the killed unit, and award bounty to any players whose heroes are found nearby.
  • Approach 1
    • Events
      • Unit - A unit owned by Player 11 (whatevercolorthatisidk) dies
      • -------- in your example trigger you're using player 9 here, not player 11, so maybe that's an error? it's unclear --------
    • Conditions
    • Actions
      • Set DeadPoint = (Position of (Triggering Unit))
      • Set Bounty = (Point-value of (Triggering Unit)) //this is NOT its gold bounty, to be clear; I believe you can get that directly now with new unit field natives, or you can use point value as a surrogate
      • Unit Group - Pick every unit in PLAYER_HEROES_GROUP and do (Actions) //This group will have to be set up on map init like you did with the player group in order to properly contain all the player heroes
        • Loop - Actions
          • Set TempPoint = (Position of (Picked Unit))
          • If (All conditions are true) then do (Then actions) else do (Else actions)
            • If - Conditions
              • (Distance between DeadPoint and TempPoint) less than or equal to GOLD_BOUNTY_RANGE
              • (Picked Unit is Dead) equal to False //maybe you do or don't want to do this
            • Then - Actions
              • Player - Add Bounty to (Owner of (Picked Unit)) Current Gold
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint) //cleans a point leak, change the text to match your variable name but keep the udg_ prefix
    • Custom script: call RemoveLocation(udg_DeadPoint) //same logic here
  • Approach 2
    • Events
      • Unit - A unit owned by Player 11 (whatevercolorthatisidk) dies
      • -------- in your example trigger you're using player 9 here, not player 11, so maybe that's an error? it's unclear --------
    • Conditions
    • Actions
      • Set DeadPoint = (Position of (Triggering Unit))
      • Set Bounty = (Point-value of (Triggering Unit))
      • Custom script: set bj_wantDestroyGroup = true //pre-emptively cleans a group leak that is about to occur in the next line
      • Unit Group - Pick every unit in (Units within GOLD_BOUNTY_RANGE of DeadPoint) and do (Actions)
        • Loop - Actions
          • If (All conditions are true) then do (Then actions) else do (Else actions)
            • If - Conditions
              • (Player number of (Owner of (Picked Unit))) less than or equal to 10 //could also use a "belongs to an ally/enemy of..." check here instead
              • (Picked Unit is A Hero) equal to True //Again, maybe you don't want to use these conditions
              • (Picked Unit is Dead) equal to False //they may allow or prevent units from 'counting' to award bounty to
            • Then - Actions
              • Player Group - Add (Owner of (Picked Unit)) to GOLD_BOUNTY_PLAYERS //this is to prevent duplicate gold bounty being awarded to players who have multiple heroes near the dying unit
            • Else - Actions
      • Player Group - Pick every player in GOLD_BOUNTY_PLAYERS and do (Actions)
        • Loop - Actions
          • Player - Add Bounty to (Picked Player) Current Gold
      • Player Group - Remove all players from GOLD_BOUNTY_PLAYERS
      • Custom script: call RemoveLocation(udg_DeadPoint)
Your first reply, however, implies that you want to enable gaining gold bounty by interacting with the unit before it dies in some way. This is much harder to determine and will take a significant amount of effort to achieve. What exactly counts as 'assisting' with its death? Just dealing damage? What about a debuff that deals no damage? What about auras or buffs applied to other players? Etc.

Finally, the way you set up the player group in your second trigger is repetetive. It adds the same 8 players to the player group five times in a row. That won't do anything because player groups can't have duplicate player entries, and while it won't make a noticeable impact on performance or load time it is simply bad practice.
 
Level 2
Joined
Dec 25, 2023
Messages
6
Thanks for a detailed reply !. To add some context to my map its variaton of legendary gladiators which is 10 players pick a hero and and fight against waves of enemies sent by player 12 . Would it be possible to show me in test map how is it done because i have hard time implemennting this triggers u spoke off. In actions DeadPoint and Bounty are added variables?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Thanks for a detailed reply !. To add some context to my map its variaton of legendary gladiators which is 10 players pick a hero and and fight against waves of enemies sent by player 12 . Would it be possible to show me in test map how is it done because i have hard time implemennting this triggers u spoke off. In actions DeadPoint and Bounty are added variables?
Yes, those two are variables you would create yourself.
set.gif
<-- You'll only ever see that icon when a Variable is being Set.

I attached a map using Pyro's first approach - although I altered it slightly. It relies on multiple Unit Groups to track the Heroes and also shows how you can easily track each Player's Hero using the Player-Indexing technique.

My map assumes that your Hero Selection system relies on a Tavern-like building which Sells the heroes. You will have to adjust the Player Picks A Hero trigger if you use a different hero selection system. For example, maybe you rely on the old school method of using a Wisp / Circle of Power / Regions for each Hero. In that case, my Player Picks A Hero trigger won't do anything, so you'd have to copy it's Actions over to your trigger(s) and make them work for your system. It wouldn't be anything too complicated, you would simply change the Event Responses like (Sold unit) to the Hero you just picked.
 

Attachments

  • Bounty Sharing.w3m
    19.3 KB · Views: 7
Last edited:
Level 2
Joined
Dec 25, 2023
Messages
6
Yes, those two are variables you would create yourself.
set.gif
<-- You'll only ever see that icon when a Variable is being Set.

I attached a map using Pyro's first approach - although I altered it slightly. It relies on multiple Unit Groups to track the Heroes and also shows how you can easily track each Player's Hero using the Player-Indexing technique.

My map assumes that your Hero Selection system relies on a Tavern-like building which Sells the heroes. You will have to adjust the Player Picks A Hero trigger if you use a different hero selection system. For example, maybe you rely on the old school method of using a Wisp / Circle of Power / Regions for each Hero. In that case, my Player Picks A Hero trigger won't do anything, so you'd have to copy it's Actions over to your trigger(s) and make them work for your system. It wouldn't be anything too complicated, you would simply change the Event Responses like (Sold unit) to the Hero you just picked.
Hello, thanks for the reply and sorry for late reply but i had problem with restoring my password to the forum. 😅 So my hero system is using unit to get into circle to obtain a hero . After lvl 15 hero can rank up to better version up to rank 3. Do i need to make event for each new hero? Im linking screenshot from my hero selection in map.
 

Attachments

  • obraz_2024-01-05_182149631.png
    obraz_2024-01-05_182149631.png
    1.4 MB · Views: 12

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Hello, thanks for the reply and sorry for late reply but i had problem with restoring my password to the forum. 😅 So my hero system is using unit to get into circle to obtain a hero . After lvl 15 hero can rank up to better version up to rank 3. Do i need to make event for each new hero? Im linking screenshot from my hero selection in map.
I updated the map to work better with your hero selection system. All you have to do is add this to your Hero System triggers:
  • Set Variable Picked_Hero = The hero you just created for the player
  • Trigger - Run Player Picks A Hero <gen>
So you simply track the newly created Hero using the Picked_Hero variable and then run my trigger.

To answer your question, when you rank up to a better hero I assume you get an entirely new Unit. In that case, you will lose any references to the original unit and will need to make sure that you Remove the original unit from any Unit Groups it's currently in and Add the new hero to those Unit Groups instead. The same must be done for Unit variables like the Hero[] variable in my map. Note that the Hero[] variable is entirely optional, I just figured it would make your life easier.

Edit: Fixed a mistake in the map. Download again.
 

Attachments

  • Bounty Sharing 2.w3m
    19 KB · Views: 10
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
In that case, you will lose any references to the original unit and will need to make sure that you Remove the original unit from any Unit Groups it's currently in and Add the new hero to those Unit Groups instead. The same must be done for Unit variables like the Hero[] variable in my map.
I shill this way too much but reverse bear form morph won’t break unit references. And you’d just need 1 ability per hero.
 
Level 2
Joined
Dec 25, 2023
Messages
6
I updated the map to work better with your hero selection system. All you have to do is add this to your Hero System triggers:
  • Set Variable Picked_Hero = The hero you just created for the player
  • Trigger - Run Player Picks A Hero <gen>
So you simply track the newly created Hero using the Picked_Hero variable and then run my trigger.

To answer your question, when you rank up to a better hero I assume you get an entirely new Unit. In that case, you will lose any references to the original unit and will need to make sure that you Remove the original unit from any Unit Groups it's currently in and Add the new hero to those Unit Groups instead. The same must be done for Unit variables like the Hero[] variable in my map. Note that the Hero[] variable is entirely optional, I just figured it would make your life easier.

Edit: Fixed a mistake in the map. Download again.
Hello after some tries and your help I managed to make it working half of the time by adding that trigger and putting it for every hero rank up. Unfortunately it sometimes stop working if hero ranks up and I'm not sure what to change now.
 

Attachments

  • obraz_2024-01-11_132311714.png
    obraz_2024-01-11_132311714.png
    30.4 KB · Views: 6
  • obraz_2024-01-11_132425526.png
    obraz_2024-01-11_132425526.png
    61.5 KB · Views: 6

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
On second thought, I would suggest an even easier solution. You can make one trigger that automatically detects new heroes:
  • Hero Pick Automatic
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Triggering unit) is an illusion) Equal to False
      • ((Owner of (Triggering unit)) controller) Equal to User
    • Actions
      • Set VariableSet Hero_Setup = (Triggering unit)
      • Trigger - Run Hero Setup <gen> (checking conditions)
Now whenever a Hero enters the map it'll automatically update everything. You can add more Conditions as needed.

So you can get rid of that Final trigger and the stuff you added at the bottom of your Upgrade trigger.

I attached a map with everything updated to use this new design, you can copy the folder Bounty Sharing and paste it into your map. Just make sure to delete your existing Bounty Sharing folder before doing so!
 

Attachments

  • Bounty Sharing 3.w3m
    20.4 KB · Views: 11
Last edited:
Level 2
Joined
Dec 25, 2023
Messages
6
On second thought, I would suggest an even easier solution. You can make one trigger that automatically detects new heroes:
  • Hero Pick Automatic
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Triggering unit) is an illusion) Equal to False
      • ((Owner of (Triggering unit)) controller) Equal to User
    • Actions
      • Set VariableSet Hero_Setup = (Triggering unit)
      • Trigger - Run Hero Setup <gen> (checking conditions)
Now whenever a Hero enters the map it'll automatically update everything. You can add more Conditions as needed.

So you can get rid of that Final trigger and the stuff you added at the bottom of your Upgrade trigger.

I attached a map with everything updated to use this new design, you can copy the folder Bounty Sharing and paste it into your map. Just make sure to delete your existing Bounty Sharing folder before doing so!
Just tested it with friend today and everything seems to work! Thanks a lot for the help! I wouldnt be able to do it myself with the amount of triggers and stuff you needed to take account into. It even works with double hero unit which i was suprised myself.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Just tested it with friend today and everything seems to work! Thanks a lot for the help! I wouldnt be able to do it myself with the amount of triggers and stuff you needed to take account into. It even works with double hero unit which i was suprised myself.
That's great to hear. I imagine the double hero will work with one exception being that your Hero[player number] variable will only reference the most recent of the two heroes that was created. I imagine you can work around it though.
 
Status
Not open for further replies.
Top