-- timer for the delayed creation of the eagles
TIMER_EAGLES = new_timer
{
        ["enabled"] = FALSE,
        ["delay"] = 10,
        ["callback"] = function()
                local i, y, x
                local eagle = test_monster_name("Great eagle")

                -- place 8 eagles in a radius 6 zone around (10,10)
                for i = 1, 8 do
                        y, x = find_position(10, 10)
                        place_monster_one(y, x, eagle, 0, FALSE, MSTATUS_FRIEND)
                end
                msg_print("The Eagles! The Eagles are coming!")

                -- no more eagles
                TIMER_EAGLES.enabled = FALSE
        end,
}

save_timer("TIMER_EAGLES")

-- start the timer after creating the Bridge of Khazad-dum in Moria
function gen_eagles()

-- this tests for level 50 in Moria
-- I'm not sure how to test the special level name
-- perhaps with get_dungeon_name() ? The following does not work

-- local str = "012345678901234567890"
-- get_dungeon_name(str)
-- if (str == "Bridge") then

        if (current_dungeon_idx == 22) and (dun_level == 50) then
                TIMER_EAGLES.enabled = TRUE
                TIMER_EAGLES.delay = 10
        end
end

add_hook_script(HOOK_LEVEL_END_GEN, "gen_eagles", "gen_eagles")

Modules/Hobbit/script (last edited 2004-10-15 20:21:12 by MassimilianoMarangio)