{
  IF ( INT_GAME_TURN == 0 )
  {
    SET $0                                     0
    DO SET_ATTACK_VARIABLE                     $0
    DO STATE_STATE_BRING_NEW_PEOPLE_BACK       ON
    DO STATE_SHAMAN_GET_WILDS                  ON
    DO STATE_CONSTRUCT_BUILDING                ON
    DO STATE_POPULATE_DRUM_TOWER               ON
    DO STATE_HOUSE_A_PERSON                    ON
    DO STATE_FETCH_FAR_VEHICLE                 ON
    DO STATE_BUILD_VEHICLE                     OFF
    DO STATE_FETCH_LOST_PEOPLE                 ON
    SET INT_ATTR_PEOPLE_PER_BOAT               7
    SET INT_ATTR_PREF_BOAT_DRIVERS             8
    SET INT_ATTR_SPY_CHECK_FREQUENCY           128
    SET INT_ATTR_SPY_DISCOVER_CHANCE           35
    SET INT_ATTR_ENEMY_SPY_MAX_STAND           128
    SET INT_ATTR_SHAMEN_BLAST                  64
    SET INT_ATTR_RETREAT_VALUE                 35
    SET INT_ATTR_BASE_UNDER_ATTACK_RETREAT     1
    SET INT_ATTR_RANDOM_BUILD_SIDE             0
    SET INT_ATTR_MAX_TRAIN_AT_ONCE             3
    SET INT_ATTR_GROUP_OPTION                  0
    DO CREATE_MSG_NARRATIVE                    156
    DO SET_MSG_AUTO_OPEN_DLG
    SET INT_ATTR_PREF_SPY_TRAINS               0
    SET INT_ATTR_PREF_WARRIOR_TRAINS           0
    SET INT_ATTR_PREF_FIREWARRIOR_TRAINS       0
    SET INT_ATTR_PREF_RELIGIOUS_TRAINS         0
    SET INT_ATTR_PREF_BOAT_HUTS                0
    SET INT_ATTR_PREF_BALLOON_HUTS             0
    SET INT_ATTR_MAX_BUILDINGS_ON_GO           1
    SET INT_ATTR_HOUSE_PERCENTAGE              20
    SET INT_ATTR_EXPANSION                     12
    SET INT_ATTR_DEFENSE_RAD_INCR              4
    SET INT_ATTR_MAX_DEFENSIVE_ACTIONS         3
    SET INT_ATTR_ATTACK_PERCENTAGE             75
    SET INT_ATTR_USE_PREACHER_FOR_DEFENCE      1
    DO STATE_PREACH                            ON
    DO STATE_FIREWARRIOR_DEFEND                ON
    DO STATE_TRAIN_PEOPLE                      ON
    SET INT_ATTR_PREF_WARRIOR_PEOPLE           20
    SET INT_ATTR_PREF_FIREWARRIOR_PEOPLE       25
    SET INT_ATTR_PREF_RELIGIOUS_PEOPLE         15
    SET INT_ATTR_PREF_SPY_PEOPLE               0
    DO STATE_DEFEND                            ON
    DO STATE_DEFEND_BASE                       ON
    DO SET_DEFENCE_RADIUS                      7
    DO STATE_AUTO_ATTACK                       ON
    SET INT_ATTR_MAX_ATTACKS                   2
    SET INT_ATTR_AWAY_BRAVE                    0
    SET INT_ATTR_AWAY_WARRIOR                  40
    SET INT_ATTR_AWAY_RELIGIOUS                10
    SET INT_ATTR_AWAY_SPY                      0
    SET INT_ATTR_AWAY_FIREWARRIOR              40
    SET INT_ATTR_AWAY_SHAMAN                   1
    DO STATE_SPELL_DEFENCE                     82 234 ON
    DO SET_SPELL_ENTRY 0 INT_LIGHTNING INT_M_SPELL_TORNADO_COST 64 6 0
    DO SET_SPELL_ENTRY 1 INT_SWARM INT_M_SPELL_LIGHTNING_COST 64 2 0
    SET $1                                     0
    SET $2                                     0
    SET $3                                     0
    SET $4                                     0
    SET $5                                     0
    SET $6                                     0
    SET $7                                     0
  }
  ELSE
  {
    EVERY 256 133
    {
      IF ( INT_MY_NUM_PEOPLE < 80 )
      {
        DO SET_BUCKET_USAGE                      ON
        DO SET_BUCKET_COUNT_FOR_SPELL INT_BLAST                 8
        DO SET_BUCKET_COUNT_FOR_SPELL INT_CONVERT               8
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SWARM                 32
        DO SET_BUCKET_COUNT_FOR_SPELL INT_INVISIBILITY          40
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SHIELD                48
        DO SET_BUCKET_COUNT_FOR_SPELL INT_LAND_BRIDGE           66
        DO SET_BUCKET_COUNT_FOR_SPELL INT_LIGHTNING             64
        DO SET_BUCKET_COUNT_FOR_SPELL INT_HYPNOTISM             70
        DO SET_BUCKET_COUNT_FOR_SPELL INT_TORNADO               72
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SWAMP                 80
        DO SET_BUCKET_COUNT_FOR_SPELL INT_FLATTEN               100
        DO SET_BUCKET_COUNT_FOR_SPELL INT_EARTHQUAKE            140
        DO SET_BUCKET_COUNT_FOR_SPELL INT_EROSION               168
        DO SET_BUCKET_COUNT_FOR_SPELL INT_FIRESTORM             320
        DO SET_BUCKET_COUNT_FOR_SPELL INT_ANGEL_OF_DEATH        408
        DO SET_BUCKET_COUNT_FOR_SPELL INT_VOLCANO               640
      }
      ELSE
      {
        DO SET_BUCKET_USAGE                      ON
        DO SET_BUCKET_COUNT_FOR_SPELL INT_BLAST                 4
        DO SET_BUCKET_COUNT_FOR_SPELL INT_CONVERT               4
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SWARM                 16
        DO SET_BUCKET_COUNT_FOR_SPELL INT_INVISIBILITY          20
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SHIELD                24
        DO SET_BUCKET_COUNT_FOR_SPELL INT_LAND_BRIDGE           33
        DO SET_BUCKET_COUNT_FOR_SPELL INT_LIGHTNING             32
        DO SET_BUCKET_COUNT_FOR_SPELL INT_HYPNOTISM             35
        DO SET_BUCKET_COUNT_FOR_SPELL INT_TORNADO               36
        DO SET_BUCKET_COUNT_FOR_SPELL INT_SWAMP                 40
        DO SET_BUCKET_COUNT_FOR_SPELL INT_FLATTEN               50
        DO SET_BUCKET_COUNT_FOR_SPELL INT_EARTHQUAKE            70
        DO SET_BUCKET_COUNT_FOR_SPELL INT_EROSION               84
        DO SET_BUCKET_COUNT_FOR_SPELL INT_FIRESTORM             180
        DO SET_BUCKET_COUNT_FOR_SPELL INT_ANGEL_OF_DEATH        204
        DO SET_BUCKET_COUNT_FOR_SPELL INT_VOLCANO               320
      }
      ENDIF
    }
    EVERY 8
    {
      IF ( INT_GAME_TURN > 65 )
      {
        IF ( $1 == 0 )
        {
          SET $1                                  1
          DO FLYBY_CREATE_NEW
          DO FLYBY_ALLOW_INTERRUPT                OFF
          DO FLYBY_SET_EVENT_POS                  212 218 2 40
          DO FLYBY_SET_EVENT_POS                  42 204 43 50
          DO FLYBY_SET_EVENT_POS                  50 6 100 55
          DO FLYBY_SET_EVENT_POS                  74 232 200 40
          DO FLYBY_SET_EVENT_POS                  232 254 250 69
          DO FLYBY_SET_EVENT_ANGLE                1048 1 30
          DO FLYBY_SET_EVENT_ANGLE                321 32 35
          DO FLYBY_SET_EVENT_ANGLE                601 68 20
          DO FLYBY_SET_EVENT_ANGLE                1922 89 50
          DO FLYBY_SET_EVENT_ANGLE                306 150 25
          DO FLYBY_SET_EVENT_ANGLE                730 176 35
          DO FLYBY_SET_EVENT_ANGLE                1098 225 20
          DO FLYBY_SET_EVENT_ANGLE                1114 250 35
          DO FLYBY_SET_EVENT_ANGLE                224 290 31
          DO FLYBY_SET_EVENT_ZOOM                 -60 0 30
          DO FLYBY_SET_EVENT_ZOOM                 10 31 50
          DO FLYBY_SET_EVENT_ZOOM                 -80 150 40
          DO FLYBY_SET_EVENT_ZOOM                 0 191 100
          DO FLYBY_SET_END_TARGET                 232 254 224 0
          DO FLYBY_START
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 8 1
    {
      IF ( $2 == 0 )
      {
        IF ( INT_GAME_TURN > 120 )
        {
          DO TRIGGER_THING                        3
          SET $2                                  1
        }
        ENDIF
      }
      ELSE
      {
        IF ( $2 == 1 )
        {
          IF ( INT_GAME_TURN > 135 )
          {
            DO TRIGGER_THING                       1
            SET $2                                 2
          }
          ENDIF
        }
        ELSE
        {
          IF ( $2 == 2 )
          {
            IF ( INT_GAME_TURN > 140 )
            {
              DO TRIGGER_THING                      0
              SET $2                                3
            }
            ENDIF
          }
          ELSE
          {
            IF ( $2 == 3 )
            {
              IF ( INT_GAME_TURN > 142 )
              {
                DO TRIGGER_THING                     4
                SET $2                               4
              }
              ENDIF
            }
            ELSE
            {
              IF ( $2 == 4 )
              {
                IF ( INT_GAME_TURN > 145 )
                {
                  DO TRIGGER_THING                    2
                  SET $2                              5
                }
                ENDIF
              }
              ELSE
              {
                IF ( $2 == 5 )
                {
                  IF ( INT_GAME_TURN > 184 )
                  {
                    DO TRIGGER_THING                   8
                    SET $2                             6
                  }
                  ENDIF
                }
                ELSE
                {
                  IF ( $2 == 6 )
                  {
                    IF ( INT_GAME_TURN > 204 )
                    {
                      DO TRIGGER_THING                  9
                      SET $2                            7
                    }
                    ENDIF
                  }
                  ELSE
                  {
                    IF ( $2 == 7 )
                    {
                      IF ( INT_GAME_TURN > 225 )
                      {
                        DO TRIGGER_THING                 10
                        SET $2                           8
                      }
                      ENDIF
                    }
                    ELSE
                    {
                      IF ( $2 == 8 )
                      {
                        IF ( INT_GAME_TURN > 226 )
                        {
                          DO TRIGGER_THING                7
                          SET $2                          9
                        }
                        ENDIF
                      }
                      ELSE
                      {
                        IF ( $2 == 9 )
                        {
                          IF ( INT_GAME_TURN > 308 )
                          {
                            DO TRIGGER_THING               11
                            SET $2                         10
                          }
                          ENDIF
                        }
                        ELSE
                        {
                          IF ( $2 == 10 )
                          {
                            IF ( INT_GAME_TURN > 330 )
                            {
                              DO TRIGGER_THING              12
                              SET $2                        11
                            }
                            ENDIF
                          }
                          ELSE
                          {
                            IF ( $2 == 11 )
                            {
                              IF ( INT_GAME_TURN > 335 )
                              {
                                DO TRIGGER_THING             5
                                SET $2                       12
                              }
                              ENDIF
                            }
                            ELSE
                            {
                              IF ( $2 == 12 )
                              {
                                IF ( INT_GAME_TURN > 375 )
                                {
                                  DO TRIGGER_THING            13
                                  SET $2                      13
                                }
                                ENDIF
                              }
                              ELSE
                              {
                                IF ( $2 == 13 )
                                {
                                  IF ( INT_GAME_TURN > 390 )
                                  {
                                    DO TRIGGER_THING           14
                                    SET $2                     14
                                  }
                                  ENDIF
                                }
                                ELSE
                                {
                                  IF ( $2 == 14 )
                                  {
                                    IF ( INT_GAME_TURN > 425 )
                                    {
                                      DO TRIGGER_THING          15
                                      SET $2                    15
                                    }
                                    ENDIF
                                  }
                                  ENDIF
                                }
                                ENDIF
                              }
                              ENDIF
                            }
                            ENDIF
                          }
                          ENDIF
                        }
                        ENDIF
                      }
                      ENDIF
                    }
                    ENDIF
                  }
                  ENDIF
                }
                ENDIF
              }
              ENDIF
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 512 44
    {
      IF ( $7 == 0 )
      {
        DO STATE_SPELL_DEFENCE                   84 210 ON
        SET $7                                   1
      }
      ELSE
      {
        IF ( $7 == 1 )
        {
          DO STATE_SPELL_DEFENCE                  42 216 ON
          SET $7                                  2
        }
        ELSE
        {
          IF ( $7 == 2 )
          {
            DO STATE_SPELL_DEFENCE                 32 234 ON
            SET $7                                 3
          }
          ELSE
          {
            IF ( $7 == 3 )
            {
              DO STATE_SPELL_DEFENCE                34 208 ON
              SET $7                                4
            }
            ELSE
            {
              IF ( $7 == 4 )
              {
                DO STATE_SPELL_DEFENCE               14 210 ON
                SET $7                               0
              }
              ENDIF
            }
            ENDIF
          }
          ENDIF
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 512 13
    {
      DO GET_HEAD_TRIGGER_COUNT 4 222 $3
      IF ( $3 < 1 )
      {
        IF ( $6 == 0 )
        {
          DO SET_ATTACK_VARIABLE                  $0
          SET $5                                  INT_M_PERSON_WARRIOR
          INCREMENT $5 INT_M_PERSON_FIREWARRIOR
          DO ATTACK BLUE $5 ATTACK_BUILDING INT_NO_SPECIFIC_BUILDING 999 INT_LIGHTNING INT_LIGHTNING INT_SWARM ATTACK_NORMAL 0 -1 -1 0
          SET $6                                  1
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 512 11
    {
      IF ( $6 == 1 && $0 != 0 )
      {
        IF ( $0 > 50 )
        {
          SET $6                                  0
        }
        ENDIF
      }
      ENDIF
    }
    EVERY 64 55
    {
      SET $8                                    INT_M_BUILDING_MEDIUM_HUT
      INCREMENT $8 INT_M_BUILDING_SMALL_HUT
      INCREMENT $8 INT_M_BUILDING_LARGE_HUT
      IF ( INT_MY_NUM_PEOPLE < 8 && INT_MY_NUM_KILLED_BY_BLUE > 5 )
      {
        IF ( $8 == 0 )
        {
          DO GIVE_UP_AND_SULK                     ON
        }
        ENDIF
      }
      ENDIF
    }
  }
  ENDIF
}
SCRIPT_END
