#--------------------------------------------- # Start state #--------------------------------------------- state Base { Conditions { if LevelValue "Gobl" != 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 "Gobl" != 1 goto ManageState if GotOpponent == 1 goto StartFight } Actions { Enable NoAttack "false" BlockAttacks "false" FollowPlayer "Run" } } #--------------------------------------------- # Found an opponent, get the the main path #--------------------------------------------- state StartFight { Conditions { if LevelValue "Gobl" != 1 goto ManageState if GotOpponent == 0 goto Patrol } Actions { GoToLevelPath SetState "ApproachOpponent" } } #--------------------------------------------- # Walk towards the opponent before attacking #--------------------------------------------- state ApproachOpponent { Conditions { if LevelValue "Gobl" != 1 goto ManageState if GotOpponent == 0 goto Patrol if OpponentRange < 3.0 goto AttackOpp if OpponentRange > 5.0 goto FastApproachOpponent if Timer > 3.0 goto FastApproachOpponent } Actions { ResetTimer FollowOpponent "WALK" } } #-------------------------------------------- # Run towards the opponent before attacking #-------------------------------------------- state FastApproachOpponent { Conditions { if LevelValue "Gobl" != 1 goto ManageState if GotOpponent == 0 goto Patrol if OpponentRange < 3.0 goto AttackOpp if OpponentRange < 5.0 and if Timer < 3.0 goto ApproachOpponent } Actions { FollowOpponent "RUN" } } #-------------------------------------------- # Attack the opponent #-------------------------------------------- state AttackOpp { Conditions { if LevelValue "Gobl" != 1 goto ManageState if Random < 0.5 goto AttackOppNorm if PreviousResult > 0.0 goto AttackOppSpecial } Actions { } } state AttackOppNorm { Conditions { if LevelValue "Gobl" != 1 goto ManageState if Timer > 1.0 goto Think } Actions { ResetTimer EngageOpponent "goalrange 0.5" "firerange 3.5" "instant" } } state AttackOppSpecial { Conditions { if LevelValue "Gobl" != 1 goto ManageState } Actions { FaceOpponent SetActionValue "value 3" "waitcontextfree" WaitActionFinished SetState "Think" } } #-------------------------------------------- # Just attacked, decide what to do now #-------------------------------------------- state Think { Conditions { if LevelValue "Gobl" != 1 goto ManageState if GotOpponent == 0 goto Patrol if OpponentRange > 3.0 goto ApproachOpponent if OpponentRange < 1.2 goto AttackOpp if CircleClockwise "4096" == 1 goto CirclePlayerClockwise if CircleAntiClockwise "4096" == 1 goto CirclePlayerAntiClockwise if Random < 0.5 goto AttackOpp } Actions { FaceOpponent "1.0" } } #-------------------------------------------- # Circle around the player in a clockwise # direction #-------------------------------------------- state CirclePlayerClockwise { Conditions { if LevelValue "Gobl" != 1 goto ManageState if GotOpponent == 0 goto Patrol if OpponentRange > 3.0 goto ApproachOpponent if CircleClockwise "1024" == 0 goto Think } Actions { CircleOpponent "1.6" "walk" "facing" "CLOCKWISE" } } #-------------------------------------------- # Circle around the player in an # anticlockwise direction #-------------------------------------------- state CirclePlayerAntiClockwise { Conditions { if LevelValue "Gobl" != 1 goto ManageState if GotOpponent == 0 goto Patrol if OpponentRange > 3.0 goto ApproachOpponent if CircleAntiClockwise "1024" == 0 goto Think } Actions { CircleOpponent "1.6" "walk" "facing" "ANTICLOCKWISE" } } #-------------------------------------------- # If the character has just been hit by it's # opponent #-------------------------------------------- state TakenHit { Conditions { if LevelValue "Gobl" != 1 goto ManageState if GotOpponent == 0 goto AttackAttacker if OpponentRange > 3.0 goto ApproachOpponent } Actions { FaceOpponent "2.0" SetState "ApproachOpponent" } } state RespawnOff { Conditions { } Actions { Respawnable "false" NoAttack KillMe } } state ManageState { Conditions { if LevelValue "Gobl" == 0 goto Base if LevelValue "Gobl" == 2 goto RespawnOff } Actions { } } state Killed { COnditions { } Actions { SetLevelValue "type Gobl" "value 0" } }