• Announcement:
    In order to download VIP files, you need to UPGRADE your account.

Not answered quest core dumped

Member
Sep
Threads
2
66
2
8
HubMoney
152
Shadow devil tower [Full Quest] [Dungeon no logo]

Hey forum family!

I couldn't run the "quests" in this thread. Could you help?

duiy2rs.png


ShadowZone_enter.lua;
C++:
quest Valentine2021_enter begin
    state start begin
        when 9376.chat."The story" with not ShadowZoneLIB.isActive() begin
            addimage(25, 10, "shadowzone_bg1.tga"); say_title(string.format("[ENTER][ENTER][ENTER]%s:[ENTER]", mob_name(npc.get_race())));
            
            say("We fight with demons in Devil's tower or Devil catacombs for years.[ENTER]But something much darker has awake.[ENTER]There is another world. Deep in shadow. Forgotten[ENTER]corridors of old Kingdoms we know only from rumors.")
            
            wait()
            addimage(25, 10, "shadowzone_bg1.tga"); say_title(string.format("[ENTER][ENTER][ENTER]%s:[ENTER]", mob_name(npc.get_race())));
            
            say("There aren't many of us who survived.[ENTER]Most of them are stuck in there forever.[ENTER]If we wont fight, the shadow will take control[ENTER]of most places on earth.")
        end
            
        when 9376.chat."Shadow tower" with not ShadowZoneLIB.isActive() begin
            local settings = ShadowZoneLIB.Settings();

            addimage(25, 10, "shadowzone_bg1.tga");
            say("[ENTER][ENTER]")
            say_title(string.format("%s:[ENTER]", mob_name(npc.get_race())))
            say_reward("Do you really want to enter the dungeon?")
            
            if (select("Yes!", "No") == 1) then
                if ShadowZoneLIB.checkEnter() then
                    ShadowZoneLIB.CreateDungeon();
                end
            end
        end
    end
end

ShadowZone_zone.lua;
C++:
define FIRST_STONE 8494
define SECOND_STONE 8495
define THIRD_STONE 8496
define FOURTH_STONE 8499
define FIFTH_STONE 8497
define SIXTH_STONE 8498

define GATE_NPC 9382
define FIRST_SEAL 9377
define FIRST_STATUE 9378
define SECOND_STATUE 9379
define THIRD_STATUE 9380
define FOURTH_STATUE 9381
define FIRST_PILLAR 9383
define SECOND_PILLAR 9384
define THIRD_PILLAR 9385
define CHEST 9386

define SIXTH_BOSS 4387
define FINAL_BOSS 4388

define FIRST_KEY 30845
define SECOND_KEY 30846
define THIRD_KEY 30847
define ITEM_SOUL 30848
define DEMON_EYE 30849
define ITEM_AMULET 30850
define ITEM_MAIN_REWARD 30854
define ITEM_KEY_REWARD 30855
define ITEM_SMALL_REWARD 30856

quest ShadowZone_zone begin
    state start begin
        when login with ShadowZoneLIB.isActive() begin
            local settings = ShadowZoneLIB.Settings();           
            local OutsidePosition = settings["outside_pos"]           

            if (party.is_party() and party.is_leader() or not party.is_party()) then
                
                local FirstFloorTimer = settings["timer_first_floor"];
                
                d.setf("ShadowZone_floor", 1);                       
                d.setf("ShadowZone_FirstStone", 1);                       
                d.setf("ShadowZone_floor1_timer", FirstFloorTimer);                       
                d.setf("ShadowZone_nocool_timer", 1);                       
                
                d.set_warp_location(settings["outside_index"], OutsidePosition[1], OutsidePosition[2]);
                
                d.set_regen_file(settings["regen_file"].."regen_1a.txt");
                d.regen_file(settings["regen_file"].."regen_1b.txt");
                
                d.notice(string.format("Torre de las sombras: Destruye todos los %s! Tienes un tiempo limitado! Apresurate!", mob_name(FIRST_STONE)));
                
                ShadowZoneLIB.setCoolTimer();           
                
                server_timer("ShadowZone_FirstFloor", FirstFloorTimer, d.get_map_index())
            end
        end
                
        ------------
        ---Players destroy first stone (3x), after that, timer is cleared and set another for jump them to next floor
        ------------
        when FIRST_STONE.kill with ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 1 begin
            local settings = ShadowZoneLIB.Settings();           
            local KILL_COUNT = settings["FIRST_STONE_COUNT"]
            local n = d.getf("ShadowZone_FirstStone_count") + 1
            
            d.setf("ShadowZone_FirstStone_count", n)
            
            if n >= KILL_COUNT then
            
                ShadowZoneLIB.clearDungeon()               
                clear_server_timer("ShadowZone_FirstFloor", d.get_map_index());
                
                d.setf("ShadowZone_FirstStone", 0);
                ShadowZoneLIB.clearCoolTimer();
                
                d.notice(string.format("Torre sombria: %s fue revelado! Puedes pasar al siguiente piso!", mob_name(GATE_NPC)));
                ShadowZoneLIB.spawnPortalGate()
            end
        end

        -----
        --Server timer to check if the stones (8494) are destroyed, if not, dungeon is ended
        -----
        when ShadowZone_FirstFloor.server_timer begin
            if d.select(get_server_timer_arg()) then
                if d.getf("ShadowZone_FirstStone") == 1 then
                    d.notice("Torre de las sombras: Se acabo el tiempo. Fallaste!")
                    
                    d.exit_all()
                end
            end
        end

        -----
        --Killing wave of monsters to get a key (2x)
        -----
        when kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 2 and d.getf("ShadowZone_2f_KillMonsters") == 1 begin
            local settings = ShadowZoneLIB.Settings();       
            d.setf("ShadowZone_2f_KillCount", n)
            
            if pc.get_x() > 17729 and pc.get_y() > 22951 and pc.get_x() < 17932 and pc.get_y() < 23140 then               
                
                if n >= KILL_COUNT then
                    game.drop_item(FIRST_KEY, 1)
                    
                    d.setf("ShadowZone_2f_KillCount", 0)
                    d.setf("ShadowZone_2f_KillMonsters", 0)
                end
            end
        end
        
        -----
        --Destroying 2 Shadow seals to spawn a frist boss (4382)
        -----
        when FIRST_SEAL.take with item.get_vnum() == FIRST_KEY and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 2 and d.getf("ShadowZone_2f_KillMonsters") == 0 begin
            local settings = ShadowZoneLIB.Settings();
            local Position = settings["first_boss_pos"]
            
            item.remove()
            npc.kill()
            
            if d.getf("ShadowZone_2f_Seal") == 2 then
            
                ShadowZoneLIB.clearDungeon()
                d.notice(string.format("Torre de las sombras: %s se acerca!", mob_name(FIRST_BOSS)))
                
                d.spawn_mob(FIRST_BOSS, Position[1], Position[2])
            else
                d.notice(string.format("Torre de las sombras: Mata la segunda ola de monstruos para destruir el segundo %s!", mob_name(FIRST_SEAL)))
                
                d.setf("ShadowZone_2f_KillMonsters", 1);
                d.setf("ShadowZone_2f_Seal", 2);
                d.regen_file(settings["regen_file"].."regen_2a.txt");
            end
        end
        
        -----
        --Server timer to check if the stones (8494) are destroyed, if not, dungeon is ended
        -----
        when ShadowZone_SecondFloor.server_timer begin
            if d.select(get_server_timer_arg()) then
                    
                    d.exit_all()
                end
            end
        end
        
        -----
        -- Players kill the first boss (4382), after that, server timer for jump to next floor is set
        -----
        when FIRST_BOSS.kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 2 begin
            local settings = ShadowZoneLIB.Settings();
            
            clear_server_timer("ShadowZone_SecondFloor", d.get_map_index());
            ShadowZoneLIB.clearCoolTimer();
            
            ShadowZoneLIB.spawnPortalGate();
            
            d.notice(string.format("Torre de las sombras:%s fue revelado! Puedes pasar al siguiente piso!", mob_name(GATE_NPC)));
        end
        
        -----
        --Players destroying stones in third floor. 4 of them are fake, one is real
        -----
            local settings = ShadowZoneLIB.Settings();
            local n = d.getf("ShadowZone_wrong_count_f") + 1
            
            if npc.get_vid() == d.get_unique_vid("real") then
                ShadowZoneLIB.clearDungeon()
                ShadowZoneLIB.clearDungeon()
                
                d.notice("Torre de las sombras: Has destruido la piedra correcta!")
                d.notice(string.format("Torre de las sombras: %s fue revelado! Puedes pasar al siguiente piso!", mob_name(GATE_NPC)));
                
                ShadowZoneLIB.spawnPortalGate()
            else
                d.setf("ShadowZone_wrong_count_f", n);   
                
                d.notice("Torre de las sombras: Este era solo una ilusion!")
            end
        end
                
        -----
        --Killing wave of monsters to get a key (30846 - 3x)
        -----
        when kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 4 and d.getf("ShadowZone_4f_KillMonsters") == 1 begin
            local settings = ShadowZoneLIB.Settings();       
            local KILL_COUNT = settings["KILL_COUNT_4_FLOOR"];
            local n = d.getf("ShadowZone_4f_KillCount") + 1
            
            d.setf("ShadowZone_4f_KillCount", n)
            
            if pc.get_x() > 17353 and pc.get_y() > 22626 and pc.get_x() < 17511 and pc.get_y() < 22740 then               
                
                if n >= KILL_COUNT then
                    game.drop_item(SECOND_KEY, 1)
                    
                    d.setf("ShadowZone_4f_KillCount", 0)
                    d.setf("ShadowZone_4f_KillMonsters", 0)
                end
            end
        end
        

        -----
        -- Building a Statue of reaper (9378, 9379, 9380, 9381)
        -----
        when FIRST_STATUE.take with item.get_vnum() == SECOND_KEY and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 4 and d.getf("ShadowZone_4f_KillMonsters") == 0 begin
            local settings = ShadowZoneLIB.Settings();
            local StatuePosition = settings["reaper_statue_pos"]
            item.remove()
            npc.kill()
            
            
            d.setf("ShadowZone_4f_KillMonsters", 1);
            
            d.spawn_mob_dir(THIRD_STATUE, StatuePosition[1], StatuePosition[2], StatuePosition[3]);
            d.regen_file(settings["regen_file"].."regen_4a.txt");
        end
                
        when THIRD_STATUE.take with item.get_vnum() == SECOND_KEY and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 4 and d.getf("ShadowZone_4f_KillMonsters") == 0 begin
            local settings = ShadowZoneLIB.Settings();
            local StatuePosition = settings["reaper_statue_pos"]
            local BossPosition = settings["second_boss_pos"]
            
            ShadowZoneLIB.clearDungeon()
            
            item.remove()
            npc.kill()
            
            d.spawn_mob_dir(FOURTH_STATUE, StatuePosition[1], StatuePosition[2], StatuePosition[3]);
            
            ---- Shadow reaper spawn (HP are depending on negative points collected in third floor from destroying fake stones)
            d.set_unique("ShadowReaper", d.spawn_mob(SECOND_BOSS, BossPosition[1], BossPosition[2]))
            
            if d.getf("ShadowZone_wrong_count_f") == 1 then
                d.unique_set_maxhp("ShadowReaper", settings["REAPER_HP_3"])
            elseif d.getf("ShadowZone_wrong_count_f") == 4 then
                d.unique_set_maxhp("ShadowReaper", settings["REAPER_HP_4"])
            else
                return
            end
        end
                
        -----
        -- Players kill the second boss (4383), they drop a key (30847) to destroy Statue of reaper (9381)
        -----
        when SECOND_BOSS.kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 4 begin
            game.drop_item(THIRD_KEY, 1);
            
            
            d.setf("ShadowZone_4f_CanDesSta", 1)
            
            d.notice(string.format("Torre de las sombras: Bien hecho! Ahora destruye el %s para poder continuar!", mob_name(FIRST_STATUE)));           
        end
        
        -----
        -- Players destroy statue of reaper (9381), then Shadow gate is spawned and players can proceed to next floor
        -----
        when FOURTH_STATUE.take with item.get_vnum() == THIRD_KEY and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 4 and d.getf("ShadowZone_4f_CanDesSta") == 1 begin
            clear_server_timer("ShadowZone_FourthFloor", d.get_map_index());
            ShadowZoneLIB.clearCoolTimer();
            
            
            ShadowZoneLIB.clearDungeon();
            
            d.notice("Torre de las sombras: Gran trabajo! Procederas en unos segundos!")
            
            d.spawn_mob(GATE_NPC, pc.get_local_x(), pc.get_local_y());
        end
        
        -----
        --Server timer to check if the stones (8494) are destroyed, if not, dungeon is ended
        -----
        when ShadowZone_FifthFloor.server_timer begin
            if d.select(get_server_timer_arg()) then
                d.notice("Torre de las sombras: El tiempo ha terminado. Fallaste!")
                    
                d.exit_all()
            end
        end
        
        -----
        --Players destroy a statue in sixth floor (8499)
        -----
        when FOURTH_STONE.kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 6 begin
            d.setf("ShadowZone_PillarActive", 0);
            
            d.notice(string.format("Torre de las sombras: La proteccion de %s se ha ido. Puedes matarlo ahora!", mob_name(FOURTH_BOSS)));
        end
        
        -----
        --Players kill Azrael boss, if the statue is not destroyed yet, boss will spawned again
                d.set_item_group("ShadowZone_6F_ticket", 1, ITEM_SOUL, 1)
                
                d.notice(string.format("Torre de las sombras: %s fue revelado! Puedes pasar al siguiente piso!", mob_name(GATE_NPC)));
                
                ShadowZoneLIB.spawnPortalGate()
            end
        end
        
        -----
        --Players can not die in the dungeon
        -----
        when dead with ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 6 begin
            d.notice("Torre de las sombras: You died. You have failed.")
            
            d.exit_all()
        end
        -----
        --Server timer to check if the fourth boss (Azrael) is killed
        -----
        when ShadowZone_SixthFloor.server_timer begin
            if d.select(get_server_timer_arg()) then
                d.notice("Torre de las sombras: El tiempo ha terminado. Fallaste!")
                    
                d.exit_all()
            end
        end
        
        -----
        --Players destroy a 8x stone in 7th floor, after that, boss is spawned
        -----
        when FIFTH_STONE.kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 7 begin
            local settings = ShadowZoneLIB.Settings();
            local KILL_COUNT = settings["FIFTH_STONE_COUNT"]
            local n = d.getf("ShadowZone_7th_stone") + 1               
            
        end
        --Destrying pillar (3 phases - 9383-9385) at 8 floor
        -----
        when FIRST_PILLAR.take with item.get_vnum() == DEMON_EYE and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 8 and d.getf("ShadowZone_8F_Pillar") == 1 begin
            local settings = ShadowZoneLIB.Settings();
            local PillarPos = settings["pillar2_pos"]
            
            d.setf("ShadowZone_8F_Pillar", 2);
            d.setf("ShadowZone_8F_Drop", 1);
            
            item.remove()
            npc.kill()
            
            d.spawn_mob_dir(SECOND_PILLAR, PillarPos[1],  PillarPos[2],  PillarPos[3])
        end
        
        when SECOND_PILLAR.take with item.get_vnum() == DEMON_EYE and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 8 and d.getf("ShadowZone_8F_Pillar") == 2 begin
            local settings = ShadowZoneLIB.Settings();
            local PillarPos = settings["pillar2_pos"]
            d.spawn_mob_dir(THIRD_PILLAR, PillarPos[1],  PillarPos[2],  PillarPos[3])
        end
        
        when THIRD_PILLAR.take with item.get_vnum() == DEMON_EYE and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 8 and d.getf("ShadowZone_8F_Pillar") == 3 begin
            local settings = ShadowZoneLIB.Settings();
            server_timer("ShadowZone_SixthBoss_spawner", Time, d.get_map_index())
        end
        
        -----
        --Players can use amulet to spawn the sixth boss with less HP.
        -----       
        when ITEM_AMULET.use with ShadowZoneLIB.isActive() begin
            local AmuletSetting = d.getf("ShadowZone_CanUseAmulet")
            
            if AmuletSetting == 1 then        --- Players can use the amulet       
                item.remove();           
                d.setf("ShadowAmuletIsActive", 2);
                
                d.notice(string.format("Shadow zone: %s ya esta activo! %s sera mucho mas debil!", item_name(ITEM_AMULET), mob_name(SIXTH_BOSS)));
                
            elseif AmuletSetting == 2 then        ---- Players already used the amulet, so the effect is already active       
                d.notice("Torre de las sombras: Este efecto ya esta activo!");
                
            else        --- Players are in last floor, or the boss is already spawned
                d.notice("Torre de las sombras: Puedes usar esto solo durante los primeros 8 pisos!");
            end
        end
                
        -----
        --Server timer to spawn a sixth boss (4387)
        -----
        when ShadowZone_SixthBoss_spawner.server_timer begin
            if d.select(get_server_timer_arg()) then
                local settings = ShadowZoneLIB.Settings();
                local BossPosition = settings["sixth_boss_pos"]
                local ShadowAmuletIsActive = d.getf("ShadowAmulet")
            
                d.setf("ShadowZone_CanUseAmulet", 0)
                d.set_unique("SixthBoss", d.spawn_mob(SIXTH_BOSS, BossPosition[1], BossPosition[2]))
                
                if ShadowAmuletIsActive == 1 then
                    d.unique_set_maxhp("SixthBoss", settings["ABBADON_HP_SMALL"])
                else
                    d.unique_set_maxhp("SixthBoss", settings["ABBADON_HP_NORMAL"])
                end
                d.setf("ShadowZone_9f_StoneD", 0)
                
            else
                d.setf("ShadowZone_9f_StoneFail", 1)
            end               
        end
        
        -----
        --Server timer to spawn a fifth boss (4386)
        -----
        when ShadowZone_NinethFloor_1.server_timer begin
            if d.select(get_server_timer_arg()) then
                if d.getf("ShadowZone_9f_StoneD") == 1 then
                    d.setf("ShadowZone_9f_StoneD", 0)
                end
            end
        end
        
    -----
        --Server timer to spawn another wave of monsters
        -----
        when ShadowZone_NinethFloor_2.server_timer begin
            if d.select(get_server_timer_arg()) then
                local settings = ShadowZoneLIB.Settings();
                
                d.regen_file(settings["regen_file"].."regen_9a.txt");
            end
        end
        
        -----
        --Server timer to spawn random boss from previous stages
        -----
        when ShadowZone_NinethFloor_3.server_timer begin
                ShadowZoneLIB.spawnRandomBoss();
        end
            
        -----
        --Server timer to check if the boss is killed or not
        -----
        when ShadowZone_FinalBoss_kill.server_timer begin
            if d.select(get_server_timer_arg()) then
                if d.getf("ShadowZone_FinalBoss") == 1 then
                    d.notice("Torre de las sombras: El tiempo ha terminado. Fallaste");
                    d.exit_all()
                end
            end
        end
        
        -----
        --Players kill Final boss (4388), after that, chest is spawned
        -----
        when FINAL_BOSS.kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 9 and d.getf("ShadowZone_FinalBoss") == 1 begin
            local settings = ShadowZoneLIB.Settings();
            local Position = settings["chest_pos"]
            local TimeToExit = settings["time_to_final_exit"]
            local minutes = math.floor(TimeToExit / 60)
            
            ShadowZoneLIB.clearDungeon();
            ShadowZoneLIB.setReward();
            
            clear_server_timer("ShadowZone_FinalBoss_kill", d.get_map_index());
            ShadowZoneLIB.clearCoolTimer();
            
            d.setf("ShadowZone_FinalBoss", 0);
            d.setf("ShadowZone_CanTakeReward", 1);
            
            d.notice("Torre de las sombras: Seras teletransportado fuera de la mazmorra en %s minutos.", minutes);
            d.notice("Torre de las sombras: Ahora puedes tomar tu recompensa!");
            
            d.spawn_mob_dir(CHEST, Position[1], Position[2], Position[3]);
            
            server_timer("ShadowZone_Final_Exit", TimeToExit, d.get_map_index());
        end
        
        
        -----
        --Players can take reward from the chest
        -----   
        when CHEST.chat."Take reward" with ShadowZoneLIB.isActive() and d.getf("ShadowZone_CanTakeReward") == 1 begin
            setskin(NOWINDOW);
            
            if d.getf(string.format("player_%d_reward_state", pc.get_player_id())) == 1 then
                pc.give_item2(ITEM_MAIN_REWARD, 1);
                
                d.setf(string.format("player_%d_reward_state", pc.get_player_id()), 0);   
            else
                syschat("Torre de las sombras: Ya te llevaste la recompensa!")
            end
        end
        
        -----
        --Players can put key (30855) to the chest and take another smaller reward
        -----   
        when CHEST.take with item.get_vnum() == ITEM_KEY_REWARD and ShadowZoneLIB.isActive() and d.getf("ShadowZone_CanTakeReward") == 1 begin
            item.remove()
            pc.give_item2(ITEM_SMALL_REWARD, 1)
                d.setf("ShadowZone_2f_KillMonsters", 1);
                d.setf("ShadowZone_2f_Seal", 1);
                
                d.regen_file(settings["regen_file"].."regen_2a.txt");
                d.regen_file(settings["regen_file"].."regen_2b.txt");
                
                d.notice(string.format("Torre de las sombras: Destruye ambos %s! Destruye todos los monstruos para obtener una llave.!", mob_name(FIRST_SEAL)));
                
                d.jump_all(Position_2[1], Position_2[2])
                
                ShadowZoneLIB.setCoolTimer();
                server_timer("ShadowZone_SecondFloor", SecondFloorTimer, d.get_map_index())
            
            ---- Set and jump 3rd floor
            elseif Floor == 2 then
                local Position_3 = settings["pos_3_floor"]
                
                setskin(NOWINDOW);
                npc.purge();
                
                d.setf("ShadowZone_floor", 3);
                
                ShadowZoneLIB.spawnSecondStone();
                
                d.notice(string.format("Torre de las sombras: Encuentra %s real y destruyelo!", mob_name(SECOND_STONE)));
                d.notice(string.format("Torre de las sombras: Cada piedra equivocada esconde %s adentro!", mob_name(FIRST_BOSS)));
                d.notice("Torre de las sombras: Cuantas mas piedras falsas destruyas, mas HP tendra un proximo jefe.!");
                
                ShadowZoneLIB.noCoolTimer();
                
                d.jump_all(Position_3[1], Position_3[2])
                            
            ---- Set and jump 4th floor
            elseif Floor == 3 then
                local Position_4 = settings["pos_4_floor"]
                local FourthFloorTimer = settings["timer_fourth_floor"]
                
                setskin(NOWINDOW);
                npc.purge();
                
                d.setf("ShadowZone_floor", 4);
                d.setf("ShadowZone_4f_KillMonsters", 1);
                
                d.spawn_mob_dir(FIRST_STATUE, StatuePosition[1], StatuePosition[2], StatuePosition[3]);
                d.regen_file(settings["regen_file"].."regen_4a.txt");
                
                d.jump_all(Position_4[1], Position_4[2])
                
                d.notice(string.format("Torre de las sombras: Mata a todos los monstruos para obtener %s, luego comienza a construir un %s", item_name(SECOND_KEY), mob_name(FIRST_STATUE)));
                
                ShadowZoneLIB.setCoolTimer();
                
                server_timer("ShadowZone_FourthFloor", FourthFloorTimer, d.get_map_index())
            
            ---- Set and jump 5th floor
            elseif Floor == 4 then
                local Position_5 = settings["pos_5_floor"]
                local FifthFloorTimer = settings["timer_fifth_floor"]
                
                setskin(NOWINDOW);
                npc.purge();
                
                d.setf("ShadowZone_floor", 5);
                
                ShadowZoneLIB.spawnThirdStone();
                d.set_regen_file(settings["regen_file"].."regen_5a.txt");
                
                d.jump_all(Position_5[1], Position_5[2])
                
                ShadowZoneLIB.setCoolTimer();
                server_timer("ShadowZone_FifthFloor", FifthFloorTimer, d.get_map_index())
            
            ---- Set and jump 6th floor
            elseif Floor == 5 then
                local Position_6 = settings["pos_6_floor"]
                local PillarPos = settings["fourth_stone_pos"]
                local BossPos = settings["fourth_boss_pos"]
                local SixthFloorTimer = settings["timer_sixth_floor"]
                
                setskin(NOWINDOW);
                npc.purge();
                                    
                d.setf("ShadowZone_floor", 6);
                d.setf("ShadowZone_PillarActive", 1);
                
                d.spawn_mob(FOURTH_STONE, PillarPos[1],PillarPos[2]);
                d.spawn_mob(FOURTH_BOSS, BossPos[1],BossPos[2]);
                d.set_regen_file(settings["regen_file"].."regen_6a.txt");
                
                d.jump_all(Position_6[1], Position_6[2])
                
                ShadowZoneLIB.setCoolTimer();
                server_timer("ShadowZone_SixthFloor", SixthFloorTimer, d.get_map_index())
            
            ---- Set and jump 7th floor
            elseif Floor == 6 then
                local Position_7 = settings["pos_7_floor"]
                
                addimage(25, 10, "shadowzone_bg2.tga"); say("[ENTER][ENTER]")
                say_title(mob_name(9376))
                say("[ENTER]Si quieres continuar, todas las personas necesitan:")
                say_item(""..item_name(ITEM_SOUL).."", ITEM_SOUL, "")
                say_reward("Aquellos que no lo tengan seran [ENTER] teletransportados fuera de la mazmorra despues de que continues.")
                
                if (select("Continue", "Close") == 1) then
                    setskin(NOWINDOW);
                    npc.purge();
                    
                    d.exit_all_by_item_group ("ShadowZone_6F_ticket"); d.delete_item_in_item_group_from_all ("ShadowZone_6F_ticket");
                    d.setf("ShadowZone_floor", 7);
                    
                    d.regen_file(settings["regen_file"].."regen_7a.txt");
                    
                    ShadowZoneLIB.noCoolTimer();
                    
                    d.jump_all(Position_7[1], Position_7[2])
                end
                
            ---- Set and jump 8th floor
            elseif Floor == 7 then
                local Position_8 = settings["pos_8_floor"]
            for index = 1, table.getn(Items) do
                pc.remove_item(Items[index], pc.count_item(Items[index]));
            end
            
            if not pc.is_gm() then
                pc.setf("shadow_dungeon","exit_shadow_dungeon_time", get_global_time())
                pc.setqf("shadow_dungeon", get_time() + settings["dungeon_cooldown"])
            end
        end
    end
end

ShadowZoneLIB.lua;
C++:
ShadowZoneLIB = {};

ShadowZoneLIB.Settings = function()
    if (ShadowZoneLIB.data == nil) then
        ShadowZoneLIB.data = {
            --------------------------------------           
            -- Map settings (Coordinates, indexes)
            ["third_stone"] = 8496,
            
            ["bosses"] = {4382, 4383, 4384, 4385, 4386, 4387},  --- All bosses of the dungeon
            
            ---States
            ["REAPER_HP_1"] = 350000,
            ["REAPER_HP_2"] = 450000,
            ["REAPER_HP_3"] = 550000,
            ["REAPER_HP_4"] = 650000,

            ["ABBADON_HP_NORMAL"] = 600000,  --- This HP will be set for 6th boss (4387) if Shadow amulet (30850) ISN'T active
            ["time_to_kill_final_boss"] = 300, --- Time to finish first floor (destroy 3x stone), otherwise they will be teleported out of the dungeon
            
            ["time_to_destroy_finalstone"] = 240,
            
            ["time_to_final_exit"] = 120, -- After that time, players will be teleported out of dungeon
            
            ["dungeon_cooldown"] = 3600, --- Time until players can't enter dungeon afte they finish it
            };
    end
    
    return ShadowZoneLIB.data;
end

ShadowZoneLIB.isActive = function()
    local pMapIndex = pc.get_map_index(); local map_index = ShadowZoneLIB.Settings()["inside_index"];
    
    return pc.in_dungeon() and pMapIndex >= map_index*10000 and pMapIndex < (map_index+1)*10000;
end
ShadowZoneLIB.spawnPortalGate = function()
    local settings = ShadowZoneLIB.Settings();
    local Floor = d.getf("ShadowZone_floor")
    local PortalGate = settings["portal_gate"]
    local Position = settings["portal_gate_pos"]
    
    if Floor == 1 then
        d.spawn_mob_dir(PortalGate, Position[1][1], Position[1][2], Position[1][3]);
    elseif Floor == 2 then
        d.spawn_mob_dir(PortalGate, Position[2][1], Position[2][2], Position[2][3]);
    elseif Floor == 3 then
        d.spawn_mob_dir(PortalGate, Position[3][1], Position[3][2], Position[3][3]);
    elseif Floor == 4 then
        d.spawn_mob_dir(PortalGate, Position[4][1], Position[4][2], Position[4][3]);
    elseif Floor == 6 then
        d.spawn_mob_dir(PortalGate, Position[5][1], Position[5][2], Position[5][3]);
    elseif Floor == 7 then
        d.spawn_mob_dir(PortalGate, Position[6][1], Position[6][2], Position[6][3]);
    elseif Floor == 8 then
        d.spawn_mob_dir(PortalGate, Position[7][1], Position[7][2], Position[7][3]);
    end
end

ShadowZoneLIB.spawnThirdStone = function()
    local settings = ShadowZoneLIB.Settings();
    local Stone = settings["third_stone"];
    local stone_pos = settings["third_stone_pos"];
    local n = number(1,10);             

    table_shuffle(stone_pos);

    d.set_unique ("real_stone", d.spawn_mob(Stone, stone_pos[n][1], stone_pos[n][2]))
end


ShadowZoneLIB.clearCoolTimer = function()
    if party.is_party() then
        for _, pid in pairs({party.get_member_pids()}) do
            q.begin_other_pc_block(pid);
            
            cmdchat("ClearDungeonCoolTime");
            
            q.end_other_pc_block();
        end
    
    else
    
        cmdchat("ClearDungeonCoolTime");       
    end
end


ShadowZoneLIB.setCoolTimer = function()
    local settings = ShadowZoneLIB.Settings();
    local Floor = d.getf("ShadowZone_floor")
    local FinalStone = d.getf("ShadowZone_9f_StoneD")
    local FinalBoss = d.getf("ShadowZone_FinalBoss")
        
        if Floor == 1 then
            d.setf("ShadowZone_floor1_timer", settings["timer_first_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor1_timer")))
        
        elseif Floor == 2 then
            d.setf("ShadowZone_floor2_timer", settings["timer_second_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor2_timer")))
        
        elseif Floor == 4 then
            d.setf("ShadowZone_floor4_timer", settings["timer_fourth_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor4_timer")))
        
        elseif Floor == 5 then
            d.setf("ShadowZone_floor5_timer", settings["timer_fifth_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor5_timer")))
        
        elseif Floor == 6 then
            d.setf("ShadowZone_floor6_timer", settings["timer_sixth_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor6_timer")))
        
        elseif Floor == 8 then
            d.setf("ShadowZone_floor8_timer", settings["timer_eight_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor8_timer")))
        end
        
        if FinalStone == 1 then
            d.setf("ShadowZone_floor9_timer1", settings["time_to_destroy_finalstone"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor9_timer1")))
        end
        
        if FinalBoss == 1 then
            d.setf("ShadowZone_floor9_timer2", settings["time_to_kill_final_boss"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor9_timer2")))
        end
    end
end
 
Metin2Hub Bot
M2Hub Bot
Feb
Threads
65
1,499
1
609
113
HubMoney
974
Shadow devil tower [Full Quest] [Dungeon no logo]

Hey forum family!

I couldn't run the "quests" in this thread. Could you help?

duiy2rs.png


ShadowZone_enter.lua;
C++:
quest Valentine2021_enter begin
    state start begin
        when 9376.chat."The story" with not ShadowZoneLIB.isActive() begin
            addimage(25, 10, "shadowzone_bg1.tga"); say_title(string.format("[ENTER][ENTER][ENTER]%s:[ENTER]", mob_name(npc.get_race())));
            
            say("We fight with demons in Devil's tower or Devil catacombs for years.[ENTER]But something much darker has awake.[ENTER]There is another world. Deep in shadow. Forgotten[ENTER]corridors of old Kingdoms we know only from rumors.")
            
            wait()
            addimage(25, 10, "shadowzone_bg1.tga"); say_title(string.format("[ENTER][ENTER][ENTER]%s:[ENTER]", mob_name(npc.get_race())));
            
            say("There aren't many of us who survived.[ENTER]Most of them are stuck in there forever.[ENTER]If we wont fight, the shadow will take control[ENTER]of most places on earth.")
        end
            
        when 9376.chat."Shadow tower" with not ShadowZoneLIB.isActive() begin
            local settings = ShadowZoneLIB.Settings();

            addimage(25, 10, "shadowzone_bg1.tga");
            say("[ENTER][ENTER]")
            say_title(string.format("%s:[ENTER]", mob_name(npc.get_race())))
            say_reward("Do you really want to enter the dungeon?")
            
            if (select("Yes!", "No") == 1) then
                if ShadowZoneLIB.checkEnter() then
                    ShadowZoneLIB.CreateDungeon();
                end
            end
        end
    end
end

ShadowZone_zone.lua;
C++:
define FIRST_STONE 8494
define SECOND_STONE 8495
define THIRD_STONE 8496
define FOURTH_STONE 8499
define FIFTH_STONE 8497
define SIXTH_STONE 8498

define GATE_NPC 9382
define FIRST_SEAL 9377
define FIRST_STATUE 9378
define SECOND_STATUE 9379
define THIRD_STATUE 9380
define FOURTH_STATUE 9381
define FIRST_PILLAR 9383
define SECOND_PILLAR 9384
define THIRD_PILLAR 9385
define CHEST 9386

define SIXTH_BOSS 4387
define FINAL_BOSS 4388

define FIRST_KEY 30845
define SECOND_KEY 30846
define THIRD_KEY 30847
define ITEM_SOUL 30848
define DEMON_EYE 30849
define ITEM_AMULET 30850
define ITEM_MAIN_REWARD 30854
define ITEM_KEY_REWARD 30855
define ITEM_SMALL_REWARD 30856

quest ShadowZone_zone begin
    state start begin
        when login with ShadowZoneLIB.isActive() begin
            local settings = ShadowZoneLIB.Settings();           
            local OutsidePosition = settings["outside_pos"]           

            if (party.is_party() and party.is_leader() or not party.is_party()) then
                
                local FirstFloorTimer = settings["timer_first_floor"];
                
                d.setf("ShadowZone_floor", 1);                       
                d.setf("ShadowZone_FirstStone", 1);                       
                d.setf("ShadowZone_floor1_timer", FirstFloorTimer);                       
                d.setf("ShadowZone_nocool_timer", 1);                       
                
                d.set_warp_location(settings["outside_index"], OutsidePosition[1], OutsidePosition[2]);
                
                d.set_regen_file(settings["regen_file"].."regen_1a.txt");
                d.regen_file(settings["regen_file"].."regen_1b.txt");
                
                d.notice(string.format("Torre de las sombras: Destruye todos los %s! Tienes un tiempo limitado! Apresurate!", mob_name(FIRST_STONE)));
                
                ShadowZoneLIB.setCoolTimer();           
                
                server_timer("ShadowZone_FirstFloor", FirstFloorTimer, d.get_map_index())
            end
        end
                
        ------------
        ---Players destroy first stone (3x), after that, timer is cleared and set another for jump them to next floor
        ------------
        when FIRST_STONE.kill with ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 1 begin
            local settings = ShadowZoneLIB.Settings();           
            local KILL_COUNT = settings["FIRST_STONE_COUNT"]
            local n = d.getf("ShadowZone_FirstStone_count") + 1
            
            d.setf("ShadowZone_FirstStone_count", n)
            
            if n >= KILL_COUNT then
            
                ShadowZoneLIB.clearDungeon()               
                clear_server_timer("ShadowZone_FirstFloor", d.get_map_index());
                
                d.setf("ShadowZone_FirstStone", 0);
                ShadowZoneLIB.clearCoolTimer();
                
                d.notice(string.format("Torre sombria: %s fue revelado! Puedes pasar al siguiente piso!", mob_name(GATE_NPC)));
                ShadowZoneLIB.spawnPortalGate()
            end
        end

        -----
        --Server timer to check if the stones (8494) are destroyed, if not, dungeon is ended
        -----
        when ShadowZone_FirstFloor.server_timer begin
            if d.select(get_server_timer_arg()) then
                if d.getf("ShadowZone_FirstStone") == 1 then
                    d.notice("Torre de las sombras: Se acabo el tiempo. Fallaste!")
                    
                    d.exit_all()
                end
            end
        end

        -----
        --Killing wave of monsters to get a key (2x)
        -----
        when kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 2 and d.getf("ShadowZone_2f_KillMonsters") == 1 begin
            local settings = ShadowZoneLIB.Settings();       
            d.setf("ShadowZone_2f_KillCount", n)
            
            if pc.get_x() > 17729 and pc.get_y() > 22951 and pc.get_x() < 17932 and pc.get_y() < 23140 then               
                
                if n >= KILL_COUNT then
                    game.drop_item(FIRST_KEY, 1)
                    
                    d.setf("ShadowZone_2f_KillCount", 0)
                    d.setf("ShadowZone_2f_KillMonsters", 0)
                end
            end
        end
        
        -----
        --Destroying 2 Shadow seals to spawn a frist boss (4382)
        -----
        when FIRST_SEAL.take with item.get_vnum() == FIRST_KEY and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 2 and d.getf("ShadowZone_2f_KillMonsters") == 0 begin
            local settings = ShadowZoneLIB.Settings();
            local Position = settings["first_boss_pos"]
            
            item.remove()
            npc.kill()
            
            if d.getf("ShadowZone_2f_Seal") == 2 then
            
                ShadowZoneLIB.clearDungeon()
                d.notice(string.format("Torre de las sombras: %s se acerca!", mob_name(FIRST_BOSS)))
                
                d.spawn_mob(FIRST_BOSS, Position[1], Position[2])
            else
                d.notice(string.format("Torre de las sombras: Mata la segunda ola de monstruos para destruir el segundo %s!", mob_name(FIRST_SEAL)))
                
                d.setf("ShadowZone_2f_KillMonsters", 1);
                d.setf("ShadowZone_2f_Seal", 2);
                d.regen_file(settings["regen_file"].."regen_2a.txt");
            end
        end
        
        -----
        --Server timer to check if the stones (8494) are destroyed, if not, dungeon is ended
        -----
        when ShadowZone_SecondFloor.server_timer begin
            if d.select(get_server_timer_arg()) then
                    
                    d.exit_all()
                end
            end
        end
        
        -----
        -- Players kill the first boss (4382), after that, server timer for jump to next floor is set
        -----
        when FIRST_BOSS.kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 2 begin
            local settings = ShadowZoneLIB.Settings();
            
            clear_server_timer("ShadowZone_SecondFloor", d.get_map_index());
            ShadowZoneLIB.clearCoolTimer();
            
            ShadowZoneLIB.spawnPortalGate();
            
            d.notice(string.format("Torre de las sombras:%s fue revelado! Puedes pasar al siguiente piso!", mob_name(GATE_NPC)));
        end
        
        -----
        --Players destroying stones in third floor. 4 of them are fake, one is real
        -----
            local settings = ShadowZoneLIB.Settings();
            local n = d.getf("ShadowZone_wrong_count_f") + 1
            
            if npc.get_vid() == d.get_unique_vid("real") then
                ShadowZoneLIB.clearDungeon()
                ShadowZoneLIB.clearDungeon()
                
                d.notice("Torre de las sombras: Has destruido la piedra correcta!")
                d.notice(string.format("Torre de las sombras: %s fue revelado! Puedes pasar al siguiente piso!", mob_name(GATE_NPC)));
                
                ShadowZoneLIB.spawnPortalGate()
            else
                d.setf("ShadowZone_wrong_count_f", n);   
                
                d.notice("Torre de las sombras: Este era solo una ilusion!")
            end
        end
                
        -----
        --Killing wave of monsters to get a key (30846 - 3x)
        -----
        when kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 4 and d.getf("ShadowZone_4f_KillMonsters") == 1 begin
            local settings = ShadowZoneLIB.Settings();       
            local KILL_COUNT = settings["KILL_COUNT_4_FLOOR"];
            local n = d.getf("ShadowZone_4f_KillCount") + 1
            
            d.setf("ShadowZone_4f_KillCount", n)
            
            if pc.get_x() > 17353 and pc.get_y() > 22626 and pc.get_x() < 17511 and pc.get_y() < 22740 then               
                
                if n >= KILL_COUNT then
                    game.drop_item(SECOND_KEY, 1)
                    
                    d.setf("ShadowZone_4f_KillCount", 0)
                    d.setf("ShadowZone_4f_KillMonsters", 0)
                end
            end
        end
        

        -----
        -- Building a Statue of reaper (9378, 9379, 9380, 9381)
        -----
        when FIRST_STATUE.take with item.get_vnum() == SECOND_KEY and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 4 and d.getf("ShadowZone_4f_KillMonsters") == 0 begin
            local settings = ShadowZoneLIB.Settings();
            local StatuePosition = settings["reaper_statue_pos"]
            item.remove()
            npc.kill()
            
            
            d.setf("ShadowZone_4f_KillMonsters", 1);
            
            d.spawn_mob_dir(THIRD_STATUE, StatuePosition[1], StatuePosition[2], StatuePosition[3]);
            d.regen_file(settings["regen_file"].."regen_4a.txt");
        end
                
        when THIRD_STATUE.take with item.get_vnum() == SECOND_KEY and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 4 and d.getf("ShadowZone_4f_KillMonsters") == 0 begin
            local settings = ShadowZoneLIB.Settings();
            local StatuePosition = settings["reaper_statue_pos"]
            local BossPosition = settings["second_boss_pos"]
            
            ShadowZoneLIB.clearDungeon()
            
            item.remove()
            npc.kill()
            
            d.spawn_mob_dir(FOURTH_STATUE, StatuePosition[1], StatuePosition[2], StatuePosition[3]);
            
            ---- Shadow reaper spawn (HP are depending on negative points collected in third floor from destroying fake stones)
            d.set_unique("ShadowReaper", d.spawn_mob(SECOND_BOSS, BossPosition[1], BossPosition[2]))
            
            if d.getf("ShadowZone_wrong_count_f") == 1 then
                d.unique_set_maxhp("ShadowReaper", settings["REAPER_HP_3"])
            elseif d.getf("ShadowZone_wrong_count_f") == 4 then
                d.unique_set_maxhp("ShadowReaper", settings["REAPER_HP_4"])
            else
                return
            end
        end
                
        -----
        -- Players kill the second boss (4383), they drop a key (30847) to destroy Statue of reaper (9381)
        -----
        when SECOND_BOSS.kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 4 begin
            game.drop_item(THIRD_KEY, 1);
            
            
            d.setf("ShadowZone_4f_CanDesSta", 1)
            
            d.notice(string.format("Torre de las sombras: Bien hecho! Ahora destruye el %s para poder continuar!", mob_name(FIRST_STATUE)));           
        end
        
        -----
        -- Players destroy statue of reaper (9381), then Shadow gate is spawned and players can proceed to next floor
        -----
        when FOURTH_STATUE.take with item.get_vnum() == THIRD_KEY and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 4 and d.getf("ShadowZone_4f_CanDesSta") == 1 begin
            clear_server_timer("ShadowZone_FourthFloor", d.get_map_index());
            ShadowZoneLIB.clearCoolTimer();
            
            
            ShadowZoneLIB.clearDungeon();
            
            d.notice("Torre de las sombras: Gran trabajo! Procederas en unos segundos!")
            
            d.spawn_mob(GATE_NPC, pc.get_local_x(), pc.get_local_y());
        end
        
        -----
        --Server timer to check if the stones (8494) are destroyed, if not, dungeon is ended
        -----
        when ShadowZone_FifthFloor.server_timer begin
            if d.select(get_server_timer_arg()) then
                d.notice("Torre de las sombras: El tiempo ha terminado. Fallaste!")
                    
                d.exit_all()
            end
        end
        
        -----
        --Players destroy a statue in sixth floor (8499)
        -----
        when FOURTH_STONE.kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 6 begin
            d.setf("ShadowZone_PillarActive", 0);
            
            d.notice(string.format("Torre de las sombras: La proteccion de %s se ha ido. Puedes matarlo ahora!", mob_name(FOURTH_BOSS)));
        end
        
        -----
        --Players kill Azrael boss, if the statue is not destroyed yet, boss will spawned again
                d.set_item_group("ShadowZone_6F_ticket", 1, ITEM_SOUL, 1)
                
                d.notice(string.format("Torre de las sombras: %s fue revelado! Puedes pasar al siguiente piso!", mob_name(GATE_NPC)));
                
                ShadowZoneLIB.spawnPortalGate()
            end
        end
        
        -----
        --Players can not die in the dungeon
        -----
        when dead with ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 6 begin
            d.notice("Torre de las sombras: You died. You have failed.")
            
            d.exit_all()
        end
        -----
        --Server timer to check if the fourth boss (Azrael) is killed
        -----
        when ShadowZone_SixthFloor.server_timer begin
            if d.select(get_server_timer_arg()) then
                d.notice("Torre de las sombras: El tiempo ha terminado. Fallaste!")
                    
                d.exit_all()
            end
        end
        
        -----
        --Players destroy a 8x stone in 7th floor, after that, boss is spawned
        -----
        when FIFTH_STONE.kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 7 begin
            local settings = ShadowZoneLIB.Settings();
            local KILL_COUNT = settings["FIFTH_STONE_COUNT"]
            local n = d.getf("ShadowZone_7th_stone") + 1               
            
        end
        --Destrying pillar (3 phases - 9383-9385) at 8 floor
        -----
        when FIRST_PILLAR.take with item.get_vnum() == DEMON_EYE and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 8 and d.getf("ShadowZone_8F_Pillar") == 1 begin
            local settings = ShadowZoneLIB.Settings();
            local PillarPos = settings["pillar2_pos"]
            
            d.setf("ShadowZone_8F_Pillar", 2);
            d.setf("ShadowZone_8F_Drop", 1);
            
            item.remove()
            npc.kill()
            
            d.spawn_mob_dir(SECOND_PILLAR, PillarPos[1],  PillarPos[2],  PillarPos[3])
        end
        
        when SECOND_PILLAR.take with item.get_vnum() == DEMON_EYE and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 8 and d.getf("ShadowZone_8F_Pillar") == 2 begin
            local settings = ShadowZoneLIB.Settings();
            local PillarPos = settings["pillar2_pos"]
            d.spawn_mob_dir(THIRD_PILLAR, PillarPos[1],  PillarPos[2],  PillarPos[3])
        end
        
        when THIRD_PILLAR.take with item.get_vnum() == DEMON_EYE and ShadowZoneLIB.isActive() and d.getf("ShadowZone_floor") == 8 and d.getf("ShadowZone_8F_Pillar") == 3 begin
            local settings = ShadowZoneLIB.Settings();
            server_timer("ShadowZone_SixthBoss_spawner", Time, d.get_map_index())
        end
        
        -----
        --Players can use amulet to spawn the sixth boss with less HP.
        -----       
        when ITEM_AMULET.use with ShadowZoneLIB.isActive() begin
            local AmuletSetting = d.getf("ShadowZone_CanUseAmulet")
            
            if AmuletSetting == 1 then        --- Players can use the amulet       
                item.remove();           
                d.setf("ShadowAmuletIsActive", 2);
                
                d.notice(string.format("Shadow zone: %s ya esta activo! %s sera mucho mas debil!", item_name(ITEM_AMULET), mob_name(SIXTH_BOSS)));
                
            elseif AmuletSetting == 2 then        ---- Players already used the amulet, so the effect is already active       
                d.notice("Torre de las sombras: Este efecto ya esta activo!");
                
            else        --- Players are in last floor, or the boss is already spawned
                d.notice("Torre de las sombras: Puedes usar esto solo durante los primeros 8 pisos!");
            end
        end
                
        -----
        --Server timer to spawn a sixth boss (4387)
        -----
        when ShadowZone_SixthBoss_spawner.server_timer begin
            if d.select(get_server_timer_arg()) then
                local settings = ShadowZoneLIB.Settings();
                local BossPosition = settings["sixth_boss_pos"]
                local ShadowAmuletIsActive = d.getf("ShadowAmulet")
            
                d.setf("ShadowZone_CanUseAmulet", 0)
                d.set_unique("SixthBoss", d.spawn_mob(SIXTH_BOSS, BossPosition[1], BossPosition[2]))
                
                if ShadowAmuletIsActive == 1 then
                    d.unique_set_maxhp("SixthBoss", settings["ABBADON_HP_SMALL"])
                else
                    d.unique_set_maxhp("SixthBoss", settings["ABBADON_HP_NORMAL"])
                end
                d.setf("ShadowZone_9f_StoneD", 0)
                
            else
                d.setf("ShadowZone_9f_StoneFail", 1)
            end               
        end
        
        -----
        --Server timer to spawn a fifth boss (4386)
        -----
        when ShadowZone_NinethFloor_1.server_timer begin
            if d.select(get_server_timer_arg()) then
                if d.getf("ShadowZone_9f_StoneD") == 1 then
                    d.setf("ShadowZone_9f_StoneD", 0)
                end
            end
        end
        
    -----
        --Server timer to spawn another wave of monsters
        -----
        when ShadowZone_NinethFloor_2.server_timer begin
            if d.select(get_server_timer_arg()) then
                local settings = ShadowZoneLIB.Settings();
                
                d.regen_file(settings["regen_file"].."regen_9a.txt");
            end
        end
        
        -----
        --Server timer to spawn random boss from previous stages
        -----
        when ShadowZone_NinethFloor_3.server_timer begin
                ShadowZoneLIB.spawnRandomBoss();
        end
            
        -----
        --Server timer to check if the boss is killed or not
        -----
        when ShadowZone_FinalBoss_kill.server_timer begin
            if d.select(get_server_timer_arg()) then
                if d.getf("ShadowZone_FinalBoss") == 1 then
                    d.notice("Torre de las sombras: El tiempo ha terminado. Fallaste");
                    d.exit_all()
                end
            end
        end
        
        -----
        --Players kill Final boss (4388), after that, chest is spawned
        -----
        when FINAL_BOSS.kill with ShadowZoneLIB.isActive() and not npc.is_pc() and d.getf("ShadowZone_floor") == 9 and d.getf("ShadowZone_FinalBoss") == 1 begin
            local settings = ShadowZoneLIB.Settings();
            local Position = settings["chest_pos"]
            local TimeToExit = settings["time_to_final_exit"]
            local minutes = math.floor(TimeToExit / 60)
            
            ShadowZoneLIB.clearDungeon();
            ShadowZoneLIB.setReward();
            
            clear_server_timer("ShadowZone_FinalBoss_kill", d.get_map_index());
            ShadowZoneLIB.clearCoolTimer();
            
            d.setf("ShadowZone_FinalBoss", 0);
            d.setf("ShadowZone_CanTakeReward", 1);
            
            d.notice("Torre de las sombras: Seras teletransportado fuera de la mazmorra en %s minutos.", minutes);
            d.notice("Torre de las sombras: Ahora puedes tomar tu recompensa!");
            
            d.spawn_mob_dir(CHEST, Position[1], Position[2], Position[3]);
            
            server_timer("ShadowZone_Final_Exit", TimeToExit, d.get_map_index());
        end
        
        
        -----
        --Players can take reward from the chest
        -----   
        when CHEST.chat."Take reward" with ShadowZoneLIB.isActive() and d.getf("ShadowZone_CanTakeReward") == 1 begin
            setskin(NOWINDOW);
            
            if d.getf(string.format("player_%d_reward_state", pc.get_player_id())) == 1 then
                pc.give_item2(ITEM_MAIN_REWARD, 1);
                
                d.setf(string.format("player_%d_reward_state", pc.get_player_id()), 0);   
            else
                syschat("Torre de las sombras: Ya te llevaste la recompensa!")
            end
        end
        
        -----
        --Players can put key (30855) to the chest and take another smaller reward
        -----   
        when CHEST.take with item.get_vnum() == ITEM_KEY_REWARD and ShadowZoneLIB.isActive() and d.getf("ShadowZone_CanTakeReward") == 1 begin
            item.remove()
            pc.give_item2(ITEM_SMALL_REWARD, 1)
                d.setf("ShadowZone_2f_KillMonsters", 1);
                d.setf("ShadowZone_2f_Seal", 1);
                
                d.regen_file(settings["regen_file"].."regen_2a.txt");
                d.regen_file(settings["regen_file"].."regen_2b.txt");
                
                d.notice(string.format("Torre de las sombras: Destruye ambos %s! Destruye todos los monstruos para obtener una llave.!", mob_name(FIRST_SEAL)));
                
                d.jump_all(Position_2[1], Position_2[2])
                
                ShadowZoneLIB.setCoolTimer();
                server_timer("ShadowZone_SecondFloor", SecondFloorTimer, d.get_map_index())
            
            ---- Set and jump 3rd floor
            elseif Floor == 2 then
                local Position_3 = settings["pos_3_floor"]
                
                setskin(NOWINDOW);
                npc.purge();
                
                d.setf("ShadowZone_floor", 3);
                
                ShadowZoneLIB.spawnSecondStone();
                
                d.notice(string.format("Torre de las sombras: Encuentra %s real y destruyelo!", mob_name(SECOND_STONE)));
                d.notice(string.format("Torre de las sombras: Cada piedra equivocada esconde %s adentro!", mob_name(FIRST_BOSS)));
                d.notice("Torre de las sombras: Cuantas mas piedras falsas destruyas, mas HP tendra un proximo jefe.!");
                
                ShadowZoneLIB.noCoolTimer();
                
                d.jump_all(Position_3[1], Position_3[2])
                            
            ---- Set and jump 4th floor
            elseif Floor == 3 then
                local Position_4 = settings["pos_4_floor"]
                local FourthFloorTimer = settings["timer_fourth_floor"]
                
                setskin(NOWINDOW);
                npc.purge();
                
                d.setf("ShadowZone_floor", 4);
                d.setf("ShadowZone_4f_KillMonsters", 1);
                
                d.spawn_mob_dir(FIRST_STATUE, StatuePosition[1], StatuePosition[2], StatuePosition[3]);
                d.regen_file(settings["regen_file"].."regen_4a.txt");
                
                d.jump_all(Position_4[1], Position_4[2])
                
                d.notice(string.format("Torre de las sombras: Mata a todos los monstruos para obtener %s, luego comienza a construir un %s", item_name(SECOND_KEY), mob_name(FIRST_STATUE)));
                
                ShadowZoneLIB.setCoolTimer();
                
                server_timer("ShadowZone_FourthFloor", FourthFloorTimer, d.get_map_index())
            
            ---- Set and jump 5th floor
            elseif Floor == 4 then
                local Position_5 = settings["pos_5_floor"]
                local FifthFloorTimer = settings["timer_fifth_floor"]
                
                setskin(NOWINDOW);
                npc.purge();
                
                d.setf("ShadowZone_floor", 5);
                
                ShadowZoneLIB.spawnThirdStone();
                d.set_regen_file(settings["regen_file"].."regen_5a.txt");
                
                d.jump_all(Position_5[1], Position_5[2])
                
                ShadowZoneLIB.setCoolTimer();
                server_timer("ShadowZone_FifthFloor", FifthFloorTimer, d.get_map_index())
            
            ---- Set and jump 6th floor
            elseif Floor == 5 then
                local Position_6 = settings["pos_6_floor"]
                local PillarPos = settings["fourth_stone_pos"]
                local BossPos = settings["fourth_boss_pos"]
                local SixthFloorTimer = settings["timer_sixth_floor"]
                
                setskin(NOWINDOW);
                npc.purge();
                                    
                d.setf("ShadowZone_floor", 6);
                d.setf("ShadowZone_PillarActive", 1);
                
                d.spawn_mob(FOURTH_STONE, PillarPos[1],PillarPos[2]);
                d.spawn_mob(FOURTH_BOSS, BossPos[1],BossPos[2]);
                d.set_regen_file(settings["regen_file"].."regen_6a.txt");
                
                d.jump_all(Position_6[1], Position_6[2])
                
                ShadowZoneLIB.setCoolTimer();
                server_timer("ShadowZone_SixthFloor", SixthFloorTimer, d.get_map_index())
            
            ---- Set and jump 7th floor
            elseif Floor == 6 then
                local Position_7 = settings["pos_7_floor"]
                
                addimage(25, 10, "shadowzone_bg2.tga"); say("[ENTER][ENTER]")
                say_title(mob_name(9376))
                say("[ENTER]Si quieres continuar, todas las personas necesitan:")
                say_item(""..item_name(ITEM_SOUL).."", ITEM_SOUL, "")
                say_reward("Aquellos que no lo tengan seran [ENTER] teletransportados fuera de la mazmorra despues de que continues.")
                
                if (select("Continue", "Close") == 1) then
                    setskin(NOWINDOW);
                    npc.purge();
                    
                    d.exit_all_by_item_group ("ShadowZone_6F_ticket"); d.delete_item_in_item_group_from_all ("ShadowZone_6F_ticket");
                    d.setf("ShadowZone_floor", 7);
                    
                    d.regen_file(settings["regen_file"].."regen_7a.txt");
                    
                    ShadowZoneLIB.noCoolTimer();
                    
                    d.jump_all(Position_7[1], Position_7[2])
                end
                
            ---- Set and jump 8th floor
            elseif Floor == 7 then
                local Position_8 = settings["pos_8_floor"]
            for index = 1, table.getn(Items) do
                pc.remove_item(Items[index], pc.count_item(Items[index]));
            end
            
            if not pc.is_gm() then
                pc.setf("shadow_dungeon","exit_shadow_dungeon_time", get_global_time())
                pc.setqf("shadow_dungeon", get_time() + settings["dungeon_cooldown"])
            end
        end
    end
end

ShadowZoneLIB.lua;
C++:
ShadowZoneLIB = {};

ShadowZoneLIB.Settings = function()
    if (ShadowZoneLIB.data == nil) then
        ShadowZoneLIB.data = {
            --------------------------------------           
            -- Map settings (Coordinates, indexes)
            ["third_stone"] = 8496,
            
            ["bosses"] = {4382, 4383, 4384, 4385, 4386, 4387},  --- All bosses of the dungeon
            
            ---States
            ["REAPER_HP_1"] = 350000,
            ["REAPER_HP_2"] = 450000,
            ["REAPER_HP_3"] = 550000,
            ["REAPER_HP_4"] = 650000,

            ["ABBADON_HP_NORMAL"] = 600000,  --- This HP will be set for 6th boss (4387) if Shadow amulet (30850) ISN'T active
            ["time_to_kill_final_boss"] = 300, --- Time to finish first floor (destroy 3x stone), otherwise they will be teleported out of the dungeon
            
            ["time_to_destroy_finalstone"] = 240,
            
            ["time_to_final_exit"] = 120, -- After that time, players will be teleported out of dungeon
            
            ["dungeon_cooldown"] = 3600, --- Time until players can't enter dungeon afte they finish it
            };
    end
    
    return ShadowZoneLIB.data;
end

ShadowZoneLIB.isActive = function()
    local pMapIndex = pc.get_map_index(); local map_index = ShadowZoneLIB.Settings()["inside_index"];
    
    return pc.in_dungeon() and pMapIndex >= map_index*10000 and pMapIndex < (map_index+1)*10000;
end
ShadowZoneLIB.spawnPortalGate = function()
    local settings = ShadowZoneLIB.Settings();
    local Floor = d.getf("ShadowZone_floor")
    local PortalGate = settings["portal_gate"]
    local Position = settings["portal_gate_pos"]
    
    if Floor == 1 then
        d.spawn_mob_dir(PortalGate, Position[1][1], Position[1][2], Position[1][3]);
    elseif Floor == 2 then
        d.spawn_mob_dir(PortalGate, Position[2][1], Position[2][2], Position[2][3]);
    elseif Floor == 3 then
        d.spawn_mob_dir(PortalGate, Position[3][1], Position[3][2], Position[3][3]);
    elseif Floor == 4 then
        d.spawn_mob_dir(PortalGate, Position[4][1], Position[4][2], Position[4][3]);
    elseif Floor == 6 then
        d.spawn_mob_dir(PortalGate, Position[5][1], Position[5][2], Position[5][3]);
    elseif Floor == 7 then
        d.spawn_mob_dir(PortalGate, Position[6][1], Position[6][2], Position[6][3]);
    elseif Floor == 8 then
        d.spawn_mob_dir(PortalGate, Position[7][1], Position[7][2], Position[7][3]);
    end
end

ShadowZoneLIB.spawnThirdStone = function()
    local settings = ShadowZoneLIB.Settings();
    local Stone = settings["third_stone"];
    local stone_pos = settings["third_stone_pos"];
    local n = number(1,10);             

    table_shuffle(stone_pos);

    d.set_unique ("real_stone", d.spawn_mob(Stone, stone_pos[n][1], stone_pos[n][2]))
end


ShadowZoneLIB.clearCoolTimer = function()
    if party.is_party() then
        for _, pid in pairs({party.get_member_pids()}) do
            q.begin_other_pc_block(pid);
            
            cmdchat("ClearDungeonCoolTime");
            
            q.end_other_pc_block();
        end
    
    else
    
        cmdchat("ClearDungeonCoolTime");       
    end
end


ShadowZoneLIB.setCoolTimer = function()
    local settings = ShadowZoneLIB.Settings();
    local Floor = d.getf("ShadowZone_floor")
    local FinalStone = d.getf("ShadowZone_9f_StoneD")
    local FinalBoss = d.getf("ShadowZone_FinalBoss")
        
        if Floor == 1 then
            d.setf("ShadowZone_floor1_timer", settings["timer_first_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor1_timer")))
        
        elseif Floor == 2 then
            d.setf("ShadowZone_floor2_timer", settings["timer_second_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor2_timer")))
        
        elseif Floor == 4 then
            d.setf("ShadowZone_floor4_timer", settings["timer_fourth_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor4_timer")))
        
        elseif Floor == 5 then
            d.setf("ShadowZone_floor5_timer", settings["timer_fifth_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor5_timer")))
        
        elseif Floor == 6 then
            d.setf("ShadowZone_floor6_timer", settings["timer_sixth_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor6_timer")))
        
        elseif Floor == 8 then
            d.setf("ShadowZone_floor8_timer", settings["timer_eight_floor"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor8_timer")))
        end
        
        if FinalStone == 1 then
            d.setf("ShadowZone_floor9_timer1", settings["time_to_destroy_finalstone"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor9_timer1")))
        end
        
        if FinalBoss == 1 then
            d.setf("ShadowZone_floor9_timer2", settings["time_to_kill_final_boss"]);   
            cmdchat(string.format("SetDungeonCoolTime %d %d", Floor, d.getf("ShadowZone_floor9_timer2")))
        end
    end
end

Hello dear user,

Your post will be under surveillance by bots for the next few hours.

Forum description : Metin2 private server, Metin2 download, Metin2 support, Metin2 Forum, Metin2 Pvp Servers, Errors, Bugs, Requests, Metin2 Pvp Forum, Everything About Metin2.
 

DoN

Metin2 Hub -
Valuable
Designer
Developer
Member
May
Threads
84
339
1
883
93
United Kingdom
terra2.eu
HubMoney
5,624
Theoretically, it tells you what is wrong there, the quests are written wrong, and you probably have a missing LIB
1669712403787.png


And these should not be in the quest

define FIRST_STONE 8494
define SECOND_STONE 8495
define THIRD_STONE 8496
define FOURTH_STONE 8499
define FIFTH_STONE 8497
define SIXTH_STONE 8498

define GATE_NPC 9382
define FIRST_SEAL 9377
define FIRST_STATUE 9378
define SECOND_STATUE 9379
define THIRD_STATUE 9380
define FOURTH_STATUE 9381
define FIRST_PILLAR 9383
define SECOND_PILLAR 9384
define THIRD_PILLAR 9385
define CHEST 9386

define SIXTH_BOSS 4387
define FINAL_BOSS 4388

define FIRST_KEY 30845
define SECOND_KEY 30846
define THIRD_KEY 30847
define ITEM_SOUL 30848
define DEMON_EYE 30849
define ITEM_AMULET 30850
define ITEM_MAIN_REWARD 30854
define ITEM_KEY_REWARD 30855
define ITEM_SMALL_REWARD 30856
 
Member
Sep
Threads
2
66
2
8
HubMoney
152
Bro write u questlist.txt and make.sh try it
Theoretically, it tells you what is wrong there, the quests are written wrong, and you probably have a missing LIB
View attachment 337


And these should not be in the quest

define FIRST_STONE 8494
define SECOND_STONE 8495
define THIRD_STONE 8496
define FOURTH_STONE 8499
define FIFTH_STONE 8497
define SIXTH_STONE 8498

define GATE_NPC 9382
define FIRST_SEAL 9377
define FIRST_STATUE 9378
define SECOND_STATUE 9379
define THIRD_STATUE 9380
define FOURTH_STATUE 9381
define FIRST_PILLAR 9383
define SECOND_PILLAR 9384
define THIRD_PILLAR 9385
define CHEST 9386

define SIXTH_BOSS 4387
define FINAL_BOSS 4388

define FIRST_KEY 30845
define SECOND_KEY 30846
define THIRD_KEY 30847
define ITEM_SOUL 30848
define DEMON_EYE 30849
define ITEM_AMULET 30850
define ITEM_MAIN_REWARD 30854
define ITEM_KEY_REWARD 30855
define ITEM_SMALL_REWARD 30856
dont work :( :( :(





C#:
#!/usr/local/bin/bash

LIST_FILE='metin2_list'

if [ -r $LIST_FILE ]; then

    rm -rdf object
    mkdir object

    while read line;
        do
            ./qc $line
        done < $LIST_FILE
else
    echo $LIST_FILE' is missing'
fi
C#:
arena_manager.quest
change_empire.lua
change_guild_master.quest
charge_cash_by_voucher.quest
check_collect_reward.quest
check_trans_ticket.quest
collect_quest_lv30.quest
collect_quest_lv40.quest
collect_quest_lv50.quest
collect_quest_lv60.quest
collect_quest_lv70.quest
collect_quest_lv80.quest
collect_quest_lv85.quest
collect_quest_lv90.quest
collect_quest_lv92.quest
collect_quest_lv94.quest
couple_ring.quest
cube.quest
cube_opener_list.quest
devilcatacomb_zone.quest
deviltower_zone.quest
dragon_lair.lua
entry_event_map.quest
evlilikshop.quest
fisher.quest
forked_road.quest
fortune_telling.quest
ghost_story.quest
give_basic_weapon.lua
goto_empire_castle.quest
guild_building.quest
guild_building_alter_of_power.quest
guild_building_melt.quest
guild_building_npc.quest
guild_manage.quest
guild_ranking.quest
guild_war_bet.quest
guild_war_join.quest
guild_war_observer.quest
hair.quest
hair_shop.quest
harvest_festival.quest
heavens_cave_escape.quest
horse_menu.quest
horse_revive.quest
horse_summon.quest
horse_take.lua
item_change_sex.lua
item_mall.quest
item_skill_book.lua
karakter_yuzugu.lua
knut_shop_box.quest
level_up.quest
map_warp.quest
mapindex.quest
marriage_manage.quest
mining.lua
move_ring2.quest
mystery_key.quest
neutral_warp.quest
new_quest_60_1.quest
new_quest_lv60.quest
new_quest_lv66.quest
new_quest_lv66_1.quest
new_quest_lv72.quest
new_quest_lv72_1.quest
new_quest_lv75.quest
new_quest_lv78.quest
new_quest_lv78_1.quest
new_quest_lv80.quest
new_quest_lv84.quest
new_quest_lv84_1.quest
npc_talk.quest
npc_talk2.quest
oxevent.lua
priv_empire.quest
pvp_manager.lua
reset_scroll.quest
safe_box.lua
skill_group.quest
skill_reset2.quest
snow_dungeon.lua
spider_dungeon_2floor.quest
spider_dungeon_3floor_boss.quest
training_grandmaster_skill.quest
warehouse.quest
ShadowZoneLIB.lua
ShadowZone_zone.lua
ShadowZone_enter.lua
 
Last edited:
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock