- Joined
- Sep 27, 2011
- Messages
- 141
Is it possible to stop a unit from moving after it has traveled a certain distance from a point without ordering it to stop or moving it backward.
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.
Custom script: call SetUnitPropWindow(*unit*, 0)
Custom script: call SetUnitPropWindow(*unit*, 0) is the best way. If you set Movement Speed to 0, it will never allow your unit to go under you "Minimum Speed" you can change in the Gamplay Constants, however, UnitPropWindow = 0 works for what you want, and goes over the minimum movement speed, since it doesn't mess with Movement Speed, but with something else, I don't know what
System

Events


Time - Every 0.03 seconds of game time

Conditions

Actions


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



Loop - Actions




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





If - Conditions






(Distance between (Position of (Picked unit)) and (Center of (Playable map area))) Greater than or equal to 500.00





Then - Actions






Unit - Move (Picked unit) instantly to ((Center of (Playable map area)) offset by 500.00 towards (Angle from (Center of (Playable map area)) to (Position of (Picked unit))) degrees)





Else - Actions
SetUnitX/Y, which you do not find in GUI. These do not interrupt orders and such. Therefore it will look like your unit keeps running against an invisible wall.call SetUnitX(GetEnumUnit(), GetLocationX(udg_center) + udg_radius * Cos(Atan2(GetUnitY(GetEnumUnit()) - GetLocationY(udg_center), GetUnitX(GetEnumUnit()) - GetLocationX(udg_center))))
call SetUnitY(GetEnumUnit(), GetLocationY(udg_center) + udg_radius * Sin(Atan2(GetUnitY(GetEnumUnit()) - GetLocationY(udg_center), GetUnitX(GetEnumUnit()) - GetLocationX(udg_center))))

