/* Raptor Flee Behaviour // */ machine RaptorFlee { 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 { /* transition IsTargetVehicle() { ;//call HangAroundVehicle Start ;// too many files, for now just put behaviour in this one instead of separate file goto FollowVehicle } */ 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 } } state FollowVehicle { action SetSpeedModifier(1.0) action SetRunMode(true) transition { direct goto HuntBegin } } state HuntBegin { transition HasTarget() == false { direct goto Start } transition { action SetRandomTimerBetween(2, 40.0, 50.0) goto Hunt } } state Hunt { action SetRandomTimerBetween(1, 7.0, 16.0) action SetRand(0, 2) transition GetRand() == 0 { goto SeekLeft } transition { goto SeekRight } transition IsTimerUp(2) { goto VehicleFlee } } state SeekLeft { action SeekTargetOffset(4.0, -1.57, true, false, true) transition IsTargetInBuilding() { action SetStandStill() goto Start } transition IsTimerUp(1) { action SetStandStill() goto CallPause } transition InTargetProximityRadius(2.0, true) { action SetStandStill() goto CallPause } } state SeekRight { action SeekTargetOffset(4.0, 1.57, true, false, true) transition IsTargetInBuilding() { action SetStandStill() goto Start } transition IsTimerUp(1) { action SetStandStill() goto CallPause } transition InTargetProximityRadius(2.0, true) { action SetStandStill() goto CallPause } } state CallPause { action SetRand(0, 2) transition GetRand() == 0 { action SetRandomTimerBetween(1, 2.0, 3.0) action PlayAnim("call", "01_lp", false) action StartLook("LookProximity", 0.5) goto CallWait } transition { action SetAutoMovementBlend(false) action PlayAnim("call", "f", false) goto CallFullWait } } state CallWait { transition IsTimerUp(1) { action StartLook("LookTarget", 1.0) goto CallEnd } } state CallFullWait { transition IsAnimPlaying("call", "f", false) == false { action SetAutoMovementBlend(true) goto CallEnd } } state CallEnd { transition InTargetProximityRadius(2.0, true) { action SetRandomTimerBetween(1, 3.0, 4.0) action SetWander() goto CallWander } transition { goto Hunt } } state CallWander { transition IsTimerUp(1) { action SetStandStill() goto Hunt } transition HasArrived() { goto Hunt } transition InTargetProximityRadius(17.0, false) == false { action SetStandStill() goto Hunt } } state VehicleFlee { action AvoidTarget(40.0, true) transition InTargetProximity(39.0, true) == false { goto SetWander } } ;------------------------ Exit States Begin ---------------------- exitstart state CleanUp { action StopLook() transition { goto CleanUpEnd } } exitend state CleanUpEnd { } ;------------------------ Exit States End ---------------------- }