• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Shared Bounty, How to do it?

Status
Not open for further replies.
Level 2
Joined
Aug 28, 2020
Messages
15
Hello everyone, i'm doing an rpg map, and for balance reasons, i would like to add a shared bounty system, giving the possibility to the supports to also gain gold, i tried a trigger (The trigger is in the image) that seems to do not work, do you guys know a way to make it?

  • SharedGoldTrigger
    • Events
      • Unit - A unit owned by Player 22 (Snow) Dies
      • Unit - A unit owned by Player 24 (Peanut) Dies
    • Conditions
      • (Owner of (Killing unit)) Equal to (Owner of (Triggering unit))
    • Actions
      • Player Group - Pick every player in (All allies of (Owner of (Triggering unit)).) and do (Actions)
        • Loop - Actions
          • Player - Add (Point-value of (Dying unit)) to (Picked player).Current gold
 

Attachments

  • screen1bountyshared.png
    screen1bountyshared.png
    100.4 KB · Views: 47
  • screen2bountysystem.png
    screen2bountysystem.png
    120.5 KB · Views: 59
Last edited:
Level 2
Joined
Aug 28, 2020
Messages
15
Okay great, then i'm removing the secon trigger, but still i already tried the first trigger without the second and yet it doesn't work, do you know how to fix it?
 
Level 19
Joined
Feb 27, 2019
Messages
582
As Wrda said. Triggering unit is the unit that triggers the event. So in this trigger Triggering unit is the Dying unit.

So your condition is Owner of killing unit = Owner of dying unit

With this knowledge youll have to make some small changes to the trigger.

Edit: Also note that your player force leaks. To fix this you can make a temporary force and destroy it after use.
Set TempForce = All players in allies of owner of unit (killing unit)
Pick every player in TempForce and do actions
call DestroyForce(udg_TempForce)
 
Level 2
Joined
Aug 28, 2020
Messages
15
Okay i'm trying to figure out how to do it, but i have a few more questions:
  1. How do i create a Player force leaks? With a variable or did i have to create a new trigger?
  2. Why do i have to destroy the Player force? Isn't better to keep it?
  3. Sorry for bothering but i'm creating my first custom map and i'm still trying to figure out all the Editor feature
Here's the "New" Trigger, i hope that at least now i corrected
  • SharedGoldTrigger
    • Events
      • Unit - A unit owned by Player 22 (Snow) Dies
      • Unit - A unit owned by Player 24 (Peanut) Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to (Owner of (Triggering unit))
    • Actions
      • Player Group - Pick every player in (All allies of (Triggering player).) and do (Actions)
        • Loop - Actions
          • Player - Add (Point-value of (Dying unit)) to (Picked player).Current gold
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
1. Create a player group variable. Set it to "All allies of (Triggering player)", in this case.
2. To prevent leaks
3. It's kind of a lot of information at once, so yeah.
Then on the Player Group - Pick every player use the player group variable instead.
after the action, place an action named "custom script" and type call DestroyForce(udg_MyVar)
DON'T put inside the loop, but after it.
 
Level 2
Joined
Aug 28, 2020
Messages
15
Hey, thanks for the leaks tutorial!

Now the trigger it's like this and looks like that's working
  • SharedGoldTrigger
    • Events
      • Unit - A unit owned by Player 22 (Snow) Dies
      • Unit - A unit owned by Player 24 (Peanut) Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to (Owner of (Triggering unit))
    • Actions
      • Player Group - Pick every player in (All players) and do (Player Group - Add Player 1 (Red) to HeroGroup)
      • Player Group - Pick every player in (All players) and do (Player Group - Add Player 2 (Blue) to HeroGroup)
      • Player Group - Pick every player in (All players) and do (Player Group - Add Player 3 (Teal) to HeroGroup)
      • Player Group - Pick every player in (All players) and do (Player Group - Add Player 4 (Purple) to HeroGroup)
      • Player Group - Pick every player in (All players) and do (Player Group - Add Player 5 (Yellow) to HeroGroup)
      • Player Group - Pick every player in HeroGroup and do (Actions)
        • Loop - Actions
          • Player - Add (Point-value of (Dying unit)) to (Picked player).Current gold
What's shared as gold is the unit's Value, while i use the based bounty as a tiny reward for the kill (i approximetly give the 10% of more bounty of the Value (shared bounty))
 
Level 19
Joined
Feb 27, 2019
Messages
582
Since your HeroGroup is constant it does not leak. You can set it at the start of the game like so:
  • Start
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Player Group - Add (Player((Integer A))) to HeroForce
This next trigger will add gold to all players in the player group if the killing player is not player 22 or 24:
  • SharedGoldTrigger
    • Events
      • Unit - A unit owned by Player 22 (Snow) Dies
      • Unit - A unit owned by Player 24 (Peanut) Dies
    • Conditions
      • (Owner of (Killing unit)) Not equal to (Triggering player)
    • Actions
      • Player Group - Pick every player in HeroForce and do (Actions)
        • Loop - Actions
          • Player - Add (Point-value of (Triggering unit)) to (Picked player).Current gold
A couple of minor flaws is that it gives gold to the killing player and it gives the same amount of gold to the players regardless of how many players are playing. Do you want this to be the case?
 
Level 2
Joined
Aug 28, 2020
Messages
15
Oh thank you so much.
Yes i want this to be the case, i want to implement this system for helping the supports that doesn't take any kills or just a few, due that in the game you can buy useful equipment with gold.
I'm actually balancig the gold amount that one player can get zone by zone
 
Level 2
Joined
Aug 28, 2020
Messages
15
Okay, i'm here again, the script is working great, and i'm having fun to set all the different values to all the mobs, BUT i met another problem, looks like that every time that the clock hit the 4 pm or 4 am in game it adds 600 gold and then 800 every time, do you know how to fix this? i think that's linked to the score system of warcraft 3, or is it something else?
 
Level 19
Joined
Feb 27, 2019
Messages
582
It may be a problem with the trigger. I guess the condition is faulty. It may add gold even if there is no killing player. it may also give gold if Player 22 kills a unit of Player 24. Instead of "(Owner of (Killing unit)) not equal to (Triggering player)" you can do "(Owner of (Killing unit)) is in HeroForce equal to true" so that is a boolean condition that checks if the killing player is any of the players in the player group.

Another option could be to add another condition being a unit comparisson "Killing unit not equal to No unit" and replace the first condition with 2 new conditions being "Owner of (Killing unit)) not equal to (Player 22)" and "(Owner of (Killing unit)) not equal to (Player 24)".
 
Level 2
Joined
Aug 28, 2020
Messages
15
Sorry for the really late reply but i have been really busy irl and i didn't touched the custom map since then, now it's working, thanks to you a lot!
 
Status
Not open for further replies.
Top