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

Aggro System v1.3

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
This is a small system that I have found a few people wanted. Some of my friends kept asking for a way to have neutral wandering creeps that stop walking around and become aggressive when their hero has contact with it.

This system works on player controlled unit, ownership changing. So for example If Player 1's unit comes within X range of a neutral passive unit, the neutral passive unit will change ownership to neutral hostile and be attack Player 1's unit. It also works in reverse with a Hostile > Neutral system.

The system supports:
- Passive > Aggressive (Also removes an ability such as Wander from the target)
- Aggressive > Passive
- Attacking/Casting targeted spell
- Right Clicking within range
- Unit moving within range


Credits would be nice :). Also you don't have to ask me if you can make changes to the triggers, go ahead. Just remember to credit me.


Triggers: Neutral > Hostile

  • Setting A
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Aggro Player = Your friendly players --------
      • Player Group - Add Player 1 (Red) to A_Aggro_Player
      • -------- Aggroing Player = Your neutral creeps that will turn aggressive. --------
      • Player Group - Add Neutral Passive to A_Aggroing_Player
      • -------- Hostile Player = The ownership of the neutral creep will change to this player. --------
      • Set A_Hostile_Player = Player 8 (Pink)
      • -------- Changing Ability = The ability that will be removed or added once the unit changes ownership. --------
      • Set Changing_Ability = Wander (Neutral)
      • -------- Effect Range = This is the range in which the unit will change ownership. --------
      • -------- Only copy this variable if you are using Click or Range system. --------
      • Set A_Effect_Range = 550.00
  • Attack Aggro
    • Events
      • Unit - A unit Is attacked
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to (Casting unit)
        • Then - Actions
          • -------- Set the variables --------
          • Set A_Temp_Attacked = (Target unit of ability being cast)
          • Set A_Temp_Attacking = (Casting unit)
          • -------- Checking if the triggering units match with the set players --------
        • Else - Actions
          • Set A_Temp_Attacking = (Attacking unit)
          • Set A_Temp_Attacked = (Attacked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of A_Temp_Attacked) is in A_Aggroing_Player) Equal to True
          • ((Owner of A_Temp_Attacking) is in A_Aggro_Player) Equal to True
        • Then - Actions
          • -------- If they do --------
          • Unit - Remove Changing_Ability from A_Temp_Attacked
          • -------- You can change the ownership by changing the A_Hostile_Player variable in the settings trigger. --------
          • Unit - Change ownership of A_Temp_Attacked to A_Hostile_Player and Change color
          • Unit - Order A_Temp_Attacked to Attack A_Temp_Attacking
          • Set A_Temp_Attacked = No unit
          • Set A_Temp_Attacking = No unit
        • Else - Actions
  • Clicking Aggro
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Target item of issued order) Not equal to No item
        • Then - Actions
        • Else - Actions
          • -------- Set the variables --------
          • Set A_Temp_Ordered_Unit = (Ordered unit)
          • Set A_Temp_Target_Unit = (Target unit of issued order)
          • Set Position_Unit = (Position of A_Temp_Ordered_Unit)
          • Set Position_TargetUnit = (Position of A_Temp_Target_Unit)
          • -------- Checking if the triggering units match with the set players --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of A_Temp_Ordered_Unit) is in A_Aggro_Player) Equal to True
              • ((Owner of A_Temp_Target_Unit) is in A_Aggroing_Player) Equal to True
            • Then - Actions
              • -------- Here I am adding in a certain range the targted creep has to be. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between Position_Unit and Position_TargetUnit) Less than or equal to A_Effect_Range
                • Then - Actions
                  • -------- If you want to range limit cut and paste the two unit actions below into the "Then" above this "If (All Conditions)" action. --------
                  • -------- If they are in range --------
                  • Unit - Remove Changing_Ability from A_Temp_Target_Unit
                  • -------- You can change the aggressive player by changing the A_Hostile_Player variable in the settings trigger. --------
                  • Unit - Change ownership of A_Temp_Target_Unit to A_Hostile_Player and Change color
                  • Set A_Temp_Ordered_Unit = No unit
                  • Set A_Temp_Target_Unit = No unit
                  • Set A_Range_Aggro = No unit
                • Else - Actions
                  • Set A_Temp_Ordered_Unit = No unit
                  • Set A_Temp_Target_Unit = No unit
                  • Set A_Range_Aggro = No unit
            • Else - Actions
              • Set A_Temp_Ordered_Unit = No unit
              • Set A_Temp_Target_Unit = No unit
              • Set A_Range_Aggro = No unit
      • Custom script: call RemoveLocation (udg_Position_Unit)
      • Custom script: call RemoveLocation (udg_Position_TargetUnit)
      • Custom script: call DestroyGroup(udg_A_TempGroup)
  • Range Aggro
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- Leave these triggers --------
      • -------- Set the varibles --------
      • Set A_TempGroup = (Units owned by (Random player from A_Aggro_Player))
      • Set A_Player_Unit = (Random unit from A_TempGroup)
      • Set Position_Unit = (Position of A_Player_Unit)
      • Custom script: call DestroyGroup(udg_A_TempGroup)
      • Set A_TempGroup = (Units within A_Effect_Range of Position_Unit matching ((Owner of (Matching unit)) Equal to (Random player from A_Aggroing_Player)))
      • Set A_Range_Aggro = (Random unit from A_TempGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of A_Range_Aggro) is in A_Aggroing_Player) Equal to True
        • Then - Actions
          • -------- If the unit is invisible to the neutral creep it will not change ownership. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (A_Player_Unit is invisible to A_Neutral_Player) Equal to True
            • Then - Actions
              • -------- If you want your unit to make the neutral creeps turn hostile while it is invisible, cut and past the three unit actions fron "Else" to the "Then" section here. --------
            • Else - Actions
              • -------- If the unit isn't invisible. --------
              • Unit - Remove Changing_Ability from A_Range_Aggro
              • -------- You can change the ownership by changing the A_Hostile_Player variable in the settings trigger. --------
              • Unit - Change ownership of A_Range_Aggro to A_Hostile_Player and Change color
              • Unit - Order A_Range_Aggro to Attack A_Player_Unit
        • Else - Actions
      • Custom script: call RemoveLocation (udg_Position_Unit)
      • Custom script: call DestroyGroup(udg_A_TempGroup)
Triggers: Neutral > Hostile


  • Setting N
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Trigger Player = You and your allies. --------
      • Player Group - Add Player 1 (Red) to N_Triggering_Player
      • -------- Hostile Player = Your agressive creeps that will turn neutral. --------
      • Player Group - Add Player 8 (Pink) to N_Hostile_Player
      • -------- Neutral Player = The ownership of the hostile creep will change to this player. --------
      • Set A_Neutral_Player = Neutral Passive
      • -------- Changing Ability = The ability that will be removed or added once the unit changes ownership. --------
      • Set Changing_Ability = Wander (Neutral)
      • -------- Effect Range = This is the range in which the unit will change ownership. --------
      • -------- Only copy this variable if you are using Click or Range system. --------
      • Set A_Effect_Range = 450.00
  • Attack Neutral
    • Events
      • Unit - A unit Is attacked
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to (Casting unit)
        • Then - Actions
          • -------- Set the variables --------
          • Set A_Temp_Attacked = (Target unit of ability being cast)
          • Set A_Temp_Attacking = (Casting unit)
          • -------- Checking if the triggering units match with the set players --------
        • Else - Actions
          • Set A_Temp_Attacking = (Attacking unit)
          • Set A_Temp_Attacked = (Attacked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of A_Temp_Attacked) is in N_Hostile_Player) Equal to True
          • ((Owner of A_Temp_Attacking) is in N_Triggering_Player) Equal to True
        • Then - Actions
          • -------- If they do --------
          • Unit - Add Changing_Ability to A_Temp_Attacked
          • -------- You can change the ownership by changing the A_Neutral_Player variable in the settings trigger. --------
          • Unit - Change ownership of A_Temp_Attacked to A_Neutral_Player and Change color
          • Set A_Temp_Attacked = No unit
          • Set A_Temp_Attacking = No unit
        • Else - Actions
  • Clicking Neutral
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Target item of issued order) Not equal to No item
        • Then - Actions
        • Else - Actions
          • -------- Set the varibles --------
          • Set A_Temp_Ordered_Unit = (Ordered unit)
          • Set A_Temp_Target_Unit = (Target unit of issued order)
          • Set Position_Unit = (Position of A_Temp_Ordered_Unit)
          • Set Position_TargetUnit = (Position of A_Temp_Target_Unit)
          • -------- Checking if the triggering units match with the set players --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of A_Temp_Ordered_Unit) is in N_Triggering_Player) Equal to True
              • ((Owner of A_Temp_Target_Unit) is in N_Hostile_Player) Equal to True
            • Then - Actions
              • -------- Here I am adding in a certain range the targted creep has to be. --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between Position_Unit and Position_TargetUnit) Less than or equal to A_Effect_Range
                • Then - Actions
                  • -------- If you want to range limit cut and paste the two unit actions below into the "Then" above this "If (All Conditions)" action. --------
                  • -------- If they are in range --------
                  • Unit - Add Changing_Ability to A_Temp_Target_Unit
                  • -------- You can change the aggressive player by changing the A_Hostile_Player variable in the settings trigger. --------
                  • Unit - Change ownership of A_Temp_Target_Unit to A_Neutral_Player and Change color
                  • Set A_Temp_Ordered_Unit = No unit
                  • Set A_Temp_Target_Unit = No unit
                  • Set A_Range_Aggro = No unit
                • Else - Actions
                  • Set A_Temp_Ordered_Unit = No unit
                  • Set A_Temp_Target_Unit = No unit
                  • Set A_Range_Aggro = No unit
            • Else - Actions
              • Set A_Temp_Ordered_Unit = No unit
              • Set A_Temp_Target_Unit = No unit
              • Set A_Range_Aggro = No unit
          • Custom script: call RemoveLocation (udg_Position_Unit)
          • Custom script: call RemoveLocation (udg_Position_TargetUnit)
          • Custom script: call DestroyGroup(udg_A_TempGroup)
  • Range Neutral
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- Set the varibles --------
      • Set A_TempGroup = (Units owned by (Random player from N_Triggering_Player))
      • Set A_Player_Unit = (Random unit from A_TempGroup)
      • Set Position_Unit = (Position of A_Player_Unit)
      • Custom script: call DestroyGroup(udg_A_TempGroup)
      • Set A_TempGroup = (Units within A_Effect_Range of Position_Unit)
      • Set A_Range_Aggro = (Random unit from A_TempGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of A_Range_Aggro) is in N_Hostile_Player) Equal to True
        • Then - Actions
          • -------- If the unit is invisible to the hostile creep it will not change ownership. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (A_Player_Unit is invisible to A_Neutral_Player) Equal to True
            • Then - Actions
              • -------- If you want your unit to make the hostile creeps turn neutral while it is invisible, cut and past the two unit actions fron "Else" to the "Then" section here. --------
            • Else - Actions
              • -------- If the unit isn't invisible. --------
              • Unit - Add Changing_Ability to A_Range_Aggro
              • -------- You can change the ownership by changing the A_Neutral_Player variable in the settings trigger. --------
              • Unit - Change ownership of A_Range_Aggro to A_Neutral_Player and Change color
        • Else - Actions
      • Custom script: call RemoveLocation (udg_Position_Unit)
      • Custom script: call DestroyGroup(udg_A_TempGroup)




v1 - Released

v1.1 - Cleaned most leaks (I hope)
- Changed the aggro unit from a single unit to a player specific unit.
- Made it so if the unit has Wind Walk active, the neutral unit will not attack/change. (this is currently only set for the Range Aggro trigger)
- Made it a little more friendly to people who don't have much GUI knowledge. (Like myself :D)
- Added in more variables so the trigger wont bug.

v1.2 - Vastly optimized the triggers.
- Range Aggro trigger actually works... What the hell was I thinking before?
- Attack aggro now works with spells.
- Added a range limit to Click aggro (it some times doesn't function for some reason but it's optional)
- Added four new triggers for making hostile creeps turn to neutral and add the wander ability to them (optional)

- Trigger 1: Setting player groups and a variable.
- Trigger 2: Reverse of Attack Aggro. (Also functions with abilities)
- Trigger 3: Reverse of Click Aggro.
- Trigger 4: Reverse of Range Aggro.

- Removed a few abilities from the paladin and added Healing Wave and Storm Bolt to test on the creeps.

v1.2.5 - Cleaned leaks in the Click and Range triggers.
- Made it so the Range systems detect if the player unit is invisible, not if he has a specific buff.
- Attack systems work with ALL spells now, not just specific spells.
- You can change the range limit with the Range and Click systems by setting the A_Effect_Range variable in the settings trigger.

v1.3 - I didn't have time for this trigger but after a long wait, I managed to fix the mistakes I left behind.
- Fixed all bugs and leaks I could find.
- Clicking and range aggro/neutral are a lot more reliable and consistent.
- Revised Attacking for aggro/neutral, cleaned the leaks and made more efficient.
- Updated triggers on the resource description
- Edited comments on the triggers to be more clear.


Next version:
1.4. If I continue to update this, changing ownership after the effects of a buff wears off is my next priority.

Credits:
Wolf_Wing - Suggested to make it player specific.
Maker - for being so goddamn helpful.


Keywords:
Aggro Wander Creep neutral system RPG Single player specific GUI Triggers
Contents

Aggro System v1.3 (Map)

Reviews
Aggro System v1.3 | Reviewed by BPower | 14.06.2015 Concept[/COLOR]] Changes unit ownership from neutral to aggressive and back. The system currently fires on unit attack, spell cast, target order and periodically via timer event. I can see...

Moderator

M

Moderator


Aggro System v1.3 | Reviewed by BPower | 14.06.2015

[COLOR="gray"

[COLOR="gray"

[COLOR="gray"

Concept[/COLOR]]
126248-albums6177-picture66521.png
Changes unit ownership from neutral to aggressive and back.
The system currently fires on unit attack,
spell cast, target order and periodically via timer event.
126248-albums6177-picture66521.png
I can see this beeing useful for a few mappers.
Code[/COLOR]]
126248-albums6177-picture66521.png
  • Unnessesary code duplicates are catching my eyes.
126248-albums6177-picture66523.png
  • You should merge the aggro and neutral system under one trigger,
    basically they are identical except for one condition.
  • You can null your unit variables just once and at the bottom.
  • In "clicking" you attempt to destroy a group handle, which does not exist in the first place.
  • "Range" trigger needs a workover, as it currently might work for few camps, but gets unprecise for huge maps.
  • Permanent running 0.03 timers are performance killers. You should think of a better solution.
Rating[/COLOR]]
CONCEPTCODERATINGSTATUS
3/5
1/5
2/5
NEED FIX


Aggro System v1.25 | Reviewed by Maker | 27th Mar 2013
NEEDS FIX


126248-albums6177-picture66522.png


Check my reply in this thread.
[tr]




Aggro System v1.2 | Reviewed by Maker | 24th Mar 2013
NEEDS FIX


126248-albums6177-picture66522.png


  • Attack Aggro should not check specific abilities beign cast
    It hould work with any ability without needing to add
    each one by one
  • Attack Aggro has a if/then/else with no condition
  • Clicking Aggro leaks a location and you should
    abort the trigger if it was an item that was clicked
  • Range Aggro has a location leak and it runs 100 times a second,
    too often
  • Range Aggro check for Wind Walk buff, which is a specific buff,
    the system should check for invisibility status towards a player
126248-albums6177-picture66523.png


  • Readable triggers
[tr]


Aggro System v1.1 | Reviewed by Maker | 18th Feb 2013
Needs Fix

Required changes
  • The Player Group - pick every player in group actions are not needed.
    Use owner of unit function and check if the owner is in player group.
  • Use a variable for the player to change ownership to.
  • Range Aggro trigger needs a complete rework.
    I recommend you ask for help in Triggers & Scripts
Suggested changes
  • Add support for units de-aggroing
[td]
[/TD]
 
Level 13
Joined
Mar 29, 2012
Messages
542
Post the triggers, please....

Edit
Also, you need to store some function in variable that used more than once.
Example :
  • Attack Aggro
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set Temp_Unit = (Attacked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of Temp_Unit) Equal to Neutral Passive
        • Then - Actions
          • Unit - Remove Wander (Neutral) from Temp_Unit
          • Unit - Change ownership of Temp_Unit to Player 8 (Pink) and Change color
          • Unit - Order Temp_Unit to Attack (Attacking unit)
        • Else - Actions
 
Level 6
Joined
Nov 24, 2012
Messages
198
Post Some Trigger Please..........
and you need to add some trigger like this
add some player to group so....its will work for other player
  • Player
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Add Player 1 (Red) to PlayerGroup
      • Player Group - Add Player 2 (Blue) to PlayerGroup
      • Player Group - Add Player 3 (Teal) to PlayerGroup
      • Player Group - Add Player 4 (Purple) to PlayerGroup
      • Player Group - Add Player 5 (Yellow) to PlayerGroup
      • Player Group - Add Player 6 (Orange) to PlayerGroup
      • Player Group - Add Player 7 (Green) to PlayerGroup
      • Player Group - Add Player 8 (Pink) to PlayerGroup
      • Player Group - Add Player 9 (Gray) to PlayerGroup
      • Player Group - Add Player 10 (Light Blue) to PlayerGroup
      • Player Group - Add Player 11 (Dark Green) to PlayerGroup
      • Player Group - Add Player 12 (Brown) to PlayerGroup
      • Player Group - Add Neutral Hostile to PlayerGroup
      • Player Group - Add Neutral Victim to PlayerGroup
      • Player Group - Add Neutral Extra to PlayerGroup
      • Player Group - Add Neutral Passive to PlayerGroup
and do some trigger like this
EXAMPLE:
  • Attack Aggro
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set Temp_Unit = (Attacked unit)
      • Player Group - Pick every player in PlayerGroup and do (Actions)
        • Loop - Actions
          • Set Player = (Picked player)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of Temp_Unit) Equal to Player
            • Then - Actions
              • Unit - Remove Wander (Neutral) from (Attacked unit)
              • Unit - Change ownership of (Attacked unit) to Player 8 (Pink) and Change color
              • Unit - Order (Attacked unit) to Attack (Attacking unit)
            • Else - Actions
 
Level 7
Joined
Sep 8, 2011
Messages
211
Sorry guys I was suppose to look over the map 1 more time before putting it up and leaving for a few days, as soon as i get home i am cleaning everything and adding more to the system.

I am guessing from the comments people want me to make the system work for a player rather than just a hero. I'll work on this asap :)

And Zwiebelchen this system doesn't work with threat, it deals with how a passive unit turns aggressive and attacks the hero unit.

Edit: I have updated the system, thanks for the help guys ^^.
 
Last edited:
Level 23
Joined
Apr 16, 2012
Messages
4,041
Chaosy is right, bj_wantDestroyGroup only has effect if you are doing Pick every unit in ..., this way you create new group and never destroy it every time the trigger runs
I recommend using DestroyGroup(udg_yourgrouphere) if you are not using this group somewhere else
 
Casting Unit - Triggering Unit

(Owner of A_Temp_Attacked) > cache this into a variable

(Owner of A_Temp_Ordered_Unit) > cache to.

Wander(Neutral) > cache in an ability variable so that users can easily handle this.

You are leaking two unit groups in Range Aggro trigger and Range N trigger.

Also, the 300 range value there should be configurable
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Attack aggro could look like this I think:
  • Attack Aggro
    • Events
      • Unit - A unit Is attacked
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to (Casting unit)
        • Then - Actions
          • -------- Set the variables --------
          • Set A_Temp_Attacked = (Target unit of ability being cast)
          • Set A_Temp_Attacking = (Casting unit)
          • -------- Checking if the triggering units match with the set players --------
        • Else - Actions
          • Set A_Temp_Attacked = (Attacked unit)
          • Set A_Temp_Attacking = (Attacking unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of A_Temp_Attacked) is in A_Aggroing_Player) Equal to True
          • ((Owner of A_Temp_Attacking) is in A_Aggro_Player) Equal to True
        • Then - Actions
          • -------- If they do --------
          • Unit - Remove Changing_Ability from A_Temp_Attacked
          • -------- You can change the ownership by changing the A_Hostile_Player variable in the settings trigger. --------
          • Unit - Change ownership of A_Temp_Attacked to A_Hostile_Player and Change color
          • Unit - Order A_Temp_Attacked to Attack A_Temp_Attacking
          • Set A_Temp_Attacked = No unit
          • Set A_Temp_Attacking = No unit
        • Else - Actions
  • ((Target item of issued order) is in (Playable map area)) Equal to True
->
  • (Target item of issued order) Not equal to No item

In Clicking Aggro you have RemoveLocation in three places when you should only have it in one place. Same thing for Range Aggro trigger.

Range aggro leaks two unit groups.
Clicking Neutral leaks unit group.
Range Neutral leaks two unit groups.
 
Top