PARAM 0 approachdist 2.5 PARAM 1 shootrange 3.5 PARAM 2 engagedist 0.5 #start state state Base { Conditions { if Message "goblinstart" == 1 goto Patrol } Actions { DontPush IgnoreWallSplines SetCreautreFlagOff 0 } } state Patrol { Conditions { if CheckCreatureFlag "1" == 1 and if GotOpponent == 1 goto StartFight } Actions { # FollowSplinePoint "spline goblin1" "goalrange approachdist" FollowMultiSplinePoint "spline goblin" "goalrange approachdist" SetCreautreFlagOn 0 SetState "Leap" } } state Leap { Conditions { } Actions { IgnoreWallSplines SetCreautreFlagOn 1 } } #get to the main path state StartFight { Conditions { if GotOpponent == 0 goto Patrol } Actions { IgnoreWallSplines false GoToLevelPath SetState "ApproachOpponent" } } #follow the opponent till we get in range state ApproachAttack { Conditions { if GotOpponent == 0 goto Patrol if Timer > 0.5 goto Think } Actions { ResetTimer FollowAttack } } state ApproachOpponent { Conditions { if GotOpponent == 0 goto Patrol if OpponentRange < 3.0 goto AttackOpp } Actions { FollowAttack } } state Think { Conditions { if GotOpponent == 0 goto Patrol # if OpponentRange < 1.7 goto ApproachAttack if OpponentRange > 3.0 goto ApproachOpponent if CircleClockwise "4096" == 1 goto CirclePlayerClockwise if CircleAntiClockwise "4096" == 1 goto CirclePlayerAntiClockwise if Random < 0.5 goto AttackOpp if PreviousResult > 0.0 goto Wait } Actions { FaceOpponent "1.0" } } state Wait { Conditions { if OpponentRange > 3.0 goto ApproachOpponent } Actions { FaceOpponent "1.0" Setstate "Think" } } state AttackOpp { Conditions { if Timer > 1.0 goto Wait } Actions { ResetTimer EngageOpponent "goalrange engagedist" "firerange shootrange" "instant" } } 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" } } 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" } } state TakenHit { Conditions { } Actions { #wake up creature to attack SetCreautreFlagOn 1 Setstate "Patrol" } }