#--------------------------------------------- # Start state #--------------------------------------------- state Base { Conditions { if LevelValue "TDwr" != 0 goto EnableCharacter } Actions { CanShootOffScreen Disable SetHitPoints "default 3" DontPush # Don't use the ring targeting system NoRingSeg Respawnable "origin" } } #--------------------------------------------- # Enables the character #--------------------------------------------- state EnableCharacter { Conditions { if LevelValue "TDwr" != 1 goto ManageState } Actions { DontPush Enable SetState "WanderToBank" } } #--------------------------------------------- # Wait for the player to be in range #--------------------------------------------- state WanderToBank { Conditions { if LevelValue "TDwr" != 1 goto ManageState } Actions { GotoLocator "xz_rangecheck" SetState "Idle" } } #--------------------------------------------- # Wait for the player to be in range #--------------------------------------------- state Idle { Conditions { if LevelValue "TDwr" != 1 goto ManageState if PlayerRangeP1 < 20.0 goto LoadBow if PlayerRangeP2 < 20.0 goto LoadBow } Actions { SetNoOpponent } } #--------------------------------------------- # Primes the bow ready for attack #--------------------------------------------- state LoadBow { Conditions { if LevelValue "TDwr" != 1 goto ManageState #if Timer > 10.0 goto Think } Actions { #ResetTimer PrimeBow Idle "mintime 7.0" "maxtime 9.0" SetState "Think" } } #--------------------------------------------- # Decides what action to take #--------------------------------------------- state Think { Conditions { if LevelValue "TDwr" != 1 goto ManageState if OpponentRange > 20 goto Idle if Random < 0.2 goto AttackOpp } Actions { GetPlayerOpponent FaceOpponent "1.2" } } #--------------------------------------------- # Fire the bow #--------------------------------------------- state AttackOpp { Conditions { if LevelValue "TDwr" != 1 goto ManageState if GotOpponent == 0 goto Think if Timer > 2.0 goto LoadBow } Actions { ResetTimer EngageOpponent "goalrange 0.0" "firerange 20.0" FaceOpponent "1.2" } } state RespawnOff { Conditions { } Actions { Respawnable "false" NoAttack KillMe } } state ManageState { Conditions { if LevelValue "TDwr" == 0 goto Base if LevelValue "TDwr" == 2 goto RespawnOff } Actions { } } state Killed { COnditions { } Actions { } }