I would like someone to help me with this trigger. It is supposed to make a computer (players 6-10) controlled unit to cast shockwave at an unit within range when it isn't moving and a small distance ahead of the unit when it's moving. The trigger works fine when the target unit is moving - it casts shockwave ahead of the unit. But it still casts the spell a small distance away when the unit is standing still (movement speed = 0).
I think the problem has to do with the movement speed condition, but I'm not sure why.
The PlayerUnit is a variable which stores the computer controlled unit.
I think the problem has to do with the movement speed condition, but I'm not sure why.
Code:
Bot attack
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
For each (Integer A) from 6 to 10, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of PlayerUnit[(Integer A)]) controller) Equal to Computer
Then - Actions
Set BotPosition[(Integer A)] = (Position of PlayerUnit[(Integer A)])
Set BotGroup[(Integer A)] = (Units within 800.00 of BotPosition[(Integer A)] matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of PlayerUnit[(Integer A)])) Equal to True)))
Unit Group - Pick every unit in BotGroup[(Integer A)] and do (Actions)
Loop - Actions
Set BotAttackPoint1 = (Position of (Picked unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current movement speed of (Picked unit)) Equal to 0.00
Then - Actions
Unit - Order PlayerUnit[(Integer A)] to Orc Tauren Chieftain - Shockwave BotAttackPoint1
Else - Actions
Set BotAttackPoint2 = (BotAttackPoint1 offset by 150.00 towards (Facing of (Picked unit)) degrees)
Unit - Order PlayerUnit[(Integer A)] to Orc Tauren Chieftain - Shockwave BotAttackPoint2
Custom script: call RemoveLocation(udg_BotAttackPoint2)
Custom script: call RemoveLocation(udg_BotAttackPoint1)
Custom script: call RemoveLocation(udg_BotPosition[GetForLoopIndexA()])
Custom script: call DestroyGroup(udg_BotGroup[GetForLoopIndexA()])
Else - Actions
The PlayerUnit is a variable which stores the computer controlled unit.