- Joined
- Sep 9, 2007
- Messages
- 253
It's a kodo tag map (original I know) but with teams. Players can't attack each other but they can spawn kodos to chase the enemy team. There are also neutral kodos which will chase any player.
I want the AI to target a player and constantly chase him. They should only target buildings if there is no path to the player they have targetted. I'm trying to save a target into the hashtable for each kodo on the map and ordering them to attack that target every 0.1 seconds.
With the triggers below it looks like the kodos are selecting a new random target every 0.1 seconds because they just stand in one place constantly changing direction.
So I've never really used hashtables before so I'm guessing I'm not doing it correctly.
note. before turning to hashtables I was using the trigger below but the kodos change focus to towers when the towers attack them. I want the kodos to taget buildings only if there is no route to their target.
Thanks so much for any help.
I want the AI to target a player and constantly chase him. They should only target buildings if there is no path to the player they have targetted. I'm trying to save a target into the hashtable for each kodo on the map and ordering them to attack that target every 0.1 seconds.
With the triggers below it looks like the kodos are selecting a new random target every 0.1 seconds because they just stand in one place constantly changing direction.
So I've never really used hashtables before so I'm guessing I'm not doing it correctly.
-
Spawn Kodo Top Left
- Events
- Conditions
-
Actions
- -------- TOP LEFT --------
- Set aaTempPoint = (Point(-8050.00, 5100.00))
- Unit - Create 1 Kodo_Spawn_Type for Player 12 (Brown) at aaTempPoint facing Default building facing degrees
- Custom script: call RemoveLocation(udg_aaTempPoint)
- Hashtable - Save 0 as 1 of (Key (Last created unit)) in KodoHashtable /////// this integer indicates weather this kodo will target any player (0) target team 1 (2) or target team 2 (1)
- Hashtable - Save 0 as 2 of (Key (Last created unit)) in KodoHashtable /////// this integer indicates weather or not this kodo has a target. has target (1) or does not have target (0)..... I tried integer coz boolean wasnt working.
-
targetting Hashtable
-
Events
- Time - Every 0.10 seconds of game time
- Conditions
-
Actions
- Set Kodo_Group = (Units owned by Player 12 (Brown))
-
Unit Group - Pick every unit in Kodo_Group and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Load 1 of (Key (Picked unit)) from KodoHashtable) Equal to 0
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Load 2 of (Key (Picked unit)) from KodoHashtable) Equal to 1 \\\\\\\ This condition doesn't seem to work because the actions below are always running even though 2 of picked unit is changed to 1 (ie does have target)
-
Then - Actions
- Unit - Order (Picked unit) to Attack (Load 3 of (Key (Picked unit)) in KodoHashtable)
-
Else - Actions
- Set aaTempUnit = (Random unit from UnitGroup_Runners)
- Unit - Order (Picked unit) to Attack aaTempUnit
- Hashtable - Save 1 as 2 of (Key (Picked unit)) in KodoHashtable
- Hashtable - Save Handle OfaaTempUnit as 3 of (Key (Picked unit)) in KodoHashtable
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Load 1 of (Key (Picked unit)) from KodoHashtable) Equal to 1
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Load 2 of (Key (Picked unit)) from KodoHashtable) Equal to 1
-
Then - Actions
- Unit - Order (Picked unit) to Attack (Load 3 of (Key (Picked unit)) in KodoHashtable)
-
Else - Actions
- Set aaTempUnit = (Random unit from UnitGroup_Runners_team2)
- Unit - Order (Picked unit) to Attack aaTempUnit
- Hashtable - Save 1 as 2 of (Key (Picked unit)) in KodoHashtable
- Hashtable - Save Handle OfaaTempUnit as 3 of (Key (Picked unit)) in KodoHashtable
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Load 2 of (Key (Picked unit)) from KodoHashtable) Equal to 1
-
Then - Actions
- Unit - Order (Picked unit) to Attack (Load 3 of (Key (Picked unit)) in KodoHashtable)
-
Else - Actions
- Set aaTempUnit = (Random unit from UnitGroup_Runners_team1)
- Unit - Order (Picked unit) to Attack aaTempUnit
- Hashtable - Save 1 as 2 of (Key (Picked unit)) in KodoHashtable
- Hashtable - Save Handle OfaaTempUnit as 3 of (Key (Picked unit)) in KodoHashtable
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Custom script: call DestroyGroup(udg_Kodo_Group)
-
Events
note. before turning to hashtables I was using the trigger below but the kodos change focus to towers when the towers attack them. I want the kodos to taget buildings only if there is no route to their target.
-
targetting
-
Events
- Time - Every 0.10 seconds of game time
- Conditions
-
Actions
- Set Kodo_Group = (Units owned by Player 12 (Brown) matching ((Current order of (Matching unit)) Equal to (Order(none))))
-
Unit Group - Pick every unit in Kodo_Group and do (Actions)
-
Loop - Actions
- Set aaTempUnit = (Random unit from UnitGroup_Runners)
- Unit - Order (Picked unit) to Attack aaTempUnit
-
Loop - Actions
- Custom script: call DestroyGroup(udg_Kodo_Group)
-
Events