- Joined
- Apr 27, 2009
- Messages
- 237
How to make a trigger so that a computer hero attacks anyone withing [specific range] that has lower then 30% of health? To chase the lower health heroes within range.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Untitled Trigger 001

Events


Time - Every 0.50 seconds of game time

Conditions

Actions


Set U_Group (Units within 500.00 of (Position of Orc Warlock 0001 <gen>))


Unit Group - Pick every unit in U_Group and do (Actions)



Loop - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






((Picked unit) is alive) Equal to True






((Picked unit) belongs to an enemy of (Owner of Orc Warlock 0001 <gen>)) Equal to True






(Percentage life of (Picked unit)) Less than or equal to 30.00





Then - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








Or - Any (Conditions) are true









Conditions










(Life of (Picked unit)) Less than (Life of EnBa_Target[1])










EnBa_Target[1] Equal to No unit







Then - Actions








Set EnBa_Target[1] = (Picked unit)







Else - Actions





Else - Actions


Unit - Order Orc Warlock 0001 <gen> to Attack EnBa_Target[1]


Set EnBa_Target[1] = No Unit


Custom script: call DestroyGroup(udg_U_Group)
(Life of (Picked unit)) Less than (Life of EnBa_Target[1])
(Life of (Picked unit))
EnBa_Target[1]
Set EnBa_Target[1] = (Picked unit)
((Picked unit) is alive) Equal to True
((Picked unit) belongs to an enemy of (Owner of Orc Warlock 0001 <gen>)) Equal to True
(Percentage life of (Picked unit)) Less than or equal to 30.00
Set Group = (Units in (Playable map area))
Unit Group - Pick every unit in Group and do (Actions)
Loop - Actions
Unit - Remove (Picked unit) from the game
Custom script: call DestroyGroup(udg_Group)
AI Move attack low health

Events


Time - Every 20.00 seconds of game time

Conditions

Actions


Unit Group - Pick every unit in AIGroup and do (Actions)



Loop - Actions




Set PicketAi = (Picked unit)




Unit Group - Pick every unit in (Units within 512.00 of (Position of (Picked unit))) and do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








((Picked unit) is alive) Equal to True








((Picked unit) belongs to an enemy of (Owner of PicketAi)) Equal to True








(Life of (Picked unit)) Less than or equal to 30.00







Then - Actions








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










Or - Any (Conditions) are true











Conditions












(Life of (Picked unit)) Less than or equal to (Percentage life of LowestHealth[1])












LowestHealth[1] Equal to No unit









Then - Actions










Set LowestHealth[1] = (Picked unit)









Else - Actions







Else - Actions




Unit - Order PicketAi to Attack LowestHealth[1]
Set AIGroup1 = (Units within 512.00 of (Position of "How can i put a group of units here??"))
Set AIGroup1 = (Units within 512.00 of (Position of AIGroup))
Unit Group - Pick every unit in AIGroup and do (Actions)
Map init

Events


Map initialization

Conditions

Actions


Custom script: set bj_wantDestroyGroup=true


Unit Group - Pick every unit in (Units in (Playable map area) matching ((Matching unit) Equal to Orc Warlock 0001 <gen>)) and do (Actions)



Loop - Actions




Set My_AIHero = (Picked unit)
Periodic

Events


Time - Every 3.00 seconds of game time

Conditions

Actions


Set My_AIHero_Location = (Position of My_AIHero)


Set My_AIHero_Group = (Units within 2000.00 of My_AIHero_Location)


Unit Group - Pick every unit in My_AIHero_Group and do (Actions)



Loop - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






((Picked unit) is alive) Equal to True






(Percentage life of (Picked unit)) Less than or equal to 30.00






((Picked unit) belongs to an enemy of (Owner of My_AIHero)) Equal to True





Then - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








Or - Any (Conditions) are true









Conditions










(Life of (Picked unit)) Less than (Life of My_AIHero_Target)










My_AIHero_Target Equal to No unit







Then - Actions








Set My_AIHero_Target = (Picked unit)







Else - Actions





Else - Actions


Unit - Order My_AIHero to Attack My_AIHero_Target


Special Effect - Create a special effect attached to the origin of My_AIHero_Target using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl


Special Effect - Destroy (Last created special effect)


Set My_AIHero_Target = No unit


Custom script: call RemoveLocation(udg_My_AIHero_Location)


Custom script: call DestroyGroup(udg_My_AIHero_Group)
