PARAM 0 AttackRange 3.0 #--------------------------------------------- # Start state #--------------------------------------------- state Base { Conditions { if LevelValue "Stat" != 0 goto Control } Actions { Disable } } #--------------------------------------------- # Activates the character & chooses the state #--------------------------------------------- state Control { Conditions { if LevelValue "Stat" == 0 goto Base if LevelValue "Stat" == 1 goto Spawn } Actions { } } #--------------------------------------------- # Spawns & enables the creature #--------------------------------------------- state Spawn { Conditions { if LevelValue "Stat" != 1 goto Control } Actions { SetSpawnCount "0.0" Idle "mintime 6.0" "maxtime 10.0" SetLevelValue "type Spwn" "value 0.0" Enable SetState "FindOpponent" } } #--------------------------------------------- # Walks towards the player until got an opponent #--------------------------------------------- state FindOpponent { Conditions { if LevelValue "Stat" != 1 goto Control if GotOpponent == 1 goto Think if Timer > 5.0 goto Wander } Actions { ResetTimer FollowPlayer "RUN" } } #--------------------------------------------- # Decides how to attack the opponenet #--------------------------------------------- state Think { Conditions { if LevelValue "Stat" != 1 goto Control if GotOpponent == 0.0 goto Wander if OpponentRange < AttackRange goto Attack if OpponentRange > 4.0 goto MoveToOpponenet if Random < 0.1 goto CircleClockwise if PreviousResult < 0.2 goto CircleAntiClockwise if PreviousResult < 1.0 goto Attack } Actions { ResetTimer FaceOpponent "120.0" } } #--------------------------------------------- # Moves towards the opponent #--------------------------------------------- state MoveToOpponenet { Conditions { if LevelValue "Stat" != 1 goto Control if OpponentRange < AttackRange goto Attack if GotOpponent == 0.0 goto Wander } Actions { FollowOpponent "RUN" } } #--------------------------------------------- # Attacks the opponent #--------------------------------------------- state Attack { Conditions { if LevelValue "Stat" != 1 goto Control if Timer > 1.0 goto Think } Actions { ResetTimer EngageOpponent "goalrange 1.0" "firerange 3.5" "instant" Idle "mintime 3.0" "maxtime 3.0" } } #--------------------------------------------- # Cicles around the opponenet clockwise #--------------------------------------------- state CircleClockwise { Conditions { if LevelValue "Stat" != 1 goto Control 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" != 1 goto Control if Timer > 1.0 goto Think } Actions { ResetTimer CircleOpponent "1.6" "walk" "facing" "ANTICLOCKWISE" } } #--------------------------------------------- # Walks along the path looking for an opponenet #--------------------------------------------- state Wander { Conditions { if LevelValue "Stat" != 1 goto Control if GotOpponent == 1.0 goto Think if Timer > 4.0 goto FindOpponent } Actions { ResetTimer FollowPath "WALK" } } #--------------------------------------------- # Enters this state when the character # has died #--------------------------------------------- state Killed { Conditions { } Actions { SetlevelValue "type Dead" "value 0.0" } }