#--------------------------------------------- # Start state #--------------------------------------------- state Base { Conditions { if LevelValue "Dwrf" == 1 goto EnableCharacter } Actions { SetLevelValue "type Dact" "value 0" CanShootOffScreen Disable SetHitPoints "default 3" DontPush Respawnable "false" # Don't use the ring targeting system NoRingSeg } } #--------------------------------------------- # Enables the character #--------------------------------------------- state EnableCharacter { Conditions { if LevelValue "Dwrf" != 1 goto ManageState } Actions { Respawnable "origin" DontPush Enable SetState "WanderToBank" } } #--------------------------------------------- # Wait for the player to be in range #--------------------------------------------- state WanderToBank { Conditions { if LevelValue "Dwrf" != 1 goto ManageState } Actions { GotoLocator "xz_rangecheck" SetLevelValue "type Dact" "value 1" SetState "Idle" } } #--------------------------------------------- # Wait for the player to be in range #--------------------------------------------- state Idle { Conditions { if LevelValue "Dwrf" != 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 "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 { #SetLevelValue "type Dact" "value 0" #SetLevelValue "type Dwrf" "value 0" #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 Dact" "value 0" SetLevelValue "type Dwrf" "value 0" } }