#--------------------------------------------- # Start state #--------------------------------------------- state Base { Conditions { } Actions { Disable SetHitPoints "default 2" # Don't use the ring targeting system NoRingSeg Idle "mintime 1.5" "maxtime 3.5" MessageWait "BOGGLEDWARFATTACK" "1.0" SetState "EnableCharacter" } } #--------------------------------------------- # Enables the character #--------------------------------------------- state EnableCharacter { Conditions { } Actions { DontPush Enable SetState "WanderToBank" } } #--------------------------------------------- # Wait for the player to be in range #--------------------------------------------- state WanderToBank { Conditions { } Actions { GotoLocator "xz_rangecheck" SetState "Idle" } } #--------------------------------------------- # Wait for the player to be in range #--------------------------------------------- state Idle { Conditions { if LevelValue "TSho" == 1 goto LoadBow if PlayerRangeP1 < 20.0 goto LoadBow if PlayerRangeP2 < 20.0 goto LoadBow } Actions { SetNoOpponent } } #--------------------------------------------- # Primes the bow ready for attack #--------------------------------------------- state LoadBow { Conditions { if Timer > 0.5 goto Think } Actions { ResetTimer PrimeBow } } #--------------------------------------------- # Decides what action to take #--------------------------------------------- state Think { Conditions { if LevelValue "TSHO" == 1 goto ShootAtTree if OpponentRange > 20 goto Idle if Random < 0.7 goto AttackOpp } Actions { GetPlayerOpponent FaceOpponent "1.4" } } #--------------------------------------------- # Fire the bow #--------------------------------------------- state AttackOpp { Conditions { if GotOpponent == 0 goto Think if Timer > 1.0 goto LoadBow } Actions { ResetTimer EngageOpponent "goalrange 0.0" "firerange 20.0" FaceOpponent "1.4" } } #--------------------------------------------- # Fire the bow at the tree #--------------------------------------------- state ShootAtTree { Conditions { } Actions { SetLevelValue "type TSho" "value 0" SetLevelValue "type SetT" "value 0" SetCreautreFlagOn "2" PressActionButton Idle "1.0" SetCreautreFlagOff "2" SetState "LoadBow" } }