- Joined
- Jun 10, 2019
- Messages
- 69
Hello all,
I'm most of the way there on this one, but I can't quite figure out the last bit.
My map is similar to League of Legends - there are lanes that you go down, destroying turrets on the way.
Like League of Legends, I want the turrets' AI to prioritize attacking minions/non-hero units over hero units. The trigger I made works pretty well, but sometimes the turrets just freeze up. I'm guessing they're being issued too many orders in a small period of time? I'm not sure how to get around that (and I'm not even sure if that's right).
The trigger is:
Edit: I forgot to remove the points. I added those custom scripts into the real trigger.
Edit2: I realized that there are a myriad of errors in this trigger, so I rewrote it:
I'm most of the way there on this one, but I can't quite figure out the last bit.
My map is similar to League of Legends - there are lanes that you go down, destroying turrets on the way.
Like League of Legends, I want the turrets' AI to prioritize attacking minions/non-hero units over hero units. The trigger I made works pretty well, but sometimes the turrets just freeze up. I'm guessing they're being issued too many orders in a small period of time? I'm not sure how to get around that (and I'm not even sure if that's right).
The trigger is:
-
Turret AI
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
Actions
-
Custom script: set bj_wantDestroyGroup = true
-
Set VariableSet Turret_AI_TempPoint[1] = (Position of (Dying unit))
-
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
-
Loop - Actions
-
Set VariableSet Turret_AI_TempPoint[2] = (Position of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Life of (Triggering unit)) Less than 700.00
-
(Distance between Turret_AI_TempPoint[1] and Turret_AI_TempPoint[2]) Less than or equal to 700.00
-
-
Then - Actions
-
Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in (Units within 700.00 of Turret_AI_TempPoint[2].) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is A Hero) Equal to False
-
((Picked unit) is alive) Equal to True
-
-
Then - Actions
-
Unit Group - Add (Picked unit) to Turret_AI_UnitGroup
-
-
Else - Actions
-
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Turret_AI_UnitGroup is empty) Equal to True
-
-
Then - Actions
-
Unit - Order (Picked unit) to Attack (Random unit from Turret_AI_UnitGroup)
-
Unit Group - Remove all units from Turret_AI_UnitGroup.
-
-
Else - Actions
-
-
Custom script: call DestroyGroup(udg_Turret_AI_UnitGroup)
-
-
Else - Actions
-
-
-
-
-
Edit: I forgot to remove the points. I added those custom scripts into the real trigger.
Edit2: I realized that there are a myriad of errors in this trigger, so I rewrote it:
-
Turret AI Exp
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Unit-type of (Killing unit)) Equal to Sentry Tower (Invulnerable)
-
(Unit-type of (Killing unit)) Equal to Sentry Tower (Vulnerable)
-
-
-
-
Then - Actions
-
Set VariableSet Turret_AI_Turret = (Killing unit)
-
Set VariableSet Turret_AI_TempPoint[1] = (Position of Turret_AI_Turret)
-
-
Else - Actions
-
Custom script: set bj_wantDestroyGroup = true
-
Set VariableSet Turret_AI_TempPoint[2] = (Position of (Killing unit))
-
Unit Group - Pick every unit in (Units within 900.00 of Turret_AI_TempPoint[2].) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Unit-type of (Picked unit)) Equal to Sentry Tower (Invulnerable)
-
(Unit-type of (Picked unit)) Equal to Sentry Tower (Vulnerable)
-
-
-
-
Then - Actions
-
Set VariableSet Turret_AI_Turret = (Picked unit)
-
Set VariableSet Turret_AI_TempPoint[1] = (Position of Turret_AI_Turret)
-
-
Else - Actions
-
-
-
-
-
-
Custom script: set bj_wantDestroyGroup = true
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Dying unit) belongs to an enemy of (Owner of Turret_AI_Turret).) Equal to True
-
-
Then - Actions
-
Unit Group - Pick every unit in (Units within 700.00 of Turret_AI_TempPoint[1].) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) belongs to an enemy of (Owner of Turret_AI_Turret).) Equal to True
-
((Picked unit) is A Hero) Equal to False
-
((Picked unit) is alive) Equal to True
-
-
Then - Actions
-
Unit Group - Add (Picked unit) to Turret_AI_UnitGroup
-
-
Else - Actions
-
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Turret_AI_UnitGroup is empty) Equal to False
-
-
Then - Actions
-
Unit - Order Turret_AI_Turret to Attack (Random unit from Turret_AI_UnitGroup)
-
-
Else - Actions
-
-
-
Else - Actions
-
-
Unit Group - Remove all units from Turret_AI_UnitGroup.
-
Custom script: call RemoveLocation(udg_Turret_AI_TempPoint[1])
-
Custom script: call RemoveLocation(udg_Turret_AI_TempPoint[2])
-
-
Last edited: