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