/* Generic Carnivore Flee Behaviour // */ machine CarnFlee { default state Start { action SetAutoMovementBlend(true) action SetSpeedModifier(1.0) action SetRunMode(true) transition AcquireTarget("aggressor") { action StartLook("LookTarget", 1.0) action SendEnclosureEvent("escape_predator") goto FoundTarget } } state FoundTarget { action AvoidTarget(20.0, true) transition InTargetProximity(19.5, true) == false { goto SetWander } } state SetWander { action SetWander() action SetRandomTimerBetween(1, 17.0, 20.0) transition { goto Wander } } state Wander { transition HasArrived() { goto SetWander } transition InTargetProximity(17.0, true) { goto FoundTarget } transition IsTimerUp(1) { goto SetWander } } ;------------------------ Exit States Begin ---------------------- exitstart state CleanUp { action StopLook() transition { goto CleanUpEnd } } exitend state CleanUpEnd { } ;------------------------ Exit States End ---------------------- }