• 🏆 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!

Shared Gold Bounty within range of unit

Status
Not open for further replies.
Level 3
Joined
Jan 5, 2008
Messages
26
How would I go about doing this? If a unit kills another unit, then the killing unit and all his allies WITHIN 900 of the killing unit will get a portion of the bounty. How do I detect the bounty given by a unit?
Also, I need to make sure that the units within 900 of the killing unit are HEROES that are ALLIES of the killing unit. So if there's one allied hero near the killing unit, then it will split the bounty in 2. If there's two allies, it will split in 3, etc.

Thanks :)
 
Level 4
Joined
Mar 24, 2008
Messages
87
I think there's no way to share bounty itself.
Instead of this you can creat a trigger like this :
Event : An unit dies
Condition : whatever you want
Action : Pick every units within 900 of dying unit matching Player owner of matching unit is an ally of Owner of killing unit = True
-> Set VARIABLE (integers) = number of units in last created unit group
Pick every players in all players matching : matching player is an ally of owner of killing unit = True
-> Add XX/Variable to picked player's gold

As i'm only creating in GUI, i bet there are better way in JASS.
Of course you have to change some things in this trigger in order to avoid leaks, and a variable replacing XX, based on the dying unit.

Hope i helped you a little, tell me if i'm wrong.
 
Last edited:
Level 3
Joined
Jan 5, 2008
Messages
26
I think there's no way to share bounty itself.
Instead of this you can creat a trigger like this :
Event : An unit dies
Condition : whatever you want
Action : Pick every units within 900 of dying unit matching Player owner of matching unit is an ally of Owner of killing unit = True
-> Set VARIABLE (integers) = number of units in last created unit group
Pick every players in all players matching : matching player is an ally of owner of killing unit = True
-> Add XX/Variable to picked player's gold

As i'm only creating in GUI, i bet there are better way in JASS.
Of course you have to change some things in this trigger in order to avoid leaks, and a variable replacing XX, based on the dying unit.

Hope i helped you a little, tell me if i'm wrong.

This doesn't make sure that the allied units around you are heroes. Would assigning custom point-values to each unit work? And then use that to indicate how much bounty should be given?

Thanks anyways though.
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
this is what your going to need
  • Event
  • Map int
  • Condidtion
  • Actions
  • set unit[1] = footmen
  • set unit[2] = knight
  • ---and so on with your units---
  • set gold[1] = (how much gold you wana give for killing a footmen)
  • set gold[2] = (how much gold you wana give for killing a knight)
  • --and so on
  • Event
  • Unit - a unit dies
  • Condition
  • Action
  • For each (custom integer) from 1 to (the total units), do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • if dieing unit is = to unit[custom integer]
        • Then - Actions
        • Unit Group - pick every unit within x range matching mataching unit is a hero, mataching unit is a allie of killing unit
        • Player - add gold[custom integer]/number of unit in unit group) to owner of picked unit current gold
        • Else - Actions
this is somthing you will use for it the triggers are not 100% accuret to what they really say (its hand written)


hope this helps need any more help just ask
 
Level 3
Joined
Jan 5, 2008
Messages
26
this is what your going to need
  • Event
  • Map int
  • Condidtion
  • Actions
  • set unit[1] = footmen
  • set unit[2] = knight
  • ---and so on with your units---
  • set gold[1] = (how much gold you wana give for killing a footmen)
  • set gold[2] = (how much gold you wana give for killing a knight)
  • --and so on
  • Event
  • Unit - a unit dies
  • Condition
  • Action
  • For each (custom integer) from 1 to (the total units), do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • if dieing unit is = to unit[custom integer]
        • Then - Actions
        • Unit Group - pick every unit within x range matching mataching unit is a hero, mataching unit is a allie of killing unit
        • Player - add gold[custom integer]/number of unit in unit group) to owner of picked unit current gold
        • Else - Actions
this is somthing you will use for it the triggers are not 100% accuret to what they really say (its hand written)


hope this helps need any more help just ask

THANKS A LOT!! IT WORKS :D
Sorry it took a while to respond though. I didn't really have time to try it til now.
Anyways, here's my trigger

  • Bounty Amounts
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ---------------------------- --------
      • Set UnitTypeForBounty[1] = Arachnathid
      • Set UnitBounty[1] = 4
      • -------- ---------------------------- --------
      • Set UnitTypeForBounty[2] = Magnataur
      • Set UnitBounty[2] = 6
      • -------- ---------------------------- --------
  • Share bounty
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer UnitBountyLoopInteger) from 1 to 2, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Dying unit)) Equal to UnitTypeForBounty[UnitBountyLoopInteger]
            • Then - Actions
              • Set TempUnleakerLoc = (Position of (Dying unit))
              • Set UnitBountyGroup = (Units within 900.00 of TempUnleakerLoc matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an ally of (Owner of (Killing unit))) Equal to True)))
              • Unit Group - Pick every unit in UnitBountyGroup and do (Actions)
                • Loop - Actions
                  • Player - Add (UnitBounty[UnitBountyLoopInteger] / (Number of units in UnitBountyGroup)) to (Owner of (Picked unit)) Current gold
                  • Floating Text - Create floating text that reads (+ + (String(UnitBounty[UnitBountyLoopInteger]))) above (Dying unit) with Z offset 10.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the fading age of (Last created floating text) to 1.50 seconds
                  • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
                  • -------- ---------------------------- --------
                  • Custom script: call RemoveLocation (udg_TempUnleakerLoc)
                  • Custom script: call DestroyGroup(udg_UnitBountyGroup)
            • Else - Actions
 
Level 8
Joined
Oct 31, 2010
Messages
238
  • Share bounty
    • ...
    • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
    • Floating Text - Change (Last created floating text): Disable permanence
    • Floating Text - Change the fading age of (Last created floating text) to 1.50 seconds
    • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
    • ...

The part I see something wrong (maybe not) is the floating text lifespan & fading age. Your trigger would cause it to look like it is gone suddenly, instead of fading away.
For it to fade, the lifespan must be higher than the fading age, and not the other way round. In this case, it should be:

  • Share bounty
    • ...
    • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
    • Floating Text - Change (Last created floating text): Disable permanence
    • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
    • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
    • ...
 
Status
Not open for further replies.
Top