/* TRex Flee Behaviour // */ machine TRexFlee { default state Start { action SetAutoMovementBlend(true) action SetSpeedModifier(1.2) 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 IsTargetVehicle() { direct goto DestroyedCheck } transition InTargetProximity(19.5) == false { action SetWander() goto Wander } } state DestroyedCheck { transition IsTargetDead() == false { goto AttackVehicleStart ;// should put this as a seperate machine later when vfs done } transition InTargetProximity(19.5) == false { action SetWander() goto Wander } transition { goto FoundTarget } } state Wander { transition HasArrived() { action SetWander() goto Wander } transition InTargetProximity(17.0) { goto FoundTarget } } state AttackVehicleStart { transition HasTarget() == false { goto CleanUp } transition { goto ChaseVehicle } } state ChaseVehicle { transition IsTargetDead() { action SetStandStill() goto CleanUp } transition SeekTargetOffset(-7.0, 0.0, true, false, true) == false { action SetWander() goto SeekFail } transition InSetPosProximityRadius(0.5) { direct goto MinDistCheck } } state SeekFail { transition HasTarget() == false { goto CleanUp } transition HasArrived() { action SetWander() goto SeekFail } transition SeekTargetOffset(-7.0, 0.0, true, false, true) { goto ChaseVehicle } } state MinDistCheck { transition InTargetProximityRadius(-1.0, false) == false { goto SeekFacingCheck } transition IsTimerUp(1) { action PlayAnim("call", "02_lp", false) action SetRandomTimerBetween(1, 6.0, 8.0) goto ChaseVehicle } transition { goto ChaseVehicle } } state SeekFacingCheck { transition IsFacingTargetsFacing(0.86) { action SetStandStill() action SetSpeedDirect(0.0) action StopVehicleTarget(true) action InterpolateVehicleDir() action FaceTarget() action LockMachine(true) goto FaceVehicle } transition IsTargetStationary() { action SetStandStill() action SetSpeedDirect(0.0) action FaceTarget() goto FaceStationary } transition { goto ChaseVehicle } } state FaceStationary { transition HasArrived() { action SetStandStill() goto ChaseVehicle } } state FaceVehicle { action InterpolateVehicleDir() transition HasArrived() { action SetStandStill() action SetSpeedDirect(0.0) goto Attack } } state Attack { action InterpolateVehicleDir() action SetAutoMovementBlend(false) action StopLook() action StopAllUserAnimations() action SetAvoidanceSteer(false) action PlayAnim("lcarn", "jpatk01", false, 0.0) action SetRandomTimerBetween(1, 2.0, 2.0) transition { goto SpecialWaitInterp } } state SpecialWaitInterp { transition IsTimerUp(1) { action SetRandomTimerBetween(1, 1.0, 1.0) action SetVehicleInterpolation(true, 8.41) goto SpecialWait } } state SpecialWait { transition IsAnimPlaying("lcarn", "jpatk01", false) == false { action SetVehicleInterpolation(false, 0.0) action SetAvoidanceSteer(true) action SetTransfromFromLocator("D", true) action StopAnimInstant("lcarn", "jpatk01") action PlayAnimInstant("idle", "brth_lp", false) action SetStandStill() action SetAutoMovementBlend(true) action SetRandomTimerBetween(3, 1.0, 1.0) goto SpecialPosture } transition IsTimerUp(1) { ;//action HurtTargetUnit(5.0) action HurtTargetUnit(false, 1.0) action SetRandomTimerBetween(1, 1.0, 1.0) goto SpecialWait } } state SpecialPosture { transition IsTimerUp(3) { action SetAutoMovementBlend(false) action PlayAnimInstant("idle", "post_lp", false) goto FatalPostureWait } } state FatalPostureWait { transition IsAnimPlaying("idle", "post_lp", false) == false { action SetAutoMovementBlend(true) action SetSpeedModifierWalk(1.0) action SetRunMode(false) action SeekTargetOffset(8.0, 0, true, true, true) action SetRandomTimerBetween(1, 5.0, 6.0) goto MoveAwayFromVehicle } } state MoveAwayFromVehicle { transition IsTimerUp(1) { action SetStandStill() goto ExplodeVehicle } transition InTargetProximityRadius(7.0, false) == false { action SetStandStill() goto ExplodeVehicle } transition HasArrived() { goto ExplodeVehicle } } state ExplodeVehicle { ;//action HurtTargetUnit(1000.0) action HurtTargetUnit(false, -1.0) transition { action LockMachine(false) goto CleanUp } } ;------------------------ Exit States Begin ---------------------- exitstart state CleanUp { action StopLook() transition { goto CleanUpEnd } } exitend state CleanUpEnd { action LockMachine(false) } ;------------------------ Exit States End ---------------------- }