/* // // Look at the closest unit // // This script should be called via the StartLook() action and stopped via the StopLook() action // // **WARNING**: // This script should never call other scripts nor should it be called directly within other scripts // */ machine LookProximity { state LookStart { action LookEnd() transition { direct goto LookFind } } state LookFind { transition AcquireClosestLookTarget() == true { action SetRandomLookTimer(6.0, 8.0) action LookAtLookTargetPosition(0.0, true) ;// use pre-set speed goto LookLoop } transition { goto LookRandom } } state LookLoop { action LookAtLookTargetPosition(0.0, true) ;// use pre-set speed transition IsRandomLookTimerUp() { goto LookLoopNewAcquire } } state LookLoopNewAcquire { transition AcquireClosestLookTarget() == true { goto LookFind } transition { action LookEnd() goto LookFind } } state LookRandom { action LookAtRandomPositionExtent(0.0, 0.9, 0.5, true) action SetRandomLookTimer(1.5, 3.0) transition { goto TimerWait } } state TimerWait { transition IsRandomLookTimerUp() { goto LookFind } } ;/////////////////////////////////////////////////////////////// ;// Exit States exitstart state LookExitStart { transition { direct goto LookExitEnd } } exitend state LookExitEnd { } }