#--------------------------------------------- # Start state #--------------------------------------------- state Base { Conditions { if LevelValue "WSPN" > 0 goto SpawnWithDelay } Actions { Disable SetSpawnCount "0.0" } } #--------------------------------------------- # Delays the spawning #--------------------------------------------- state SpawnWithDelay { Conditions { } Actions { SetLevelValue "type WSPN" "value 0.0" SetLevelValue "type WPOS" "value 0.0" Idle "mintime 3.0" "maxtime 6.0" Enable setState "JumpOutOfCave" } } #--------------------------------------------- # Spawns the character #--------------------------------------------- state Spawn { Conditions { } Actions { SetLevelValue "type WSPN" "value 0.0" SetLevelValue "type WPOS" "value 0.0" Enable setState "JumpOutOfCave" } } #--------------------------------------------- # Makes the character jump out of the cave #--------------------------------------------- state JumpOutOfCave { Conditions { } Actions { GoToLocator "xz_rangecheck" "2.0" setState "Think" } } #--------------------------------------------- # Decides how to attack the opponenet #--------------------------------------------- state Think { Conditions { if GotOpponent == 0.0 goto Wander if OpponentRange > 4.0 goto MoveToOpponenet if OpponentRange < 2.0 goto Attack if Random < 0.1 goto Attack } Actions { FaceOpponent "120.0" } } #--------------------------------------------- # Moves towards the opponent #--------------------------------------------- state MoveToOpponenet { Conditions { if OpponentRange < 2.0 goto Attack if GotOpponent == 0.0 goto Wander } Actions { FollowOpponent "RUN" } } #--------------------------------------------- # Attacks the opponent #--------------------------------------------- state Attack { Conditions { if Timer > 1.0 goto Think } Actions { ResetTimer EngageOpponent "goalrange 1.0" "firerange 3.5" "instant" Idle "mintime 3.0" "maxtime 3.0" } } #--------------------------------------------- # Runs along the path looking for an opponenet #--------------------------------------------- state Wander { Conditions { if GotOpponent == 1.0 goto Think if PlayerRange > 7.0 and if Timer > 3.0 goto FindPlayer } Actions { ResetTimer FollowPlayer "RUN" } } #--------------------------------------------- # Runs to the vicinity of the player #--------------------------------------------- state FindPlayer { Conditions { if GotOpponent == 1.0 goto Think if PlayerRange < 7.0 and if Timer > 3.0 goto Wander } Actions { ResetTimer FollowPlayer "RUN" } }