duffisk2w 8 Posted October 1, 2023 Share Posted October 1, 2023 sysr : dungeon_set_flag: not enough arguments. the dungeon doesn't work for me, does anyone know how to fix it? THX DEV Link to comment Share on other sites More sharing options...
caanmasu 311 Posted October 1, 2023 Share Posted October 1, 2023 Send quest 1 Link to comment Share on other sites More sharing options...
duffisk2w 8 Posted October 2, 2023 Author Share Posted October 2, 2023 34 minutes ago, caanmasu said: Poslat quest quest halloween2022_dungeon_zone begin state start begin --** --** Login: Dungeon exit coordinates set on dungeon entrance and timers. --** when login begin local data = Halloween2022Dungeon.GetData(); local outside_base = data["outside_data"]["base"][pc.get_empire()]; local outside_pos = data["outside_data"]["pos"][pc.get_empire()]; if (Halloween2022Dungeon.InDungeon()) then pc.set_warp_location(data["outside_data"]["index"][pc.get_empire()], outside_base["x"] + outside_pos["x"], outside_base["y"] + outside_pos["y"]); d.setf("dungeon_expire_time", 0); if pc.get_map_index() == 161 then if pc.get_map_index() >= 1610000 and pc.get_map_index() < 1619999 then pc.warp(486400,307200) end pc.set_warp_location(358, 4864, 3072) elseif pc.get_map_index() >= 1610000 and pc.get_map_index() < 1619999 then pc.set_warp_location(358, 4864, 3072) end if ((party.is_leader() or not party.is_party()) and d.getf("initialized") == 0) then if d.getf("first_regen") == 1 then--already start!!!! return end d.setf("first_regen", 1) -- set for already regened!!! d.setf("initialized", 1); d.setf("Halloween2022_floor", 1); d.setf("Halloween2022_candestroyFStone", 1); d.setf("start_time", get_time()); d.setf("can_back_dungeon", 1) -- active back dungeon when first enter! if (data["time_out"] > 0) then d.setf("dungeon_time_limit", d.getf("start_time") + data["time_out"]); server_loop_timer("halloween2022_dungeon_time_out", data["time_out_step"], d.get_map_index()); d.notice(string.format("<Bloody cathedral> You have %s to complete the Bloody cathedral.", get_time_format(data["time_out"]))) --d.notice(string.format("<Bloody cathedral> The player '%s' has complete the Bloody cathedral.", pc.get_name())) end -- if local door_data = data["1floor_door_data"]; local seal_data = data["1floor_seal_data"]; local stone_data = data["1floor_stone_data"]; local stone_vid = 0; for stone_idx, stone_pos in ipairs(stone_data["pos"]) do stone_vid = d.spawn_mob_dir(stone_data["vnum_full"], stone_pos["x"], stone_pos["y"], stone_pos["dir"]); d.set_unique(string.format("metinstone_1floor_%d", stone_idx), stone_vid); end -- for d.spawn_mob_dir(door_data["vnum"], door_data["pos"]["x"], door_data["pos"]["y"], door_data["pos"]["dir"]); d.spawn_mob_dir(seal_data["vnum_small"], seal_data["pos"]["x"], seal_data["pos"]["y"], seal_data["pos"]["dir"]); d.regen_file("data/dungeon/halloween2022_dungeon/1floor_statues.txt"); end -- if -- Send the entrance timer as soon as they enter the instance, it will update every time they rejoin, but ultimately this is just a fallback case. -- The real timer gets applied when they kill the final boss. if (data["entrance_timer"] > 0) then pc.setf("Halloween2022Dungeon_zone", "entrance_timer", get_time() + data["entrance_timer"]); end -- if local player_online_qf = string.format("player_online_%d", pc.get_player_id()); if (d.getf(player_online_qf) == 0) then d.setf(player_online_qf, 1); d.setf("dungeon_members_num", d.getf("dungeon_members_num")+1); -- You can be in a party and still enter the dungeon alone end -- if local player_status_qf = string.format("player_status_%d", pc.get_player_id()); if (d.getf(player_status_qf) == 0) then d.setf(player_status_qf, 1); d.setf("dungeon_members_tot", d.getf("dungeon_members_tot")+1); end -- if elseif (Halloween2022Dungeon.InMap()) then notice("Dungeon Instance not found.") notice("You'll be teleported out of the map.") pc.warp((outside_base["x"] + outside_pos["x"]) * 100, (outside_base["y"] + outside_pos["y"]) * 100, data["outside_data"]["index"][pc.get_empire()]); end -- if/elseif end -- when --** --** Logout: Item removal. --** when logout with Halloween2022Dungeon.InDungeon() begin local data = Halloween2022Dungeon.GetData(); -- Send the entrance timer as soon as they logout from the instance, it will update every time they rejoin, but ultimately this is just a fallback case. -- The real timer gets applied when they kill the final boss. if (data["entrance_timer"] > 0) then pc.setf("Halloween2022Dungeon_zone", "entrance_timer", get_time() + data["entrance_timer"]); end -- if d.setf(string.format("player_online_%d", pc.get_player_id()), 0); d.setf("dungeon_members_num", d.getf("dungeon_members_num")-1); if (d.getf("dungeon_members_num") == 0) then d.setf("dungeon_expire_time", get_time() + time_min_to_sec(5)); end -- if if (d.getf("dungeon_members_tot") > 1) then d.notice(string.format("<Bloody cathedral> The player '%s' has left the dungeon.", pc.get_name())) end -- if -- Item removal here. end -- when --** --** Kill: Metinstones to spawn first boss --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["1floor_stone_data"]["vnum_full"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_candestroyFStone") == 1 begin local data = Halloween2022Dungeon.GetData(); local stone_data = data["1floor_stone_data"]; d.setf("1floor_stone_damaged", d.getf("1floor_stone_damaged")+1); d.notice("<Bloody cathedral> This stone is under a spell now!"); if npc.get_vid() == d.get_unique_vid("metinstone_1floor_1") then d.set_unique("1floor_halfstone_1", d.spawn_mob_dir(stone_data["vnum_npc"], stone_data["pos"][1]["x"], stone_data["pos"][1]["y"], stone_data["pos"][1]["dir"])); elseif npc.get_vid() == d.get_unique_vid("metinstone_1floor_2") then d.set_unique("1floor_halfstone_2", d.spawn_mob_dir(stone_data["vnum_npc"], stone_data["pos"][2]["x"], stone_data["pos"][2]["y"], stone_data["pos"][2]["dir"])); elseif npc.get_vid() == d.get_unique_vid("metinstone_1floor_3") then d.set_unique("1floor_halfstone_3", d.spawn_mob_dir(stone_data["vnum_npc"], stone_data["pos"][3]["x"], stone_data["pos"][3]["y"], stone_data["pos"][3]["dir"])); elseif npc.get_vid() == d.get_unique_vid("metinstone_1floor_4") then d.set_unique("1floor_halfstone_4", d.spawn_mob_dir(stone_data["vnum_npc"], stone_data["pos"][4]["x"], stone_data["pos"][4]["y"], stone_data["pos"][4]["dir"])); elseif npc.get_vid() == d.get_unique_vid("metinstone_1floor_5") then d.set_unique("1floor_halfstone_5", d.spawn_mob_dir(stone_data["vnum_npc"], stone_data["pos"][5]["x"], stone_data["pos"][5]["y"], stone_data["pos"][5]["dir"])); end -- if if (d.getf("1floor_stone_damaged") == 5) then d.setf("Halloween2022_candestroyFStone", 0); d.setf("Halloween2022_killFirstBoss", 1); Halloween2022Dungeon.SpawnFirstBoss(); end -- if end -- when --** --** Kill: First boss to get an item --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["1floor_fboss_data"]["vnum"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_killFirstBoss") == 1 begin local data = Halloween2022Dungeon.GetData(); local StatueItem = data["1floor_item_statue"] local ActivationItem = data["1floor_item_activate"] d.setf("1floor_Firstboss_count", d.getf("1floor_Firstboss_count")+1); d.setf("Halloween2022_killFirstBoss", 0); if (d.getf("1floor_Firstboss_count") <= 2) then d.setf("Halloween2022_canDestroyAngelStatue", 1); game.drop_item(StatueItem, 1); d.notice(string.format("<Bloody cathedral> Use the %s to destroy %s", item_name(StatueItem), mob_name(data["1floor_statue_npc"]))); else game.drop_item(ActivationItem, 1); d.setf("Halloween2022_canActivateSeal", 1); d.notice(string.format("<Bloody cathedral> Use the %s to activate %s", item_name(ActivationItem), mob_name(data["1floor_seal_data"]["vnum_middle"]))); end -- if end -- when --** --** Take: First floor Angel Statue break. --** when 9477.take with item.get_vnum() == Halloween2022Dungeon.GetData()["1floor_item_statue"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_canDestroyAngelStatue") == 1 begin local data = Halloween2022Dungeon.GetData(); d.setf("1floor_angel_statue", d.getf("1floor_angel_statue")+1); d.setf("Halloween2022_canDestroyAngelStatue", 0); npc.kill(); item.remove(); if (d.getf("1floor_angel_statue") == 1) then d.setf("Halloween2022_canDestroySecondStone", 1); for i = 1, 5 do d.purge_unique("1floor_halfstone_"..i); end -- for local stone_data = data["1floor_stone_data"]; local stone_vid = 0; for stone_idx, stone_pos in ipairs(stone_data["pos"]) do d.spawn_mob_dir(stone_data["vnum_half"], stone_pos["x"], stone_pos["y"], stone_pos["dir"]); --d.set_unique(string.format("metinstone_1floor_%d", stone_idx), stone_vid); end -- for d.notice("<Bloody cathedral> You broke the spell! Destroy the stones!"); else game.drop_item(data["1floor_item_activate"], 1); d.setf("Halloween2022_canActivateSeal", 1); d.notice(string.format("<Bloody cathedral> Use the %s to build a part of %s!", item_name(data["1floor_item_activate"]), mob_name(data["1floor_seal_data"]["vnum_small"]))); end -- if end -- when --** --** Kill: Second part of first stone --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["1floor_stone_data"]["vnum_half"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_canDestroySecondStone") == 1 begin local data = Halloween2022Dungeon.GetData(); local stone_data = data["1floor_stone_data"]; d.setf("1floor_stone_destroyed", d.getf("1floor_stone_destroyed")+1); if (d.getf("1floor_stone_destroyed") == 5) then d.setf("Halloween2022_canDestroySecondStone", 0); d.setf("Halloween2022_killFirstBoss", 1); Halloween2022Dungeon.SpawnFirstBoss(); end -- if end -- when --** --** Take: First floor Middle seal activation. --** when 9478.take with item.get_vnum() == Halloween2022Dungeon.GetData()["1floor_item_activate"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_canActivateSeal") == 1 begin local data = Halloween2022Dungeon.GetData(); local seal_data = data["1floor_seal_data"]; item.remove(); d.setf("1floor_seal_state", d.getf("1floor_seal_state")+1); d.setf("Halloween2022_canActivateSeal", 0); d.setf("1floor_monsters", 1); d.spawn_mob_dir(seal_data["vnum_middle"], seal_data["pos"]["x"], seal_data["pos"]["y"], seal_data["pos"]["dir"]); npc.kill(); d.regen_file("data/dungeon/halloween2022_dungeon/1floor_monsters_1.txt"); end -- when --** --** Kill: First floor monsters. --** when kill with not npc.is_pc() and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("1floor_monsters") == 1 begin d.setf("1floor_killed", d.getf("1floor_killed") + 1); local data = Halloween2022Dungeon.GetData(); local wave_num = d.getf("1floor_waves_killed")+1; if (d.getf("1floor_killed") == data["1floor_to_kill"][wave_num]) then d.setf("1floor_killed", 0); d.setf("1floor_monsters", 0); d.setf("1floor_waves_killed", d.getf("1floor_waves_killed")+1); d.purge_area(data["inside_data"]["base"]["x"]*100, data["inside_data"]["base"]["y"]*100, (data["inside_data"]["base"]["x"]+8192)*100, (data["inside_data"]["base"]["y"]+16384)*100); d.notice(string.format("<Bloody cathedral> Wave n.%d vanquished.", wave_num)) if (d.getf("1floor_waves_killed") == 1) then d.setf("1floor_monsters", 1); d.regen_file("data/dungeon/halloween2022_dungeon/1floor_monsters_2.txt"); else game.drop_item(data["1floor_item_activate"], 1); d.setf("Halloween2022_canActivateSeal", 1); d.notice(string.format("<Bloody cathedral> You can now drag the %s onto the %s to destroy it.", item_name(data["1floor_item_activate"]), mob_name(data["1floor_seal_data"]["vnum_middle"]))) end -- if end -- if end -- when --** --** Take: First floor Final seal activation. --** when 9479.take with item.get_vnum() == Halloween2022Dungeon.GetData()["1floor_item_activate"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_canActivateSeal") == 1 begin local data = Halloween2022Dungeon.GetData(); local seal_data = data["1floor_seal_data"]; local FirstBoss_data = data["1floor_fboss_data"]; item.remove(); d.setf("1floor_seal_state", d.getf("1floor_seal_state")+1); d.setf("Halloween2022_canActivateSeal", 0); d.setf("Halloween2022_killFirstBoss", 1); d.spawn_mob_dir(seal_data["vnum_full"], seal_data["pos"]["x"], seal_data["pos"]["y"], seal_data["pos"]["dir"]); npc.kill(); d.spawn_mob(FirstBoss_data["vnum"], FirstBoss_data["pos"]["x"], FirstBoss_data["pos"]["y"]); end -- when --** --** Take: First floor - Seal activation + second floor setting --** when 9480.take with item.get_vnum() == Halloween2022Dungeon.GetData()["1floor_item_activate"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_canActivateSeal") == 1 begin local data = Halloween2022Dungeon.GetData(); item.remove(); d.kill_all(); local npc_data = data["2floor_calyx_data"]; local stone_vid = 0; for npc_idx, npc_pos in ipairs(npc_data["pos"]) do npc_vid = d.spawn_mob_dir(npc_data["vnum_empty"], npc_pos["x"], npc_pos["y"], npc_pos["dir"]); d.set_unique(string.format("2floor_npc%d", npc_idx), npc_vid); end -- for local BossData = data["2floor_fboss_data"] d.spawn_mob_dir(BossData["vnum"], BossData["pos"]["x"], BossData["pos"]["y"], BossData["pos"]["dir"]); d.setf("Halloween2022_floor", 2); d.setf("2floor_canKill_boss", 1); d.notice(string.format("<Bloody cathedral> Fill all %s with blood in exact order!", mob_name(npc_data["vnum_full"]))); d.notice(string.format("<Bloody cathedral> If you will try to fill wrong %s, you have to repeat the task!", mob_name(npc_data["vnum_full"]))); d.notice(string.format("<Bloody cathedral> Kill %s, to be able to fill the first one!", mob_name(BossData["vnum"]))); end -- when --** --** Kill: Second boss to get an item --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["2floor_fboss_data"]["vnum"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 2 and d.getf("2floor_canKill_boss") == 1 begin local data = Halloween2022Dungeon.GetData(); d.setf("2floor_canKill_boss", 0); d.setf("2floor_canFill_calyx", 1); game.drop_item(data["2floor_item"], 1); d.notice(string.format("<Bloody cathedral> You got a %s, let's fill up an %s now!", item_name(data["2floor_item"]), mob_name(data["2floor_calyx_data"]["vnum_empty"]))); end -- when --** --** Take: Second floor - filling calyxes --** when 9482.take with item.get_vnum() == Halloween2022Dungeon.GetData()["2floor_item"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 2 and d.getf("2floor_canFill_calyx") == 1 begin local data = Halloween2022Dungeon.GetData(); local npc_data = data["2floor_calyx_data"]; local stone_data = data["2floor_stone_data"] d.setf("2floor_canFill_calyx", 0); d.setf("2floor_calyx_filled", d.getf("2floor_calyx_filled")+1); item.remove(); if d.getf("2floor_calyx_filled") == 1 then d.setf("2floor_canDestroy_stone", 1); d.setf("2floor_stone_stage", 1); d.spawn_mob_dir(stone_data["vnum"], stone_data["pos"]["x"], stone_data["pos"]["y"], stone_data["pos"]["dir"]); d.notice(string.format("<Bloody cathedral> You filled up correct %s. Destroy %s now to proceed", mob_name(data["2floor_calyx_data"]["vnum_empty"]), mob_name(stone_data["vnum"]))); elseif d.getf("2floor_calyx_filled") == 2 then d.setf("2floor_monsters", 1); d.regen_file("data/dungeon/halloween2022_dungeon/2floor_monsters.txt"); d.notice("<Bloody cathedral> Kill all monsters to proceed!"); elseif d.getf("2floor_calyx_filled") == 3 then d.setf("2floor_canDestroy_stone", 2); d.regen_file("data/dungeon/halloween2022_dungeon/2floor_stones.txt"); d.notice(string.format("<Bloody cathedral> Destroy all %s to proceed!", mob_name(stone_data["vnum"]))); elseif d.getf("2floor_calyx_filled") == 4 then d.notice("<Bloody cathedral> You filled all calyxes. You summoned a mother of vampires! Mother of evil!"); d.notice("<Bloody cathedral> She is coming! Get ready!"); d.purge_area(data["inside_data"]["base"]["x"]*100, data["inside_data"]["base"]["y"]*100, (data["inside_data"]["base"]["x"]+8192)*100, (data["inside_data"]["base"]["y"]+16384)*100); server_timer("final_boss_spawn", data["2floor_final_boss_spawn"], d.get_map_index()); end -- if if npc.get_vid() == d.get_unique_vid("2floor_npc1") then d.spawn_mob_dir(npc_data["vnum_full"], npc_data["pos"][1]["x"], npc_data["pos"][1]["y"], npc_data["pos"][1]["dir"]); d.kill_unique("2floor_npc1"); elseif npc.get_vid() == d.get_unique_vid("2floor_npc2") then d.spawn_mob_dir(npc_data["vnum_full"], npc_data["pos"][2]["x"], npc_data["pos"][2]["y"], npc_data["pos"][2]["dir"]); d.kill_unique("2floor_npc2"); elseif npc.get_vid() == d.get_unique_vid("2floor_npc3") then d.spawn_mob_dir(npc_data["vnum_full"], npc_data["pos"][3]["x"], npc_data["pos"][3]["y"], npc_data["pos"][3]["dir"]); d.kill_unique("2floor_npc3"); elseif npc.get_vid() == d.get_unique_vid("2floor_npc4") then d.spawn_mob_dir(npc_data["vnum_full"], npc_data["pos"][4]["x"], npc_data["pos"][4]["y"], npc_data["pos"][4]["dir"]); d.kill_unique("2floor_npc4"); end -- if end -- when --** --** Kill: Second stone --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["2floor_stone_data"]["vnum"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 2 begin local data = Halloween2022Dungeon.GetData(); local stone_data = data["2floor_stone_data"] if d.getf("2floor_canDestroy_stone") == 1 then d.setf("2floor_canDestroy_stone", 0); d.setf("2floor_canFill_calyx", 1); game.drop_item(data["2floor_item"], 1); d.notice(string.format("<Bloody cathedral> You got a %s, let's fill up an %s now!", item_name(data["2floor_item"]), mob_name(data["2floor_calyx_data"]["vnum_empty"]))); elseif d.getf("2floor_canDestroy_stone") == 2 then d.setf("2floor_stone_count", d.getf("2floor_stone_count")+1); if (d.getf("2floor_stone_count") == stone_data["count_to_destroy"]) then d.setf("2floor_canDestroy_stone", 0); d.setf("2floor_canFill_calyx", 1); game.drop_item(data["2floor_item"], 1); end -- if end -- if end -- when --** --** Kill: Second floor - monsters --** when kill with not npc.is_pc() and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 2 and d.getf("2floor_monsters") == 1 begin d.setf("2floor_killed", d.getf("2floor_killed") + 1); local data = Halloween2022Dungeon.GetData(); if (d.getf("2floor_killed") == data["2floor_to_kill"]) then d.setf("2floor_killed", 0); d.setf("2floor_monsters", 0); d.setf("2floor_canFill_calyx", 1); d.purge_area(data["inside_data"]["base"]["x"]*100, data["inside_data"]["base"]["y"]*100, (data["inside_data"]["base"]["x"]+8192)*100, (data["inside_data"]["base"]["y"]+16384)*100); d.notice(string.format("<Bloody cathedral> You killed all monsters. Fill another %s.", mob_name(data["2floor_calyx_data"]["vnum_empty"]))); game.drop_item(data["2floor_item"], 1); end -- if end -- when --** --** Server Timer: Final boss spawn. --** when final_boss_spawn.server_timer begin if (d.select(get_server_timer_arg())) then local data = Halloween2022Dungeon.GetData(); local boss_data = data["2floor_finalboss_data"] d.setf("2floor_final_boss", 1); d.set_unique("FinalBoss", d.spawn_mob_dir(boss_data["vnum"], boss_data["pos"]["x"], boss_data["pos"]["y"], boss_data["pos"]["dir"])); end -- if end -- when --** --** Kill: Final boss --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["2floor_finalboss_data"]["vnum"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 2 and d.getf("2floor_final_boss") == 1 begin local data = Halloween2022Dungeon.GetData(); local chest_data = data["reward_chest"] if (data["time_out"] > 0) then clear_server_timer("halloween2022_dungeon_time_out", d.get_map_index()); end -- if if (d.getf("dungeon_members_tot") > 1) then --notice_all(string.format("[Dungeon Notice]: %s and their party have completed the `Bloody cathedral` in %s.", pc.get_name(), get_time_format(d.getf("completion_time") - d.getf("start_time")))) notice_all(" "..pc.get_name().." Completed the Bloody Cathedral.") d.setf("can_back_dungeon", 0) -- Deaktivieren else --notice_all(string.format("[Dungeon Notice]: %s has completed the `Bloody cathedral`%s in %s.", pc.get_name(), (data["enter_mode"] == 3 and " without a party" or ""), get_time_format(d.getf("completion_time") - d.getf("start_time")))) notice_all(" "..pc.get_name().." Completed the Bloody Cathedral.") d.setf("can_back_dungeon", 0) -- Deaktivieren end -- if/else if (data["entrance_timer"] > 0) then if (d.getf("dungeon_members_tot") > 1) then for _, pid in ipairs(party_get_member_pids()) do q.begin_other_pc_block(pid); -- pc.setf("Halloween2022Dungeon_zone", "entrance_timer", get_time() + data["entrance_timer"]); -- q.end_other_pc_block(); end -- for d.notice(string.format("<Bloody cathedral> Each one of you will be unable to re-enter the dungeon for %s.", get_time_format(data["entrance_timer"]))) else pc.setf("Halloween2022Dungeon_zone", "entrance_timer", get_time() + data["entrance_timer"]); d.notice(string.format("<Bloody cathedral> You will be unable to re-enter the dungeon for %s.", get_time_format(data["entrance_timer"]))) end -- if/else end -- if clear_dungeon(true); d.setf("2floor_final_boss", 0); d.setf("dungeon_complete", 1); d.spawn_mob_dir(chest_data["vnum"], chest_data["pos"]["x"], chest_data["pos"]["y"], chest_data["pos"]["dir"]); d.setf("can_back_dungeon", 0) -- Deaktivieren d.notice(string.format("<Bloody cathedral> You can take your reward by opening the %s.", mob_name(data["reward_chest"]["vnum"]))) d.notice(string.format("<Bloody cathedral> You will be teleported out of the dungeon in %s.", get_time_format(data["out_room"]))) server_timer("halloween2022_dungeon_out_room", data["out_room"], d.get_map_index()); end -- when when 9484.chat."Take reward" with Halloween2022Dungeon.InDungeon() and d.getf("dungeon_complete") == 1 begin local data = Halloween2022Dungeon.GetData(); local qf = string.format("reward_state_%d", pc.get_player_id()); if (d.getf(qf) == 1) then say_title(string.format("%s:[ENTER]", mob_name(npc.get_race()))) say_reward("You already got your reward.[ENTER]") return; end -- if d.setf(qf, 1); d.setf("can_back_dungeon", 0) -- Deaktivieren pc.give_item2(data["reward_data"]["vnum"], data["reward_data"]["quantity"]); setskin(NOWINDOW); end -- when --** --** Server Timer: Time expiration. --** when halloween2022_dungeon_time_out.server_timer begin if (d.select(get_server_timer_arg())) then local reg_time, cur_time = d.getf("dungeon_time_limit"), get_time(); if (reg_time <= cur_time) then clear_server_timer("halloween2022_dungeon_time_out", get_server_timer_arg()); d.notice("<Bloody cathedral> Time expired.") d.notice("<Bloody cathedral> You will be teleported out of the dungeon.") d.setf("can_back_dungeon", 0) -- Deaktivieren d.exit_all_lobby(); else d.notice(string.format("<Bloody cathedral> Time remaining: %s.", get_time_format(reg_time - cur_time))) end -- if/else end -- if end -- when --** --** Server Timer: Dungeon cleanup. --** when halloween2022_dungeon_out_room.server_timer begin if (d.select(get_server_timer_arg())) then d.notice("<Bloody cathedral> You are getting teleported out of the dungeon.") d.setf("can_back_dungeon", 0) -- Deaktivieren d.exit_all_lobby(); end -- if end -- when end -- state end -- quest Link to comment Share on other sites More sharing options...
caanmasu 311 Posted October 2, 2023 Share Posted October 2, 2023 Looking at your code I think that the dungeon is being adapted to the lobby dungeon system of the WoM2 serverfiles. If you go to questlua_dungeon.cpp, the dungeon_set_flag function receives three parameters: ALUA(dungeon_set_flag) { //if (lua_gettop(L) < 3 || !lua_isnumber(L, 1) || !lua_isstring(L, 2) || !lua_isnumber(L, 3)) if (!lua_isnumber(L, 1) || !lua_isstring(L, 2) || !lua_isnumber(L, 3)) { sys_err("not enough arguments."); return 0; } int32_t mapidx = (int32_t)lua_tonumber(L, 1); LPDUNGEON dungeon = CDungeonManager::instance().FindByMapIndex(mapidx); if (!dungeon) { sys_err("dungeon %d doesn't exist.", mapidx); return 0; } dungeon->SetFlag(lua_tostring(L, 2), (int32_t)lua_tonumber(L, 3)); return 0; } 1: map index 2. flag name 3. flag value Solution: In each d.setf, for example: d.setf("dungeon_expire_time", 0); Change for: d.setf(d.get_map_index(), "dungeon_expire_time", 0); Link to comment Share on other sites More sharing options...
duffisk2w 8 Posted October 2, 2023 Author Share Posted October 2, 2023 (edited) 8 hours ago, caanmasu said: Looking at your code I think that the dungeon is being adapted to the lobby dungeon system of the WoM2 serverfiles. If you go to questlua_dungeon.cpp, the dungeon_set_flag function receives three parameters: 1: map index 2. flag name 3. flag value Solution: In each d.setf, for example: Change for: thank you very much for the advice all functions d_setf i changed d.setf(d.get_map_index(), but the error is still the same dungeon_set_flag: not enough arguments. 54 minutes ago, duffisk2w said: thank you very much for the advice all functions d_setf i changed d.setf(d.get_map_index(), but the error is still the same dungeon_set_flag: not enough arguments. quest halloween2022_dungeon_zone begin state start begin --** --** Login: Dungeon exit coordinates set on dungeon entrance and timers. --** when login begin local data = Halloween2022Dungeon.GetData(); local outside_base = data["outside_data"]["base"][pc.get_empire()]; local outside_pos = data["outside_data"]["pos"][pc.get_empire()]; if (Halloween2022Dungeon.InDungeon()) then pc.set_warp_location(data["outside_data"]["index"][pc.get_empire()], outside_base["x"] + outside_pos["x"], outside_base["y"] + outside_pos["y"]); d.setf(d.get_map_index(), "dungeon_expire_time", 0); if pc.get_map_index() == 161 then if pc.get_map_index() >= 1610000 and pc.get_map_index() < 1619999 then pc.warp(1618700,1255700) end pc.set_warp_location(358, 4864, 3072) elseif pc.get_map_index() >= 1610000 and pc.get_map_index() < 1619999 then pc.set_warp_location(358, 4864, 3072) end if ((party.is_leader() or not party.is_party()) and d.getf("initialized") == 0) then if d.getf("first_regen") == 1 then--already start!!!! return end d.setf(d.get_map_index(), "first_regen", 1) -- set for already regened!!! d.setf(d.get_map_index(), "initialized", 1); d.setf(d.get_map_index(), "Halloween2022_floor", 1); d.setf(d.get_map_index(), "Halloween2022_candestroyFStone", 1); d.setf(d.get_map_index(), "start_time", get_time()); d.setf(d.get_map_index(), "can_back_dungeon", 1) -- active back dungeon when first enter! if (data["time_out"] > 0) then d.setf(d.get_map_index(), "dungeon_time_limit", d.getf("start_time") + data["time_out"]); server_loop_timer("halloween2022_dungeon_time_out", data["time_out_step"], d.get_map_index()); d.notice(string.format("<Bloody cathedral> You have %s to complete the Bloody cathedral.", get_time_format(data["time_out"]))) --d.notice(string.format("<Bloody cathedral> The player '%s' has complete the Bloody cathedral.", pc.get_name())) end -- if local door_data = data["1floor_door_data"]; local seal_data = data["1floor_seal_data"]; local stone_data = data["1floor_stone_data"]; local stone_vid = 0; for stone_idx, stone_pos in ipairs(stone_data["pos"]) do stone_vid = d.spawn_mob_dir(stone_data["vnum_full"], stone_pos["x"], stone_pos["y"], stone_pos["dir"]); d.set_unique(string.format("metinstone_1floor_%d", stone_idx), stone_vid); end -- for d.spawn_mob_dir(door_data["vnum"], door_data["pos"]["x"], door_data["pos"]["y"], door_data["pos"]["dir"]); d.spawn_mob_dir(seal_data["vnum_small"], seal_data["pos"]["x"], seal_data["pos"]["y"], seal_data["pos"]["dir"]); d.regen_file("data/dungeon/halloween2022_dungeon/1floor_statues.txt"); end -- if -- Send the entrance timer as soon as they enter the instance, it will update every time they rejoin, but ultimately this is just a fallback case. -- The real timer gets applied when they kill the final boss. if (data["entrance_timer"] > 0) then pc.setf("Halloween2022Dungeon_zone", "entrance_timer", get_time() + data["entrance_timer"]); end -- if local player_online_qf = string.format("player_online_%d", pc.get_player_id()); if (d.getf(player_online_qf) == 0) then d.setf(player_online_qf, 1); d.setf(d.get_map_index(), "dungeon_members_num", d.getf("dungeon_members_num")+1); -- You can be in a party and still enter the dungeon alone end -- if local player_status_qf = string.format("player_status_%d", pc.get_player_id()); if (d.getf(player_status_qf) == 0) then d.setf(player_status_qf, 1); d.setf(d.get_map_index(), "dungeon_members_tot", d.getf("dungeon_members_tot")+1); end -- if elseif (Halloween2022Dungeon.InMap()) then notice("Dungeon Instance not found.") notice("You'll be teleported out of the map.") pc.warp((outside_base["x"] + outside_pos["x"]) * 100, (outside_base["y"] + outside_pos["y"]) * 100, data["outside_data"]["index"][pc.get_empire()]); end -- if/elseif end -- when --** --** Logout: Item removal. --** when logout with Halloween2022Dungeon.InDungeon() begin local data = Halloween2022Dungeon.GetData(); -- Send the entrance timer as soon as they logout from the instance, it will update every time they rejoin, but ultimately this is just a fallback case. -- The real timer gets applied when they kill the final boss. if (data["entrance_timer"] > 0) then pc.setf("Halloween2022Dungeon_zone", "entrance_timer", get_time() + data["entrance_timer"]); end -- if d.setf(string.format("player_online_%d", pc.get_player_id()), 0); d.setf(d.get_map_index(), "dungeon_members_num", d.getf("dungeon_members_num")-1); if (d.getf("dungeon_members_num") == 0) then d.setf(d.get_map_index(), "dungeon_expire_time", get_time() + time_min_to_sec(5)); end -- if if (d.getf("dungeon_members_tot") > 1) then d.notice(string.format("<Bloody cathedral> The player '%s' has left the dungeon.", pc.get_name())) end -- if -- Item removal here. end -- when --** --** Kill: Metinstones to spawn first boss --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["1floor_stone_data"]["vnum_full"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_candestroyFStone") == 1 begin local data = Halloween2022Dungeon.GetData(); local stone_data = data["1floor_stone_data"]; d.setf(d.get_map_index(), "1floor_stone_damaged", d.getf("1floor_stone_damaged")+1); d.notice("<Bloody cathedral> This stone is under a spell now!"); if npc.get_vid() == d.get_unique_vid("metinstone_1floor_1") then d.set_unique("1floor_halfstone_1", d.spawn_mob_dir(stone_data["vnum_npc"], stone_data["pos"][1]["x"], stone_data["pos"][1]["y"], stone_data["pos"][1]["dir"])); elseif npc.get_vid() == d.get_unique_vid("metinstone_1floor_2") then d.set_unique("1floor_halfstone_2", d.spawn_mob_dir(stone_data["vnum_npc"], stone_data["pos"][2]["x"], stone_data["pos"][2]["y"], stone_data["pos"][2]["dir"])); elseif npc.get_vid() == d.get_unique_vid("metinstone_1floor_3") then d.set_unique("1floor_halfstone_3", d.spawn_mob_dir(stone_data["vnum_npc"], stone_data["pos"][3]["x"], stone_data["pos"][3]["y"], stone_data["pos"][3]["dir"])); elseif npc.get_vid() == d.get_unique_vid("metinstone_1floor_4") then d.set_unique("1floor_halfstone_4", d.spawn_mob_dir(stone_data["vnum_npc"], stone_data["pos"][4]["x"], stone_data["pos"][4]["y"], stone_data["pos"][4]["dir"])); elseif npc.get_vid() == d.get_unique_vid("metinstone_1floor_5") then d.set_unique("1floor_halfstone_5", d.spawn_mob_dir(stone_data["vnum_npc"], stone_data["pos"][5]["x"], stone_data["pos"][5]["y"], stone_data["pos"][5]["dir"])); end -- if if (d.getf("1floor_stone_damaged") == 5) then d.setf(d.get_map_index(), "Halloween2022_candestroyFStone", 0); d.setf(d.get_map_index(), "Halloween2022_killFirstBoss", 1); Halloween2022Dungeon.SpawnFirstBoss(); end -- if end -- when --** --** Kill: First boss to get an item --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["1floor_fboss_data"]["vnum"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_killFirstBoss") == 1 begin local data = Halloween2022Dungeon.GetData(); local StatueItem = data["1floor_item_statue"] local ActivationItem = data["1floor_item_activate"] d.setf(d.get_map_index(), "1floor_Firstboss_count", d.getf("1floor_Firstboss_count")+1); d.setf(d.get_map_index(), "Halloween2022_killFirstBoss", 0); if (d.getf("1floor_Firstboss_count") <= 2) then d.setf(d.get_map_index(), "Halloween2022_canDestroyAngelStatue", 1); game.drop_item(StatueItem, 1); d.notice(string.format("<Bloody cathedral> Use the %s to destroy %s", item_name(StatueItem), mob_name(data["1floor_statue_npc"]))); else game.drop_item(ActivationItem, 1); d.setf(d.get_map_index(), "Halloween2022_canActivateSeal", 1); d.notice(string.format("<Bloody cathedral> Use the %s to activate %s", item_name(ActivationItem), mob_name(data["1floor_seal_data"]["vnum_middle"]))); end -- if end -- when --** --** Take: First floor Angel Statue break. --** when 9477.take with item.get_vnum() == Halloween2022Dungeon.GetData()["1floor_item_statue"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_canDestroyAngelStatue") == 1 begin local data = Halloween2022Dungeon.GetData(); d.setf(d.get_map_index(), "1floor_angel_statue", d.getf("1floor_angel_statue")+1); d.setf(d.get_map_index(), "Halloween2022_canDestroyAngelStatue", 0); npc.kill(); item.remove(); if (d.getf("1floor_angel_statue") == 1) then d.setf(d.get_map_index(), "Halloween2022_canDestroySecondStone", 1); for i = 1, 5 do d.purge_unique("1floor_halfstone_"..i); end -- for local stone_data = data["1floor_stone_data"]; local stone_vid = 0; for stone_idx, stone_pos in ipairs(stone_data["pos"]) do d.spawn_mob_dir(stone_data["vnum_half"], stone_pos["x"], stone_pos["y"], stone_pos["dir"]); --d.set_unique(string.format("metinstone_1floor_%d", stone_idx), stone_vid); end -- for d.notice("<Bloody cathedral> You broke the spell! Destroy the stones!"); else game.drop_item(data["1floor_item_activate"], 1); d.setf(d.get_map_index(), "Halloween2022_canActivateSeal", 1); d.notice(string.format("<Bloody cathedral> Use the %s to build a part of %s!", item_name(data["1floor_item_activate"]), mob_name(data["1floor_seal_data"]["vnum_small"]))); end -- if end -- when --** --** Kill: Second part of first stone --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["1floor_stone_data"]["vnum_half"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_canDestroySecondStone") == 1 begin local data = Halloween2022Dungeon.GetData(); local stone_data = data["1floor_stone_data"]; d.setf(d.get_map_index(), "1floor_stone_destroyed", d.getf("1floor_stone_destroyed")+1); if (d.getf("1floor_stone_destroyed") == 5) then d.setf(d.get_map_index(), "Halloween2022_canDestroySecondStone", 0); d.setf(d.get_map_index(), "Halloween2022_killFirstBoss", 1); Halloween2022Dungeon.SpawnFirstBoss(); end -- if end -- when --** --** Take: First floor Middle seal activation. --** when 9478.take with item.get_vnum() == Halloween2022Dungeon.GetData()["1floor_item_activate"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_canActivateSeal") == 1 begin local data = Halloween2022Dungeon.GetData(); local seal_data = data["1floor_seal_data"]; item.remove(); d.setf(d.get_map_index(), "1floor_seal_state", d.getf("1floor_seal_state")+1); d.setf(d.get_map_index(), "Halloween2022_canActivateSeal", 0); d.setf(d.get_map_index(), "1floor_monsters", 1); d.spawn_mob_dir(seal_data["vnum_middle"], seal_data["pos"]["x"], seal_data["pos"]["y"], seal_data["pos"]["dir"]); npc.kill(); d.regen_file("data/dungeon/halloween2022_dungeon/1floor_monsters_1.txt"); end -- when --** --** Kill: First floor monsters. --** when kill with not npc.is_pc() and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("1floor_monsters") == 1 begin d.setf(d.get_map_index(), "1floor_killed", d.getf("1floor_killed") + 1); local data = Halloween2022Dungeon.GetData(); local wave_num = d.getf("1floor_waves_killed")+1; if (d.getf("1floor_killed") == data["1floor_to_kill"][wave_num]) then d.setf(d.get_map_index(), "1floor_killed", 0); d.setf(d.get_map_index(), "1floor_monsters", 0); d.setf(d.get_map_index(), "1floor_waves_killed", d.getf("1floor_waves_killed")+1); d.purge_area(data["inside_data"]["base"]["x"]*100, data["inside_data"]["base"]["y"]*100, (data["inside_data"]["base"]["x"]+8192)*100, (data["inside_data"]["base"]["y"]+16384)*100); d.notice(string.format("<Bloody cathedral> Wave n.%d vanquished.", wave_num)) if (d.getf("1floor_waves_killed") == 1) then d.setf(d.get_map_index(), "1floor_monsters", 1); d.regen_file("data/dungeon/halloween2022_dungeon/1floor_monsters_2.txt"); else game.drop_item(data["1floor_item_activate"], 1); d.setf(d.get_map_index(), "Halloween2022_canActivateSeal", 1); d.notice(string.format("<Bloody cathedral> You can now drag the %s onto the %s to destroy it.", item_name(data["1floor_item_activate"]), mob_name(data["1floor_seal_data"]["vnum_middle"]))) end -- if end -- if end -- when --** --** Take: First floor Final seal activation. --** when 9479.take with item.get_vnum() == Halloween2022Dungeon.GetData()["1floor_item_activate"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_canActivateSeal") == 1 begin local data = Halloween2022Dungeon.GetData(); local seal_data = data["1floor_seal_data"]; local FirstBoss_data = data["1floor_fboss_data"]; item.remove(); d.setf(d.get_map_index(), "1floor_seal_state", d.getf("1floor_seal_state")+1); d.setf(d.get_map_index(), "Halloween2022_canActivateSeal", 0); d.setf(d.get_map_index(), "Halloween2022_killFirstBoss", 1); d.spawn_mob_dir(seal_data["vnum_full"], seal_data["pos"]["x"], seal_data["pos"]["y"], seal_data["pos"]["dir"]); npc.kill(); d.spawn_mob(FirstBoss_data["vnum"], FirstBoss_data["pos"]["x"], FirstBoss_data["pos"]["y"]); end -- when --** --** Take: First floor - Seal activation + second floor setting --** when 9480.take with item.get_vnum() == Halloween2022Dungeon.GetData()["1floor_item_activate"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 1 and d.getf("Halloween2022_canActivateSeal") == 1 begin local data = Halloween2022Dungeon.GetData(); item.remove(); d.kill_all(); local npc_data = data["2floor_calyx_data"]; local stone_vid = 0; for npc_idx, npc_pos in ipairs(npc_data["pos"]) do npc_vid = d.spawn_mob_dir(npc_data["vnum_empty"], npc_pos["x"], npc_pos["y"], npc_pos["dir"]); d.set_unique(string.format("2floor_npc%d", npc_idx), npc_vid); end -- for local BossData = data["2floor_fboss_data"] d.spawn_mob_dir(BossData["vnum"], BossData["pos"]["x"], BossData["pos"]["y"], BossData["pos"]["dir"]); d.setf(d.get_map_index(), "Halloween2022_floor", 2); d.setf(d.get_map_index(), "2floor_canKill_boss", 1); d.notice(string.format("<Bloody cathedral> Fill all %s with blood in exact order!", mob_name(npc_data["vnum_full"]))); d.notice(string.format("<Bloody cathedral> If you will try to fill wrong %s, you have to repeat the task!", mob_name(npc_data["vnum_full"]))); d.notice(string.format("<Bloody cathedral> Kill %s, to be able to fill the first one!", mob_name(BossData["vnum"]))); end -- when --** --** Kill: Second boss to get an item --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["2floor_fboss_data"]["vnum"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 2 and d.getf("2floor_canKill_boss") == 1 begin local data = Halloween2022Dungeon.GetData(); d.setf(d.get_map_index(), "2floor_canKill_boss", 0); d.setf(d.get_map_index(), "2floor_canFill_calyx", 1); game.drop_item(data["2floor_item"], 1); d.notice(string.format("<Bloody cathedral> You got a %s, let's fill up an %s now!", item_name(data["2floor_item"]), mob_name(data["2floor_calyx_data"]["vnum_empty"]))); end -- when --** --** Take: Second floor - filling calyxes --** when 9482.take with item.get_vnum() == Halloween2022Dungeon.GetData()["2floor_item"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 2 and d.getf("2floor_canFill_calyx") == 1 begin local data = Halloween2022Dungeon.GetData(); local npc_data = data["2floor_calyx_data"]; local stone_data = data["2floor_stone_data"] d.setf(d.get_map_index(), "2floor_canFill_calyx", 0); d.setf(d.get_map_index(), "2floor_calyx_filled", d.getf("2floor_calyx_filled")+1); item.remove(); if d.getf("2floor_calyx_filled") == 1 then d.setf(d.get_map_index(), "2floor_canDestroy_stone", 1); d.setf(d.get_map_index(), "2floor_stone_stage", 1); d.spawn_mob_dir(stone_data["vnum"], stone_data["pos"]["x"], stone_data["pos"]["y"], stone_data["pos"]["dir"]); d.notice(string.format("<Bloody cathedral> You filled up correct %s. Destroy %s now to proceed", mob_name(data["2floor_calyx_data"]["vnum_empty"]), mob_name(stone_data["vnum"]))); elseif d.getf("2floor_calyx_filled") == 2 then d.setf(d.get_map_index(), "2floor_monsters", 1); d.regen_file("data/dungeon/halloween2022_dungeon/2floor_monsters.txt"); d.notice("<Bloody cathedral> Kill all monsters to proceed!"); elseif d.getf("2floor_calyx_filled") == 3 then d.setf(d.get_map_index(), "2floor_canDestroy_stone", 2); d.regen_file("data/dungeon/halloween2022_dungeon/2floor_stones.txt"); d.notice(string.format("<Bloody cathedral> Destroy all %s to proceed!", mob_name(stone_data["vnum"]))); elseif d.getf("2floor_calyx_filled") == 4 then d.notice("<Bloody cathedral> You filled all calyxes. You summoned a mother of vampires! Mother of evil!"); d.notice("<Bloody cathedral> She is coming! Get ready!"); d.purge_area(data["inside_data"]["base"]["x"]*100, data["inside_data"]["base"]["y"]*100, (data["inside_data"]["base"]["x"]+8192)*100, (data["inside_data"]["base"]["y"]+16384)*100); server_timer("final_boss_spawn", data["2floor_final_boss_spawn"], d.get_map_index()); end -- if if npc.get_vid() == d.get_unique_vid("2floor_npc1") then d.spawn_mob_dir(npc_data["vnum_full"], npc_data["pos"][1]["x"], npc_data["pos"][1]["y"], npc_data["pos"][1]["dir"]); d.kill_unique("2floor_npc1"); elseif npc.get_vid() == d.get_unique_vid("2floor_npc2") then d.spawn_mob_dir(npc_data["vnum_full"], npc_data["pos"][2]["x"], npc_data["pos"][2]["y"], npc_data["pos"][2]["dir"]); d.kill_unique("2floor_npc2"); elseif npc.get_vid() == d.get_unique_vid("2floor_npc3") then d.spawn_mob_dir(npc_data["vnum_full"], npc_data["pos"][3]["x"], npc_data["pos"][3]["y"], npc_data["pos"][3]["dir"]); d.kill_unique("2floor_npc3"); elseif npc.get_vid() == d.get_unique_vid("2floor_npc4") then d.spawn_mob_dir(npc_data["vnum_full"], npc_data["pos"][4]["x"], npc_data["pos"][4]["y"], npc_data["pos"][4]["dir"]); d.kill_unique("2floor_npc4"); end -- if end -- when --** --** Kill: Second stone --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["2floor_stone_data"]["vnum"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 2 begin local data = Halloween2022Dungeon.GetData(); local stone_data = data["2floor_stone_data"] if d.getf("2floor_canDestroy_stone") == 1 then d.setf(d.get_map_index(), "2floor_canDestroy_stone", 0); d.setf(d.get_map_index(), "2floor_canFill_calyx", 1); game.drop_item(data["2floor_item"], 1); d.notice(string.format("<Bloody cathedral> You got a %s, let's fill up an %s now!", item_name(data["2floor_item"]), mob_name(data["2floor_calyx_data"]["vnum_empty"]))); elseif d.getf("2floor_canDestroy_stone") == 2 then d.setf(d.get_map_index(), "2floor_stone_count", d.getf("2floor_stone_count")+1); if (d.getf("2floor_stone_count") == stone_data["count_to_destroy"]) then d.setf(d.get_map_index(), "2floor_canDestroy_stone", 0); d.setf(d.get_map_index(), "2floor_canFill_calyx", 1); game.drop_item(data["2floor_item"], 1); end -- if end -- if end -- when --** --** Kill: Second floor - monsters --** when kill with not npc.is_pc() and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 2 and d.getf("2floor_monsters") == 1 begin d.setf(d.get_map_index(), "2floor_killed", d.getf("2floor_killed") + 1); local data = Halloween2022Dungeon.GetData(); if (d.getf("2floor_killed") == data["2floor_to_kill"]) then d.setf(d.get_map_index(), "2floor_killed", 0); d.setf(d.get_map_index(), "2floor_monsters", 0); d.setf(d.get_map_index(), "2floor_canFill_calyx", 1); d.purge_area(data["inside_data"]["base"]["x"]*100, data["inside_data"]["base"]["y"]*100, (data["inside_data"]["base"]["x"]+8192)*100, (data["inside_data"]["base"]["y"]+16384)*100); d.notice(string.format("<Bloody cathedral> You killed all monsters. Fill another %s.", mob_name(data["2floor_calyx_data"]["vnum_empty"]))); game.drop_item(data["2floor_item"], 1); end -- if end -- when --** --** Server Timer: Final boss spawn. --** when final_boss_spawn.server_timer begin if (d.select(get_server_timer_arg())) then local data = Halloween2022Dungeon.GetData(); local boss_data = data["2floor_finalboss_data"] d.setf(d.get_map_index(), "2floor_final_boss", 1); d.set_unique("FinalBoss", d.spawn_mob_dir(boss_data["vnum"], boss_data["pos"]["x"], boss_data["pos"]["y"], boss_data["pos"]["dir"])); end -- if end -- when --** --** Kill: Final boss --** when kill with npc.get_race() == Halloween2022Dungeon.GetData()["2floor_finalboss_data"]["vnum"] and Halloween2022Dungeon.InDungeon() and d.getf("Halloween2022_floor") == 2 and d.getf("2floor_final_boss") == 1 begin local data = Halloween2022Dungeon.GetData(); local chest_data = data["reward_chest"] if (data["time_out"] > 0) then clear_server_timer("halloween2022_dungeon_time_out", d.get_map_index()); end -- if if (d.getf("dungeon_members_tot") > 1) then --notice_all(string.format("[Dungeon Notice]: %s and their party have completed the `Bloody cathedral` in %s.", pc.get_name(), get_time_format(d.getf("completion_time") - d.getf("start_time")))) notice_all(" "..pc.get_name().." Completed the Bloody Cathedral.") d.setf(d.get_map_index(), "can_back_dungeon", 0) -- Deaktivieren else --notice_all(string.format("[Dungeon Notice]: %s has completed the `Bloody cathedral`%s in %s.", pc.get_name(), (data["enter_mode"] == 3 and " without a party" or ""), get_time_format(d.getf("completion_time") - d.getf("start_time")))) notice_all(" "..pc.get_name().." Completed the Bloody Cathedral.") d.setf(d.get_map_index(), "can_back_dungeon", 0) -- Deaktivieren end -- if/else if (data["entrance_timer"] > 0) then if (d.getf("dungeon_members_tot") > 1) then for _, pid in ipairs(party_get_member_pids()) do q.begin_other_pc_block(pid); -- pc.setf("Halloween2022Dungeon_zone", "entrance_timer", get_time() + data["entrance_timer"]); -- q.end_other_pc_block(); end -- for d.notice(string.format("<Bloody cathedral> Each one of you will be unable to re-enter the dungeon for %s.", get_time_format(data["entrance_timer"]))) else pc.setf("Halloween2022Dungeon_zone", "entrance_timer", get_time() + data["entrance_timer"]); d.notice(string.format("<Bloody cathedral> You will be unable to re-enter the dungeon for %s.", get_time_format(data["entrance_timer"]))) end -- if/else end -- if clear_dungeon(true); d.setf(d.get_map_index(), "2floor_final_boss", 0); d.setf(d.get_map_index(), "dungeon_complete", 1); d.spawn_mob_dir(chest_data["vnum"], chest_data["pos"]["x"], chest_data["pos"]["y"], chest_data["pos"]["dir"]); d.setf(d.get_map_index(), "can_back_dungeon", 0) -- Deaktivieren d.notice(string.format("<Bloody cathedral> You can take your reward by opening the %s.", mob_name(data["reward_chest"]["vnum"]))) d.notice(string.format("<Bloody cathedral> You will be teleported out of the dungeon in %s.", get_time_format(data["out_room"]))) server_timer("halloween2022_dungeon_out_room", data["out_room"], d.get_map_index()); end -- when when 9484.chat."Take reward" with Halloween2022Dungeon.InDungeon() and d.getf("dungeon_complete") == 1 begin local data = Halloween2022Dungeon.GetData(); local qf = string.format("reward_state_%d", pc.get_player_id()); if (d.getf(qf) == 1) then say_title(string.format("%s:[ENTER]", mob_name(npc.get_race()))) say_reward("You already got your reward.[ENTER]") return; end -- if d.setf(qf, 1); d.setf(d.get_map_index(), "can_back_dungeon", 0) -- Deaktivieren pc.give_item2(data["reward_data"]["vnum"], data["reward_data"]["quantity"]); setskin(NOWINDOW); end -- when --** --** Server Timer: Time expiration. --** when halloween2022_dungeon_time_out.server_timer begin if (d.select(get_server_timer_arg())) then local reg_time, cur_time = d.getf("dungeon_time_limit"), get_time(); if (reg_time <= cur_time) then clear_server_timer("halloween2022_dungeon_time_out", get_server_timer_arg()); d.notice("<Bloody cathedral> Time expired.") d.notice("<Bloody cathedral> You will be teleported out of the dungeon.") d.setf(d.get_map_index(), "can_back_dungeon", 0) -- Deaktivieren d.exit_all(); else d.notice(string.format("<Bloody cathedral> Time remaining: %s.", get_time_format(reg_time - cur_time))) end -- if/else end -- if end -- when --** --** Server Timer: Dungeon cleanup. --** when halloween2022_dungeon_out_room.server_timer begin if (d.select(get_server_timer_arg())) then d.notice("<Bloody cathedral> You are getting teleported out of the dungeon.") d.setf(d.get_map_index(), "can_back_dungeon", 0) -- Deaktivieren d.exit_all(); end -- if end -- when end -- state end -- quest Edited October 2, 2023 by duffisk2w Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now