#textdomain wesnoth-Genesis
[scenario]
    id=08_Impetus
    name= _ "Impetus"
    map_data="{~add-ons/Genesis/episode1/maps/08_Impetus.map}"
    next_scenario=09_Blackout
    victory_when_enemies_defeated=no
    turns=-1

    {EXTENDED_TIME3}
    current_time=8

    {SCENARIO_MUSIC loyalists.ogg}
    {EXTRA_SCENARIO_MUSIC casualties_of_war.ogg}
    {EXTRA_SCENARIO_MUSIC battle.ogg}
    {EXTRA_SCENARIO_MUSIC the_city_falls.ogg}
    {EXTRA_SCENARIO_MUSIC siege_of_laurelmor.ogg}
    {FAE_DEATHS2}
    {STORYTXT_IMPETUS}

    [side]
        {PLAYER_FAE}
        {FULL_RECRUIT_LIST}
        side=1
        {GOLD 350 275 150}
        facing=sw
        shroud=yes
    [/side]

    [side]
        {HUMAN_ENEMY}
        type=General
        id=humanleader82
        generate_name=yes
        canrecruit=yes
        side=2
        recruit=Swordsman,Pikeman,Javelineer,Longbowman,Dragoon
        {GOLD 200 275 400}
        {INCOME 8 12 20}
        facing=e
        [ai]
            aggression=0.75
            caution=0.25
        [/ai]
    [/side]

    [side]
        {HUMAN_ENEMY}
        type=General
        id=humanleader83
        generate_name=yes
        canrecruit=yes
        side=3
        recruit=Swordsman,Pikeman,Javelineer,Longbowman,Dragoon
        {GOLD 200 275 400}
        {INCOME 8 12 20}
        facing=ne
        [ai]
            aggression=0.75
            caution=0.25
        [/ai]
    [/side]

    [side]
        {ETHEA_ENEMY_SIDE}
        no_leader=yes
        side=4
        hidden=yes
        {GOLD 200 275 400}
        income=-2
        recruit=Demon Fiend,Demon Berserker,Red Demon,Fire Demon,Blood Imp,Demonic Hound
        [ai]
            leader_aggression=1
            aggression=1
            caution=0
            grouping=false
            [goal]
                [criteria]
                    side=5
                [/criteria]
                value=-1000
            [/goal]
        [/ai]
    [/side]

    [side]
        {YUURE_SIDE}
        team_name=etheademon
        side=5
        hidden=yes
        defeat_condition=always
        [ai]
            aggression=1
            caution=0
            grouping=false
            [goal]
                [criteria]
                    side=4
                [/criteria]
                value=-1000
            [/goal]
        [/ai]
    [/side]

#define GENERATE_HILL
    [store_locations]
        variable=grass_hex
        terrain=Gg
        [and]
            x,y=37,8
            radius=11
            [or]
                x,y=43,7
                radius=7
            [/or]
            [or]
                x,y=35,2
                radius=5
            [/or]
        [/and]
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..15
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Hh
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
    [store_locations]
        variable=grass_hex
        terrain=Gg
        [filter_adjacent_location]
            terrain=Hh
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..13
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Hh
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
#enddef

#define GENERATE_FOREST
    [store_locations]
        variable=grass_hex
        terrain=Gg
        [and]
            x,y=33,12
            radius=14
            [or]
                x,y=43,11
                radius=9
            [/or]
            [or]
                x,y=25,1
                radius=5
            [/or]
        [/and]
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..2100
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=40
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=43
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=40
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=49
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=46
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fms
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=70
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=50
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=71
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=72
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fms
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
    [store_locations]
        variable=grass_hex
        terrain=Gg
        [filter_adjacent_location]
            terrain=G*^F*,Hh^F*
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..450
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=40
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=53
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=40
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=66
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=53
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fms
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=75
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=66
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fdf
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=84
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=75
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs^Fmf
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=95
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=85
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=99
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=95
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=103
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=99
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fms
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=106
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=103
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fdf
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=109
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=106
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Fmf
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
    [store_locations]
        variable=hill_hex
        terrain=Hh
    [/store_locations]
    [for]
        array=hill_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..150
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=10
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=11
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=12
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fms
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE hill_hex}
    [store_locations]
        variable=hill_hex
        terrain=Hh
        [filter_adjacent_location]
            terrain=Hh^Fms,Hh^Fda,Hh^Fp
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=hill_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..150
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fp
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=5
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fds
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=6
                [/variable]
                [then]
                    [terrain]
                         x,y=$hill_hex[$i].x,$hill_hex[$i].y
                        terrain=Hh^Fms
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE hill_hex}
#enddef

#define GENERATE_VILLAGE
    [store_locations]
        variable=grass_hex
        terrain=Gg
        [not]
            [filter_adjacent_location]
                terrain=G*^V*,G*^F*,G*
                [and]
                    [filter_adjacent_location]
                        terrain=G*^V*,G*^F*
                    [/filter_adjacent_location]
                [/and]
            [/filter_adjacent_location]
        [/not]
        [not]
            [filter_adjacent_location]
                terrain=G*^V*,G*^F*,C*
            [/filter_adjacent_location]
        [/not]
        [not]
            x=0,46
            [or]
                y=0,36
            [/or]
        [/not]
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..130
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=3
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Vh
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=3
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Vc
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=4
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Vwm
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=6
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gg^Vct
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
    [store_locations]
        variable=forest_hex
        terrain=G*^F*
        [not]
            [filter_adjacent_location]
                terrain=G*^V*,G*,C*
            [/filter_adjacent_location]
        [/not]
        [not]
            x=0,46
            [or]
                y=0,36
            [/or]
        [/not]
    [/store_locations]
    [for]
        array=forest_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..40
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$forest_hex[$i].x,$forest_hex[$i].y
                        terrain=Gs^Ve
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE forest_hex}
#enddef

#define GENERATE_GRASS
    [store_locations]
        variable=grass_hex
        terrain=Gg
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..800
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=30
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=34
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=30
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gd
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=50
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gll
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=55
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Re
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
            [/for]
        {CLEAR_VARIABLE grass_hex}
        [store_locations]
            variable=grass_hex
            terrain=Gg
            [filter_adjacent_location]
                terrain=Gs
            [/filter_adjacent_location]
        [/store_locations]
        [for]
            array=grass_hex
            [do]
            [set_variable]
                name=change_terrain
                rand=1..50
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=10
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=13
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=10
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gd
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=15
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gll
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=20
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Re
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
    [store_locations]
        variable=grass_hex
        terrain=Gg
        [filter_adjacent_location]
            terrain=Gd
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..50
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    less_than=10
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    less_than=13
                [/variable]
                [and]
                    [variable]
                        name=change_terrain
                        greater_than=10
                    [/variable]
                [/and]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gd
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=15
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gll
                    [/terrain]
                [/then]
            [/if]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=20
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Re
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
    [store_locations]
        variable=grass_hex
        terrain=Gg
        [filter_adjacent_location]
            terrain=G*^F*
            count=4,5,6
        [/filter_adjacent_location]
    [/store_locations]
    [for]
        array=grass_hex
        [do]
            [set_variable]
                name=change_terrain
                rand=1..5
            [/set_variable]
            [if]
                [variable]
                    name=change_terrain
                    numerical_equals=1
                [/variable]
                [then]
                    [terrain]
                         x,y=$grass_hex[$i].x,$grass_hex[$i].y
                        terrain=Gs
                    [/terrain]
                [/then]
            [/if]
            {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE grass_hex}
#enddef

#define GENERATE_TEXTURE
    [store_locations]
        variable=floor_hex
        terrain=*
        [and]
            [filter_adjacent_location]
                terrain=*^F*
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=floor_hex
        [do]
        [set_variable]
            name=change_terrain
            rand=1..24
        [/set_variable]
        [if]
            [variable]
                name=change_terrain
                numerical_equals=1
            [/variable]
            [then]
                [terrain]
                    x,y=$floor_hex[$i].x,$floor_hex[$i].y
                    layer=overlay
                    terrain=^Em
                [/terrain]
            [/then]
        [/if]
        {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE floor_hex}
    [store_locations]
        variable=floor_hex
        terrain=*
        [and]
            [filter_adjacent_location]
                terrain=*^F*
                count=3-6
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=floor_hex
        [do]
        [set_variable]
            name=change_terrain
            rand=1..60
        [/set_variable]
        [if]
            [variable]
                name=change_terrain
                numerical_equals=1
            [/variable]
            [then]
                [terrain]
                    x,y=$floor_hex[$i].x,$floor_hex[$i].y
                    layer=overlay
                    terrain=^Emf
                [/terrain]
            [/then]
        [/if]
        {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE floor_hex}
    [store_locations]
        variable=floor_hex
        terrain=G*
        [not]
            [filter_adjacent_location]
                terrain=*^F*
            [/filter_adjacent_location]
        [/not]
    [/store_locations]
    [for]
        array=floor_hex
        [do]
        [set_variable]
            name=change_terrain
            rand=1..32
        [/set_variable]
        [if]
            [variable]
                name=change_terrain
                numerical_equals=1
            [/variable]
            [then]
                [terrain]
                    x,y=$floor_hex[$i].x,$floor_hex[$i].y
                    layer=overlay
                    terrain=^Gvs
                [/terrain]
            [/then]
        [/if]
        {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE floor_hex}
    [store_locations]
        variable=floor_hex
        terrain=G*
    [/store_locations]
    [for]
        array=floor_hex
        [do]
        [set_variable]
            name=change_terrain
            rand=1..16
        [/set_variable]
        [if]
            [variable]
                name=change_terrain
                numerical_equals=1
            [/variable]
            [then]
                [terrain]
                    x,y=$floor_hex[$i].x,$floor_hex[$i].y
                    layer=overlay
                    terrain=^Efm
                [/terrain]
            [/then]
        [/if]
        {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE floor_hex}
    [store_locations]
        variable=floor_hex
        terrain=G*
        [and]
            [filter_adjacent_location]
                terrain=*^F*
            [/filter_adjacent_location]
        [/and]
    [/store_locations]
    [for]
        array=floor_hex
        [do]
        [set_variable]
            name=change_terrain
            rand=1..12
        [/set_variable]
        [if]
            [variable]
                name=change_terrain
                numerical_equals=1
            [/variable]
            [then]
                [terrain]
                    x,y=$floor_hex[$i].x,$floor_hex[$i].y
                    layer=overlay
                    terrain=^Efm
                [/terrain]
            [/then]
        [/if]
        {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE floor_hex}
    [store_locations]
        variable=floor_hex
        terrain=G*,R*,H*
    [/store_locations]
    [for]
        array=floor_hex
        [do]
        [set_variable]
            name=change_terrain
            rand=1..16
        [/set_variable]
        [if]
            [variable]
                name=change_terrain
                numerical_equals=1
            [/variable]
            [then]
                [terrain]
                    x,y=$floor_hex[$i].x,$floor_hex[$i].y
                    layer=overlay
                    terrain=^Es
                [/terrain]
            [/then]
        [/if]
        {CLEAR_VARIABLE change_terrain}
        [/do]
    [/for]
    {CLEAR_VARIABLE floor_hex}
#enddef

    [event]
        name=prestart
        {GENERATE_HILL}
        {REPEAT 2 ({GENERATE_FOREST})}
        {GENERATE_HILL}
        {REPEAT 2 ({GENERATE_FOREST})}
        {GENERATE_HILL}
        {REPEAT 5 ({GENERATE_FOREST})}
        {REPEAT 2 ({GENERATE_VILLAGE})}
        {REPEAT 3 ({GENERATE_GRASS})}
        {GENERATE_TEXTURE}
        {GENERATE_TEXTURE}
        [remove_shroud]
            side=1
        [/remove_shroud]
        [set_variable]
            name=blue_spawns
            value=0
        [/set_variable]
        [set_variable]
            name=fire_spawns
            value=0
        [/set_variable]
        {CAPTURE_VILLAGES 1 39 8 10}
    [/event]

    [event]
        name=start
        [message]
            speaker=humanleader83
            message= _ "So here we are, the forest of Ethiel. We shall have to take them by surprise before they can-"
        [/message]
        [message]
            speaker=Esther
            message= _ "<i>Humans? Ah, generals. Hmm, this doesn't look too good.</i> Generals! Can I help you?"
        [/message]
        [message]
            speaker=humanleader82
            message= _ "(<i>whispers</i>) Perhaps we can reason with them. A direct confrontation would not be preferable."
        [/message]
        [message]
            speaker=humanleader83
            message= _ "Yes, you may. By the order of the king, all faerie are to leave the Northlands immediately. We have orders to consolidate Caerleon's power in this land to maintain the security and order of our kingdom. You faerie have been deemed to be a threat to our lands, and we will not tolerate your presence. We are asking you to leave to avoid unnecessary bloodshed."
        [/message]
        [message]
            speaker=Esther
            message= _ "... Excuse me, did I hear that right? You want us to leave? We were just in Caerleon about a month ago, and nothing was said to us then."
        [/message]
        [message]
            speaker=humanleader82
            message= _ "The order was given four days ago. We are merely here to carry out the king's demands, not to question him."
        [/message]
        [message]
            speaker=Esther
            message= _ "We haven't even done anything to you! We certainly don't mean to try to usurp the king's power or to harm you in any way. We've only ever tried to help you."
        [/message]
        [message]
            speaker=humanleader83
            message= _ "It is not our place to disobey our liege's orders. Will you leave? It will make everything easier. No battle will have to be fought if you do."
        [/message]
        [unit]
            x,y=40,8
            type=Lieutenant
            id=supporter8
            generate_name=yes
            side=1
            [modifications]
                {TRAIT_LOYAL}
                {TRAIT_STRONG}
            [/modifications]
            animate=yes
            facing=sw
        [/unit]
        [message]
            speaker=supporter8
            message= _ "Excuse me, generals, but I can vouch for the faerie as well. They have only been pleasant and accommodating thus far. I was not even informed of such an order-"
        [/message]
        [message]
            speaker=humanleader82
            message= _ "Be silent! Our second order was to detain all those who have defected and joined the faerie. Resist and you will be executed! Come with us, and you may yet be allowed to live."
        [/message]
        [message]
            speaker=supporter8
            message= _ "That seems unreasonable-"
        [/message]
        [message]
            speaker=humanleader83
            message= _ "It is also not your place to question his majesty's orders. I would add that, in this regard, he has the support of the council of magi. You would do well to surrender yourselves to us. This decision will not be overturned."
        [/message]
        {RECALL_ARYEL_NOLOC}
        [message]
            speaker=Aryel
            message= _ "What in blazes is going on- oh. Oh, I see. (<i>frowns</i>) So that's how it is."
        [/message]
        [message]
            speaker=humanleader82
            message= _ "Do not resist! We will not hesitate to kill you if we must!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Oh, reaaallly. Come on, then. I'd like to see you try."
        [/message]
        [message]
            speaker=supporter8
            message= _ "(<i>whispers</i>) I do not mean to offend, but it would be best if we could avoid fighting them..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yeah, right. Look, it seems like the leadership in your kingdom suddenly just went off the deep end. Not just your king, but his generals and the mage council too. You sure you want to just go back to them and follow all their crazy orders?"
        [/message]
        [message]
            speaker=supporter8
            message= _ "(<i>whispers</i>) Well..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "No, you don't. And don't think for a moment that they present a real threat to us. You hear that? We're going to fight. And you better bet that we're not the ones who should be afraid."
        [/message]
        [message]
            speaker=humanleader82
            message= _ "V-very well. Fair warning was given. It seems like there is no alternative..."
        [/message]
        [message]
            speaker=Esther
            message= _ "Aryel, there are quite a few of them."
        [/message]
        [message]
            speaker=Aryel
            message= _ "So? They can't take us."
        [/message]
        [message]
            speaker=Esther
            message= _ "Even if they could, it's not that. A slaughter would be bad."
        [/message]
        [message]
            speaker=Aryel
            message= _ "So? Do you think we have a choice? Would you rather us abandon the other faerie instead?"
        [/message]
        [message]
            speaker=Esther
            message= _ "No, but we could do as they ask and try to find a new home- well..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "See? Even you think that's a terrible idea. Besides, something's fishy about this whole situation. I've got a feeling that someone is manipulating them, just like with the Urdemons. We might be able to figure something out if we can capture one of them."
        [/message]
        [message]
            speaker=Esther
            message= _ "I suppose you're right. Where's Yumi by the way?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Hmm. Good question."
        [/message]

        [store_unit]
            [filter]
                id=Yumi
            [/filter]
            variable=yumi
        [/store_unit]
        [kill]
            id=Yumi
        [/kill]
        [set_variable]
            name=fire_spawns2
            value=0
        [/set_variable]

        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Defeat all enemy leaders")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Esther")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Aryel")}
            {OBJECTIVE_FULL_CARRYOVER}
        [/objectives]
    [/event]

    [event]
        name=turn 3
        [message]
            speaker=Aryel
            message= _ "(<i>mutters</i>) Seriously, where is this girl?"
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>whispers</i>) Sleeping? She's usually nocturnal, like you."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>whispers</i>) She's usually awake by now. It's already dusk."
        [/message]
        [message]
            speaker=Esther
            message= _ "It's fine. We should keep her out of this anyway, if we can."
        [/message]
        [message]
            speaker=Aryel
            message= _ "I would like that too, but that's not what's bothering me. Yumi's usually a light sleeper. This noise probably would have woken her. And it's not like her to just ditch us at the first sign of trouble."
        [/message]
        [message]
            speaker=Esther
            message= _ "She usually tries to find somewhere quiet to sleep. That, or she throws up barriers around herself. Or are you worried that something's happened to her?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Like I said, someone's probably manipulating these humans into attacking us. What if it's that same person controlling the Urdemons and trying to get at us a different way?"
        [/message]
        [message]
            speaker=Esther
            message= _ "But demons would be more effective since they're actually dangerous..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "True, but this could be some kind of plot."
        [/message]
        [message]
            speaker=Esther
            message= _ "A diversion? To confuse us so that person can get to Yumi? Maybe we should check on her."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Problem is, we have a fight on our hands right now..."
        [/message]
    [/event]

    [event]
        name=attack
        first_time_only=yes
        [filter]
            side=2,3
        [/filter]

        [message]
            speaker=humanleader83
            message= _ "Now we shall see how powerful you faerie really are."
        [/message]
        [message]
            speaker=Aryel
            message= _ "More than a match for you."
        [/message]
    [/event]
    [event]
        name=last breath
        first_time_only=yes
        [filter]
            side=2,3
        [/filter]
        [filter_second]
            id=Aryel
        [/filter_second]

        [message]
            speaker=unit
            message= _ "W-wait, please-"
        [/message]
        [message]
            speaker=Aryel
            message= _ "And why should I do that?"
        [/message]
        [message]
            speaker=unit
            message= _ "I-I'm only a lowly foot soldier. I have nothing to do with this-"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Right, like I'm going to take that as an excuse. Even if your superiors are the ones giving orders, you lot are the ones carrying them out in the end."
        [/message]
        [message]
            speaker=unit
            message= _ "But-"
        [/message]
        [message]
            speaker=Aryel
            message= _ "No buts. Bye bye!"
        [/message]
    [/event]
    [event]
        name=last breath
        first_time_only=yes
        [filter]
            side=2,3
        [/filter]
        [filter_second]
            id=Esther
        [/filter_second]

        [message]
            speaker=unit
            message= _ "Mercy!"
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>frowns</i>) Why should I spare you?"
        [/message]
        [message]
            speaker=unit
            message= _ "I-I have a family. And children. Please, I didn't want to fight you. But the generals-"
        [/message]
        [message]
            speaker=Esther
            message= _ "Yet here you are, fighting against us right now."
        [/message]
        [message]
            speaker=unit
            message= _ "I-I am sorry. Please..."
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>sighs</i>) What else can I do? Go, leave."
        [/message]
        [message]
            speaker=unit
            message= _ "T-thank you."
        [/message]
        [kill]
            id=unit
        [/kill]
        [message]
            speaker=Aryel
            message= _ "You've got some guts, Esther. That, or you're an idiot."
        [/message]
        [message]
            speaker=Esther
            message= _ "Some of both, I suppose."
        [/message]
    [/event]

    [event]
        name=turn 6
        [message]
            speaker=Aryel
            message= _ "Esther, I... really should go see if she's okay."
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>frowns</i>) We really should, but... you said it yourself. We kind of need you here too."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yes, but what if she needs us? I really don't want anything to happen to her. You know Yumi can't handle herself."
        [/message]
        [message]
            speaker=Esther
            message= _ "But what about everyone else?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>whispers</i>) Bah, I don't care about them!"
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>whispers</i>) You don't really mean that."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>whispers</i>) I... well..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "But-"
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>sighs</i>) I guess you're right. Ugh. Sometimes it feels like..."
        [/message]
        [message]
            speaker=Esther
            message= _ "It feels like what, Aryel?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "It feels like we don't try hard enough. I don't know. I just don't know how to deal with her."
        [/message]
        [message]
            speaker=Esther
            message= _ "We'll figure it out, and even she knows you <i>really</i> like her. But right now, we have a problem right in front of us that we have to deal with."
        [/message]
        [message]
            speaker=Aryel
            message= _ "I guess so..."
        [/message]
    [/event]

    [event]
        name=turn 7
        [message]
            speaker=Aryel
            message= _ "Damn it, Yumi. Where are you?"
        [/message]
        [message]
            speaker=Esther
            message= _ "Calm down, Aryel. Sheesh. You're only going to make yourself more stressed the more you think about it."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Rrgh."
        [/message]
    [/event]

    [event]
        name=turn 9
        [unstore_unit]
            variable=yumi
            x,y=42,3
            find_vacant=yes
        [/unstore_unit]
        {CLEAR_VARIABLE yumi}
        [message]
            speaker=Yumi
            message= _ "(<i>blinks</i>)"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yumi! Where in the world were you?! Do you have any idea how- how worried I was..."
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>tilts head</i>)"
        [/message]
        [message]
            speaker=Esther
            message= _ "Shhh, shhh. Relax, she didn't do anything wrong. Aryel was just concerned for your safety."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>grumbles</i>) Was not."
        [/message]
        [message]
            speaker=Esther
            message= _ "Right. You totally weren't freaking out at all."
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>stares at humans</i>)"
        [/message]
        [message]
            speaker=Esther
            message= _ "Yumi, it might be best if you go back to sleep. We can handle this."
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>shudders</i>)"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yes, you should go. It's just a bunch of humans, anyway. Not a big deal."
        [/message]
        {DELAY 1500}
        [message]
            speaker=Aryel
            message= _ "Or not. Are you even paying attention?"
        [/message]
        {DELAY 1000}
        [message]
            speaker=Aryel
            message= _ "Damn it, Yumi."
        [/message]
        [message]
            speaker=Esther
            message= _ "Just let her be."
        [/message]
    [/event]
    [event]
        name=turn 11
        [message]
            speaker=Yumi
            message= _ "(<i>looks around</i>)"
        [/message]
        [message]
            speaker=Esther
            message= _ "What is it?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "I guess she thinks that someone's coming? Enemies, probably, given our luck."
        [/message]
        [message]
            speaker=Esther
            message= _ "What kind of enemies?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "I don't know. I can't sense anything. Probably just Yumi being typical, neurotic Yumi. Or maybe not. Who knows, really."
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>sulks</i>)"
        [/message]
    [/event]
    [event]
        name=turn 13
        first_time_only=yes
        [replace_schedule]
            {MIDNIGHT}
        [/replace_schedule]
        [message]
            speaker=Esther
            message= _ "Is it just me or does this night seem longer than usual?"
        [/message]
        {DELAY 500}
        {PLAY_SOUND "explosion.ogg"}
        {DELAY 500}
        [message]
            speaker=Aryel
            message= _ "Hmm."
        [/message]
        {QUAKE_FIXED "rumble.ogg"}
        {PLAY_SOUND "dragonstick.ogg"}
        {DELAY 550}
        {QUAKE_FIXED "rumble.ogg"}
        {PLAY_SOUND "lightning.ogg"}
        {DELAY 550}
        [message]
            speaker=Aryel
            message= _ "It's not just you. What the hell is going on?"
        [/message]
        {DELAY 550}
        {PLAY_SOUND "lightning.ogg"}
        {DELAY 550}
        {QUAKE_FIXED "rumble.ogg"}
        {PLAY_SOUND "explosion.ogg"}
        {DELAY 550}
        {PLAY_SOUND "lightning.ogg"}
        {QUAKE_FIXED "rumble.ogg"}
        {DELAY 1000}
        [message]
            speaker=Esther
            message= _ "You're asking me."
        [/message]
        {DELAY 750}
        {REPEAT 3 ({PLAY_SOUND "melee-fire.ogg"})}
        [unit]
            side=4
            id=demonleader8
            generate_name=yes
            type=Demon Hellion
            random_traits=yes
            canrecruit=yes
            animate=yes
            facing=nw
            x,y=40,31
        [/unit]
        [terrain]
            x,y=40,31
            radius=1
            terrain=Urb^Cov
        [/terrain]
        [terrain]
            x,y=40,31
            terrain=Urb^Kov
        [/terrain]
        [redraw][/redraw]
        {DELAY 1000}
        [message]
            speaker=Esther
            message= _ "Oh boy. And now a bunch of demons show up. Can things get any worse?"
        [/message]
        [message]
            speaker=humanleader83
            message= _ "Demons too? I didn't sign up for this..."
        [/message]
        [message]
            speaker=humanleader82
            message= _ "... this may be somewhat of a problem to deal with."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>grimaces</i>) 'Somewhat of a problem'. This is really starting to get troublesome..."
        [/message]
        [modify_side]
            side=4
            {INCOME 20 25 35}
        [/modify_side]
        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Defeat all enemy leaders")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Esther")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Yumi")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Aryel")}
            {OBJECTIVE_FULL_CARRYOVER}
            {OBJECTIVE_NOTE ( _ "Be very careful around Fiends and Berserkers.")}
        [/objectives]
    [/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=4
            [filter_location]
                terrain=G*^F*
            [/filter_location]
        [/filter]
        [terrain]
            x=$x1
            y=$y1
            terrain=Rd
        [/terrain]
        [redraw][/redraw]
    [/event]
    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=4
            [filter_location]
                terrain=G*^V*
            [/filter_location]
        [/filter]
        [store_locations]
            variable=village_hex
            x,y=$x1,$y1
            terrain=G*^V*
        [/store_locations]
        {PLAY_SOUND "torch.ogg"}
        [for]
            array=village_hex
            [do]
                 [terrain]
                    x=$village_hex[$j].x
                    y=$village_hex[$j].y
                    terrain=Rd
                 [/terrain]
            [/do]
        [/for]
        [redraw][/redraw]
        {CLEAR_VARIABLE village_hex}
    [/event]

    [event]
        name=turn 15
        {FLASH_DARK (
            {DELAY 750}
            [place_shroud]
                [filter_location]
                [/filter_location]
                side=1
            [/place_shroud]
            [modify_side]
                side=1
                fog=yes
            [/modify_side]
            [redraw]
                side=1
                clear_shroud=yes
            [/redraw]
            {DELAY 750}
        )}
        [message]
            speaker=Aryel
            message= _ "Ugh. Now what?"
        [/message]
        {DELAY 350}
        {PLAY_SOUND "wail.wav"}
        {DELAY 500}
        [modify_unit]
            [filter]
                id=Aryel
            [/filter]
            facing=sw
        [/modify_unit]
        {PLAY_SOUND "wail.wav"}
        {DELAY 550}
        [modify_unit]
            [filter]
                id=Aryel
            [/filter]
            facing=se
        [/modify_unit]
        {PLAY_SOUND "wail-sml.wav"}
        {DELAY 550}
        {PLAY_SOUND "wail.wav"}
        {DELAY 550}
        [modify_unit]
            [filter]
                id=Aryel
            [/filter]
            facing=sw
        [/modify_unit]
        {PLAY_SOUND "wail.wav"}
        {DELAY 550}
        [modify_unit]
            [filter]
                id=Aryel
            [/filter]
            facing=se
        [/modify_unit]
        {PLAY_SOUND "wail-sml.wav"}
        {DELAY 750}
        [message]
            speaker=Esther
            message= _ "Uh."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>mimicking Esther</i>) Can things get any worse? You just had to ask it. Now look at what you've done."
        [/message]
        [message]
            speaker=Esther
            message= _ "The universe just hates me, huh."
        [/message]
        {DELAY 750}
        {PLAY_SOUND "wail.wav"}
        {DELAY 550}
        {PLAY_SOUND "wail-sml.wav"}
        {DELAY 550}
        {PLAY_SOUND "wail.wav"}
        {DELAY 750}
        [store_unit]
            [filter]
                id=Aryel
            [/filter]
            variable=aryel
        [/store_unit]
        {SPAWN_NOID ("Demon Apparition","Demon Dreamwalker") 5 $aryel.x $aryel.y}
        {DELAY 750}
        [message]
            speaker=Aryel
            message= _ "(<i>steps back</i>) No, it apparently hates me."
        [/message]
        {DELAY 750}
        {SPAWN_NOID ("Demon Apparition","Demon Dreamwalker") 5 $aryel.x $aryel.y}
        {SPAWN_NOID ("Demon Apparition","Demon Dreamwalker") 5 $aryel.x $aryel.y}
        {DELAY 750}
        [message]
            speaker=Aryel
            message= _ "Girls, I could use a little help here."
        [/message]
        {DELAY 750}
        {SPAWN_NOID ("Demon Apparition","Demon Dreamwalker") 5 $aryel.x $aryel.y}
        {SPAWN_NOID ("Demon Apparition","Demon Dreamwalker") 5 $aryel.x $aryel.y}
        {DELAY 750}
        [message]
            speaker=Aryel
            message= _ "Umm, please?"
        [/message]
        [message]
            speaker=Esther
            message= _ "One second, I'm coming!"
        [/message]
        {FLASH_DARK (
            {DELAY 1000}
            [message]
                speaker=Esther
                message= _ "Where are you?"
            [/message]
            [message]
                speaker=Aryel
                message= _ "Right here. Might want to hurry up before they start tearing me apart-"
            [/message]
            {DELAY 500}
            [kill]
                side=5
            [/kill]
            {DELAY 750}
        )}
        [message]
            speaker=Aryel
            message= _ "Or... not?"
        [/message]
        [message]
            speaker=Esther
            message= _ "You okay?"
        [/message]
        [message]
            speaker=Aryel
            message= _ "I guess. They just disappeared."
        [/message]
        [message]
            speaker=Esther
            message= _ "Ugh, those pesky blue monsters again. We should stick together. Don't get separated."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yeah, and don't get surrounded. (<i>shivers</i>)"
        [/message]
        {CLEAR_VARIABLE aryel}
        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Defeat all enemy leaders")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Esther")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Yumi")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Aryel")}
            {OBJECTIVE_FULL_CARRYOVER}
            {OBJECTIVE_NOTE ( _ "Be very careful around Fiends and Berserkers.")}
        [/objectives]
        [set_variable]
            name=blue_spawns
            value=1
        [/set_variable]
    [/event]

    #ifdef HARD
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 2 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 2 ("blue_spawns")}
    #endif
    #ifdef NORMAL
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 5 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 5 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 5 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 5 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 5 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 5 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 5 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 5 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 3 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 3 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 3 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 3 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 3 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 3 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 3 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 3 ("blue_spawns")}
    #endif
    #ifdef EASY
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 7 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 7 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 7 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 7 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 7 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 7 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 7 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Demon Apparition","Demon Dreamwalker") 5 1 45 1 35 7 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 4 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 4 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 4 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 4 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 4 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 4 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 4 ("blue_spawns")}
        {RESPAWN_POINT_CONDITIONAL_RANDOM ("Blue Demon") 5 1 45 1 35 4 ("blue_spawns")}
    #endif
    [event]
        name=new turn
        first_time_only=no
        [store_unit]
            [filter]
                side=5
            [/filter]
            variable=bluedemons
        [/store_unit]
        [for]
            array=bluedemons
            [do]
                [set_variable]
                    name=kill_unit
                    rand=1..4
                [/set_variable]
                [if]
                    [variable]
                        name=kill_unit
                        numerical_equals=1
                    [/variable]
                    [then]
                        [kill]
                            x,y=$bluedemons[$i].x,$bluedemons[$i].y
                        [/kill]
                    [/then]
                [/if]
                {CLEAR_VARIABLE kill_unit}
            [/do]
        [/for]
        {CLEAR_VARIABLE bluedemons}
    [/event]

    [event]
        name=attack
        first_time_only=yes
        [filter]
            side=4
            race=demon
        [/filter]
        [filter_second]
            side=2,3
        [/filter_second]

        [message]
            speaker=unit
            message= _ "Filthy humans. Die!"
        [/message]
        [message]
            speaker=second_unit
            message= _ "Aieee!"
        [/message]
    [/event]
    [event]
        name=attack
        first_time_only=yes
        [filter]
            side=4
            race=demon
        [/filter]
        [filter_second]
            side=1
        [/filter_second]

        [message]
            speaker=unit
            message= _ "Burn!"
        [/message]
        [message]
            speaker=Esther
            message= _ "Get back! Be careful!"
        [/message]
    [/event]
    [event]
        name=last breath
        first_time_only=yes
        [filter]
            id=humanleader82
        [/filter]
        [message]
            speaker=unit
            message= _ "I-I knew this was a bad idea."
        [/message]
        [message]
            speaker=Esther
            message= _ "Then why did you do it?"
        [/message]
        [message]
            speaker=unit
            message= _ "The... king's orders... are absolute..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Yeah, right. And what would happen if you were to disobey?"
        [/message]
        [message]
            speaker=unit
            message= _ "I- I- just..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Answer the question. Why did you attack us? And why would your king order you to attack us?"
        [/message]
        [message]
            speaker=unit
            message= _ "I- don't-"
        [/message]
        {FLASH_RED_EXTREME ({DELAY 250})}
        [message]
            speaker=Aryel
            message= _ "Well?"
        [/message]
        [message]
            speaker=unit
            message= _ "Please-"
        [/message]
        {FLASH_RED_EXTREME ({DELAY 250})}
        [message]
            speaker=Aryel
            message= _ "Talk."
        [/message]
        [message]
            speaker=Esther
            message= _ "Aryel, that's cruel."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Shush. I'm trying to get answers."
        [/message]
        [message]
            speaker=Esther
            message= _ "By prolonging his death? Aryel, that's-"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Whatever. Fine. I'll just let him die then."
        [/message]
        [fire_event]
            name=turn 13
        [/fire_event]
    [/event]
    [event]
        name=last breath
        first_time_only=yes
        [filter]
            id=humanleader83
        [/filter]

        [message]
            speaker=unit
            message= _ "No! Why are you doing this?"
        [/message]
        [message]
            speaker=Esther
            message= _ "Why are we killing you? How about, why are you attacking us?"
        [/message]
        [message]
            speaker=unit
            message= _ "Because... because they told us to!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "And who might 'they' be?"
        [/message]
        [message]
            speaker=unit
            message= _ "T-them. Just them. I cannot say anymore. I don't-"
        [/message]
        {FLASH_RED_EXTREME ({DELAY 250})}
        [message]
            speaker=Aryel
            message= _ "Spill your guts."
        [/message]
        [message]
            speaker=unit
            message= _ "No!"
        [/message]
        [message]
            speaker=Aryel
            message= _ "Fine, then I'll do it for you."
        [/message]
        [fire_event]
            name=turn 13
        [/fire_event]
    [/event]
    [event]
        name=turn 17
        [message]
            speaker=Yumi
            message= _ "(<i>flinches</i>)"
        [/message]
        [message]
            speaker=Aryel
            message= _ "It's getting warmer."
        [/message]
        [message]
            speaker=Esther
            message= _ "Don't look at me. That's not my fault."
        [/message]
        [message]
            speaker=Aryel
            message= _ "That's what I'm worried about."
        [/message]
        [message]
            speaker=Esther
            message= _ "So even more of them are coming, huh."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Maybe. We'll just have to see."
        [/message]
    [/event]
    [event]
        name=turn 19
        first_time_only=yes
        {QUAKE_FIXED "rumble.ogg"}
        [message]
            speaker=Aryel
            message= _ "Let me guess..."
        [/message]
        {DELAY 500}
        {QUAKE_FIXED "rumble.ogg"}
        [unit]
            side=4
            id=boss1
            generate_name=yes
            type=Demon Harbinger
            random_traits=yes
            canrecruit=yes
            animate=yes
            facing=nw
            x,y=40,31
        [/unit]
        [unit]
            side=4
            id=boss2
            generate_name=yes
            type=Demon Harbinger
            random_traits=yes
            canrecruit=yes
            animate=yes
            facing=nw
            x,y=40,31
        [/unit]
        [message]
            speaker=boss1
            message= _ "The air is rife with the scent of charred flesh."
        [/message]
        [message]
            speaker=boss2
            message= _ "So it seems. The Yuure ones are here as well. This battle shall be a massacre."
        [/message]
        [message]
            speaker=boss1
            message= _ "Let us put them out of their misery."
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>whispers</i>) More demons! And ones who are actually talking properly! That's new."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>mutters</i>) Hmph. Nice to meet you too. You guys are really friendly. Think we'd be best friends if I wasn't about to kill you."
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>whispers</i>) It's not just the two of them... I think they brought friends."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>grumbles</i>) Whatever. Won't make much of a difference."
        [/message]

        [set_variable]
            name=fire_spawns
            value=1
        [/set_variable]
        [objectives]
            {OBJECTIVE_VICTORY  ( _ "Defeat all enemy leaders")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Esther")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Yumi")}
            {OBJECTIVE_DEFEAT  ( _ "Death of Aryel")}
            {OBJECTIVE_FULL_CARRYOVER}
            {OBJECTIVE_NOTE ( _ "Be very careful around Fiends and Berserkers.")}
            {OBJECTIVE_NOTE ( _ "Finish the enemy leaders as quickly as possible before you are overwhelmed (turn 27 recommended).")}
        [/objectives]
    [/event]
    [event]
        name=turn 27
        [set_variable]
            name=fire_spawns2
            value=1
        [/set_variable]
    [/event]

    {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 38 30 2 ("fire_spawns2")}
    {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 42 30 2 ("fire_spawns2")}
    {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 40 33 2 ("fire_spawns2")}
    {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 38 32 2 ("fire_spawns2")}
    {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 42 32 2 ("fire_spawns2")}
    {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 40 29 2 ("fire_spawns2")}

    #ifdef HARD
        {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 38 30 3 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 42 30 3 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 40 33 3 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 38 32 3 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 42 32 3 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 40 29 3 ("fire_spawns")}
    #endif
    #ifdef NORMAL
        {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 38 30 6 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 42 30 4 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 40 33 4 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 38 32 4 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 42 32 6 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 40 29 4 ("fire_spawns")}
    #endif
    #ifdef EASY
        {RESPAWN_POINT_CONDITIONAL ("Demon Stormbringer") 4 38 30 6 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 42 30 5 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 40 33 5 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 38 32 5 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 42 32 5 ("fire_spawns")}
        {RESPAWN_POINT_CONDITIONAL ("Demon Zephyr") 4 40 29 5 ("fire_spawns")}
    #endif

    [event]
        name=last breath
        first_time_only=yes
        [filter]
            id=boss1
        [/filter]

        [message]
            speaker=unit
            message= _ "So they were not as weak as we presumed..."
        [/message]
        [kill]
            id=boss1
        [/kill]
        [message]
            speaker=Esther
            message= _ "Damn, she just disappeared. Probably got away."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Pff. Coward's way out."
        [/message]
        [message]
            speaker=Esther
            message= _ "I was more thinking that we got no information from her."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>shrugs</i>) Not like they'd talk easily anyway. The ones back in that crypt killed themselves before we could even do anything."
        [/message]
        [message]
            speaker=Esther
            message= _ "True."
        [/message]
    [/event]
    [event]
        name=last breath
        first_time_only=yes
        [filter]
            id=boss2
        [/filter]
        [message]
            speaker=unit
            message= _ "You claim the victory this time, but more shall come."
        [/message]
        [kill]
            id=boss2
        [/kill]
        [message]
            speaker=Aryel
            message= _ "Blah blah blah. Looks like they're all talk, but don't have anything to show. Least she could've done is provide more of a challenge."
        [/message]
        [message]
            speaker=Esther
            message= _ "(<i>sighs</i>) Bloodthirsty to the last."
        [/message]
        [message]
            speaker=Aryel
            message= _ "(<i>smirks</i>) Whatever."
        [/message]
    [/event]
    [event]
        name=last breath
        first_time_only=yes
        [filter]
            id=demonleader8
        [/filter]
        [message]
            speaker=unit
            message= _ "..."
        [/message]
        [message]
            speaker=Esther
            message= _ "Who sent you here?"
        [/message]
        [message]
            speaker=unit
            message= _ "..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Speak, or else-"
        [/message]
        [message]
            speaker=unit
            message= _ "(<i>silence</i>)"
        [/message]
        [kill]
            id=demonleader8
            animate=yes
        [/kill]
        [message]
            speaker=Aryel
            message= _ "Or... he can do that. Stupid demons, can't get any information from them."
        [/message]
        [fire_event]
            name=turn 19
        [/fire_event]
    [/event]
    [event]
        name=enemies defeated

        [message]
            speaker=Esther
            message= _ "So that's it then. The rest of them are fleeing."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Great. Still doesn't explain why the humans suddenly decided to attack us. Or those two demons actually talking this time."
        [/message]
        [message]
            speaker=Esther
            message= _ "I wonder if it's possible that some of them are attacking us of their own free will? Besides that, I'm thinking these blue demons or whatever that one called them are manipulating the humans."
        [/message]
        [message]
            speaker=Aryel
            message= _ "It would make sense. The humans' attitude toward us wouldn't change that drastically in such a short period. But it's kind of hard to know for sure unless we go digging around in Caerleon. That would basically mean muscling our way in."
        [/message]
        [message]
            speaker=Esther
            message= _ "And what about the demons? Those huge ones seemed to be acting freely."
        [/message]
        [message]
            speaker=Aryel
            message= _ "But the other one clearly wasn't. This whole thing is a mess and I haven't a clue what's going on. (<i>looks at Yumi</i>)"
        [/message]
        [message]
            speaker=Yumi
            message= _ "(<i>frowns</i>)"
        [/message]
        [message]
            speaker=Aryel
            message= _ "And for the record, Xia'el didn't show up. She wasn't kidding about ditching us."
        [/message]
        [message]
            speaker=Esther
            message= _ "I wonder if something's happened to her."
        [/message]
        [message]
            speaker=Aryel
            message= _ "Doubt it. The Guardians wouldn't go so far as to seriously attack each other..."
        [/message]
        [message]
            speaker=Aryel
            message= _ "... would they?"
        [/message]
        [message]
            speaker=Esther
            message= _ "At this point, your guess is as good as mine."
        [/message]

        [endlevel]
            result=victory
            {NEW_GOLD_CARRYOVER 100}
            next_scenario=09_Blackout
        [/endlevel]
    [/event]

    [event]
        name=victory
        {CLEAR_VARIABLE fire_spawns}
        {CLEAR_VARIABLE fire_spawns2}
        {CLEAR_VARIABLE blue_spawns}
    [/event]
[/scenario]

#undef GENERATE_HILL
#undef GENERATE_FOREST
#undef GENERATE_VILLAGE
#undef GENERATE_GRASS
#undef GENERATE_TEXTURE