#--------------------------------------------- # Start state #--------------------------------------------- state Base { Conditions { } Actions { Disable SetHitPoints "default 5" Idle "mintime 1.5" "maxtime 1.5" MessageWait "GOBLINCROSS" "1.0" SetDynamicTerrainMask "32" SetState "EnableCharacter" } } #--------------------------------------------- # Enables the character #--------------------------------------------- state EnableCharacter { Conditions { } Actions { DontPush SetNoOpponent Enable SetState "Patrol" } } #--------------------------------------------- # Follow the path nodes while looking for # an opponent to attack #--------------------------------------------- state Patrol { Conditions { if GotOpponent == 1 goto StartFight } Actions { FollowPath } } #--------------------------------------------- # Found an opponent, get the the main path #--------------------------------------------- state StartFight { Conditions { if GotOpponent == 0 goto Patrol } Actions { GoToLevelPath SetState "ApproachOpponent" } } #--------------------------------------------- # Walk towards the opponent before attacking #--------------------------------------------- state ApproachOpponent { Conditions { 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 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 Random < 0.5 goto AttackOppNorm if PreviousResult > 0.0 goto AttackOppSpecial } Actions { } } state AttackOppNorm { Conditions { if Timer > 1.0 goto Think } Actions { ResetTimer EngageOpponent "goalrange 0.5" "firerange 3.5" "instant" } } state AttackOppSpecial { Conditions { } Actions { FaceOpponent SetActionValue "value 3" "waitcontextfree" WaitActionFinished SetState "Think" } } #-------------------------------------------- # Just attacked, decide what to do now #-------------------------------------------- state Think { Conditions { 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 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 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 OpponentRange > 3.0 goto ApproachOpponent } Actions { FaceOpponent "2.0" SetState "ApproachOpponent" } } #--------------------------------------------- # Enters this state when the character # has died #--------------------------------------------- state Killed { Conditions { } Actions { SetNoOpponent } }