PARAM 0 AttackRange 6.0 #--------------------------------------------- # Start state #--------------------------------------------- state Base { Conditions { if LevelValue "Were" != 0 goto Patrol } Actions { Disable SetHitPoints "default 3.0" DontPush # IgnoreWallSplines CheckWallSplines Respawnable "origin" NoAttack } } #--------------------------------------------- # Follow the path nodes while looking for # an opponent to attack #--------------------------------------------- state Patrol { Conditions { if LevelValue "Were" != 1 goto ManageState if GotOpponent == 1 goto Think } Actions { Enable NoAttack "false" BlockAttacks "false" FollowPlayer "Run" } } #--------------------------------------------- # Runs towards the player until got an opponent #--------------------------------------------- state FindOpponent { Conditions { if LevelValue "Were" != 1 goto ManageState if GotOpponent == 1 goto Think } Actions { FollowPlayer "WALK" } } #--------------------------------------------- # Decides how to attack the opponent #--------------------------------------------- state Think { Conditions { if LevelValue "Were" != 1 goto ManageState if GotOpponent == 0.0 goto Patrol if OpponentRange < AttackRange goto Attack if OpponentRange > 4.0 goto MoveToOpponent if Random < 0.1 goto CircleClockwise if PreviousResult < 0.2 goto CircleAntiClockwise if PreviousResult < 1.0 goto Attack } Actions { ResetTimer FaceOpponent "120.0" } } #--------------------------------------------- # Moves towards the opponent #--------------------------------------------- state MoveToOpponent { Conditions { if LevelValue "Were" != 1 goto ManageState if OpponentRange < AttackRange goto Attack if GotOpponent == 0.0 goto Patrol } Actions { FollowOpponent "RUN" } } #--------------------------------------------- # Cicles around the opponenet clockwise #--------------------------------------------- state CircleClockwise { Conditions { if LevelValue "Were" != 1 goto ManageState if Timer > 1.0 goto Think } Actions { ResetTimer CircleOpponent "1.6" "walk" "facing" "CLOCKWISE" } } #--------------------------------------------- # Cicles around the opponent anticlockwise #--------------------------------------------- state CircleAntiClockwise { Conditions { if LevelValue "Were" != 1 goto ManageState if Timer > 1.0 goto Think } Actions { ResetTimer CircleOpponent "1.6" "walk" "facing" "ANTICLOCKWISE" } } #--------------------------------------------- # Chooses the Attack #--------------------------------------------- state Attack { Conditions { if LevelValue "Were" != 1 goto ManageState if OpponentRange < 3.5 goto AttackOppClose if PreviousResult < 4.2 goto AttackOppMid if PreviousResult > 5.5 goto AttackOppFar } Actions { } } #--------------------------------------------- # Attacks the opponent from a close range #--------------------------------------------- state AttackOppClose { Conditions { if LevelValue "Were" != 1 goto ManageState if Timer > 1.0 goto Think } Actions { ResetTimer EngageOpponent "goalrange 1.0" "firerange 3.5" "instant" } } #--------------------------------------------- # Attacks the opponent from a middle range #--------------------------------------------- state AttackOppMid { Conditions { if LevelValue "Were" != 1 goto ManageState } Actions { FaceOpponent "0.5" SetActionValue "value 2" "waitcontextfree" WaitActionFinished SetState "Think" } } #--------------------------------------------- # Attacks the opponent from a far range #--------------------------------------------- state AttackOppFar { Conditions { if LevelValue "Were" != 1 goto ManageState } Actions { FaceOpponent "1.0" SetActionValue "value 3" "waitcontextfree" WaitActionFinished SetState "Think" } } state RespawnOff { Conditions { } Actions { Respawnable "false" NoAttack KillMe } } state ManageState { Conditions { if LevelValue "Were" == 0 goto Base if LevelValue "Were" == 2 goto RespawnOff } Actions { } } state Killed { COnditions { } Actions { SetLevelValue "type Were" "value 0" } }