#--------------------------------------------- # Start state #--------------------------------------------- state Base { Conditions { if LevelValue "Stat" != 0 goto Activate } Actions { Disable SetLevelValue "type Stat" "value 0.0" Idle "mintime 4.0" "maxtime 8.0" SetLevelValue "type REDY" "value 0.0" } } #--------------------------------------------- # Activates the character #--------------------------------------------- state Activate { Conditions { if LevelValue "Stat" == 0 goto Base if LevelValue "Stat" == 1 goto Climb if LevelValue "Stat" == 2 goto JumpOutOfCave if LevelValue "Stat" == 3 goto Think } Actions { Enable } } #--------------------------------------------- # Makes the character jump out of the cave #--------------------------------------------- state JumpOutOfCave { Conditions { if LevelValue "Stat" != 2 goto Activate } Actions { SetSpawnCount "0.0" GoToNode "BOGGOAL" setLevelValue "type Stat" "value 3.0" } } #--------------------------------------------- # Waits for the character to climb #--------------------------------------------- state Climb { Conditions { if LevelValue "Stat" != 1 goto Activate } Actions { SetSpawnCount "0.0" } } #--------------------------------------------- # Decides how to attack the opponenet #--------------------------------------------- state Think { Conditions { if LevelValue "Stat" != 3 goto Activate if GotOpponent == 0.0 goto Wander if OpponentRange > 4.0 goto MoveToOpponenet if OpponentRange < 2.0 goto Attack if Random < 0.2 goto CircleClockwise if PreviousResult < 0.4 goto CircleAntiClockwise if PreviousResult < 1.0 goto Attack } Actions { ResetTimer FaceOpponent "120.0" } } #--------------------------------------------- # Moves towards the opponent #--------------------------------------------- state MoveToOpponenet { Conditions { if LevelValue "Stat" != 3 goto Activate if GotOpponent == 0.0 goto Wander if OpponentRange < 2.0 goto Attack } Actions { Idle "mintime 0.1" "maxtime 0.5" FollowOpponent "RUN" } } #--------------------------------------------- # Attacks the opponent #--------------------------------------------- state Attack { Conditions { if LevelValue "Stat" != 3 goto Activate } Actions { EngageOpponent "goalrange 1.0" "firerange 3.5" "instant" Idle "mintime 1.0" "maxtime 1.5" SetState "Think" } } #--------------------------------------------- # Cicles around the opponenet clockwise #--------------------------------------------- state CircleClockwise { Conditions { if LevelValue "Stat" != 3 goto Activate if Timer > 1.0 goto Think } Actions { ResetTimer CircleOpponent "1.6" "walk" "facing" "CLOCKWISE" } } #--------------------------------------------- # Cicles around the opponenet anticlockwise #--------------------------------------------- state CircleAntiClockwise { Conditions { if LevelValue "Stat" != 3 goto Activate if Timer > 1.0 goto Think } Actions { ResetTimer CircleOpponent "1.6" "walk" "facing" "ANTICLOCKWISE" } } #--------------------------------------------- # Chooses the type of path #--------------------------------------------- state Wander { Conditions { if LevelValue "Stat" != 3 goto Activate if GotOpponent == 1.0 goto Think if Random < 0.5 goto WanderOnPath if PreviousResult < 1.0 goto WanderToPlayer } Actions { Idle "mintime 0.1" "maxtime 1.0" } } #--------------------------------------------- # Walks along the path looking for an opponenet #--------------------------------------------- state WanderOnPath { Conditions { if LevelValue "Stat" != 3 goto Activate if GotOpponent == 1.0 goto Think #if PlayerRangeP1 < 15.0 goto WanderToPlayer #if PlayerRangeP2 < 15.0 goto WanderToPlayer } Actions { FollowPath "WALK" } } #--------------------------------------------- # Walks along the path looking for an opponenet #--------------------------------------------- state WanderToPlayer { Conditions { if LevelValue "Stat" != 3 goto Activate if GotOpponent == 1.0 goto Think if PlayerRangeP1 > 7.0 and if PlayerRangeP2 > 7.0 goto WanderOnPath } Actions { FollowPlayer "WALK" } } #--------------------------------------------- # Enters this state when the character # has died #--------------------------------------------- state Killed { Conditions { } Actions { SetlevelValue "type Dead" "value 0.0" } }