#--------------------------------------------- # Start state #--------------------------------------------- state Base { Conditions { if Message "KILLDWARVES" == 1.0 goto KillMe if Message "INITDWARFLOG3" == 1.0 goto InitialClimbOut } Actions { Disable #SetHitPoints "default 2" ## Don't use the ring targeting system NoRingSeg #Idle "mintime 1.5" "maxtime 1.5" #MessageWait "INITDWARFLOG3" "2.0" ## Disable all other dwarfs until this one is through the log ##SetMessage "name DWARFATTACK" "value 0" ##SetCreautreFlagOn "0" #SetNoProjectileTarget "1" #IgnoredByEnemies #DontPush #CanShootOffScreen #Enable #SetState "RunToLog" } } state InitialClimbOut { Conditions { } Actions { SetNoProjectileTarget "1" IgnoredByEnemies DontPush CanShootOffScreen Enable SetMessage "name INITDWARFLOG3" "value 0" Idle "mintime 0.5" "maxtime 0.5" SetLevelValue "type LOG3" "value 0" SetCreautreFlagOn "1" #SetMessage "name INITDWARFLOG3" "value 2" SetState "ClimbOutOfLog" } } #--------------------------------------------- # Runs to the log #--------------------------------------------- state RunToLog { Conditions { } Actions { GotoLocator "xz_rangecheck" # Enable all other dwarfs since this one is clear of the log #SetMessage "name DWARFATTACK" "value 1" #SetCreautreFlagOff "0" Idle "mintime 2.5" "maxtime 2.5" #SnapToLocator "name" "LogPos3" SetLevelValue "type LOG3" "value 0" SetCreautreFlagOn "1" SetState "ClimbOutOfLog" } } #--------------------------------------------- # Waits for the character to climb out # of the log #--------------------------------------------- state ClimbOutOfLog { Conditions { # The level code will reset this flag if CheckCreatureFlag "1" == 0.0 goto "SetAsTarget" } Actions { } } #--------------------------------------------- # Makes the character a target of projectiles #--------------------------------------------- state SetAsTarget { Conditions { } Actions { SetNoProjectileTarget "0" IgnoredByEnemies "false" SetState "Idle" } } #--------------------------------------------- # Wait for the player to be in range #--------------------------------------------- state Idle { Conditions { if PlayerRangeP1 < 20.0 goto LoadBow if PlayerRangeP2 < 20.0 goto LoadBow } Actions { SetNoOpponent } } #--------------------------------------------- # Primes the bow ready for attack #--------------------------------------------- state LoadBow { Conditions { if Timer > 0.5 goto Think } Actions { ResetTimer PrimeBow } } #--------------------------------------------- # Decides what action to take #--------------------------------------------- state Think { Conditions { if OpponentRange > 20 goto Idle if Random < 0.7 goto AttackOpp } Actions { GetPlayerOpponent FaceOpponent "1.4" } } #--------------------------------------------- # Fire the bow #--------------------------------------------- state AttackOpp { Conditions { if GotOpponenet == 0 goto Think if Timer > 1.0 goto LoadBow } Actions { ResetTimer EngageOpponent "goalrange 0.0" "firerange 20.0" FaceOpponent "1.4" } } #--------------------------------------------- # Enters this state when the character # has died #--------------------------------------------- state Killed { Conditions { # if CheckCreatureFlag "0" == 1.0 goto ResetDwarfAttackFlag } Actions { } } #--------------------------------------------- # Resets the dwarf attack flag if this dwarf # died during moving to the log #--------------------------------------------- state ResetDwarfAttackFlag { Conditions { } Actions { # Enable all other dwarfs since this one has died SetMessage "name DWARFATTACK" "value 1" } } state KillMe { Conditions { } Actions { Respawnable "false" NoAttack KillMe } }