I'm making a map where I need an AI similar to a Hero Arena AI. Though the AI has to be from 1 player; neutral hostile (because all players slots are used by players).
This is my script:
I've got the AI heroes placed in 1 unitgroup, and they attack player units (which are enemies) and they have to attack each other.
The problem I've got with the script is that the heroes wont attack each other. When they walk near a players units they attack the players units, but when they walk near each other they don't attack each other.
Couldn't anyone please help me here?
This is my script:
Trigger:
- AI noob FFA
- Events
- Time - Every 2.00 seconds of game time
- Conditions
- Actions
- Unit Group - Pick every unit in AIheroes and do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Life of (Picked unit)) Equal to 0.00
- Then - Actions
- Else - Actions
- Set AItargetgroup = (Units within 800.00 of (Position of (Picked unit)) matching (((Owner of (Picked unit)) is an enemy of (Owner of (Matching unit))) Equal to True))
- Unit Group - Add all units of (Units within 800.00 of (Position of (Picked unit)) matching (((Matching unit) is in AIheroes) Equal to True)) to AItargetgroup
- Unit Group - Remove (Picked unit) from AItargetgroup
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Number of units in AItargetgroup) Greater than 0
- (Current order of (Picked unit)) Not equal to (Order(attack))
- Then - Actions
- Unit - Order (Picked unit) to Attack (Random unit from AItargetgroup)
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Current order of (Picked unit)) Not equal to (Order(attack-move))
- (Current order of (Picked unit)) Not equal to (Order(move))
- Then - Actions
- Set AIpoint = (Random point in (Entire map))
- Unit - Order (Picked unit) to Attack-Move To AIpoint
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Unit Group - Pick every unit in AIheroes and do (Actions)
- Events
I've got the AI heroes placed in 1 unitgroup, and they attack player units (which are enemies) and they have to attack each other.
The problem I've got with the script is that the heroes wont attack each other. When they walk near a players units they attack the players units, but when they walk near each other they don't attack each other.
Couldn't anyone please help me here?