From 423a6264dda598b1ba87ffce35001bc62fe928ac Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 4 Jun 2022 17:17:18 -0300 Subject: Include Dungeon Map - Now you can find RANDOM DUNGEONS! --- npc/items/shovel.txt | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'npc/items/shovel.txt') diff --git a/npc/items/shovel.txt b/npc/items/shovel.txt index 7cf2ac213..ed1f464c5 100644 --- a/npc/items/shovel.txt +++ b/npc/items/shovel.txt @@ -472,3 +472,73 @@ function script shovel_genrandtreasure { return; } +// [Dungeon Map] functions + +function script shovel_randomdungeon { + // If you don't have the map, stop + delitem DungeonMap, 1; + + // Determine the dungeon size + if (ShovelQuests_DungeonMAP$ == "032-2" && REBIRTH) + .@mz = (MAZE_SIZE_X | MAZE_SIZE_A); + else if (ShovelQuests_DungeonMAP$ == "032-2") + .@mz = (MAZE_SIZE_G | MAZE_SIZE_X); + else if (REBIRTH) + .@mz = (MAZE_SIZE_M | MAZE_SIZE_G); + else + .@mz = (MAZE_SIZE_S | MAZE_SIZE_M); + + // Create the Maze + CreateMaze(IOT_CHAR, .@mz); + MazeMobs((BaseLevel*8/10), false, rand2(20, 24)); + + // Prepare the chest array + if (.@mz & MAZE_SIZE_A) + array_push(.@mob, SupremeChest); + if (.@mz & MAZE_SIZE_X) + array_push(.@mob, PrismChest); + if (.@mz & MAZE_SIZE_G) + array_push(.@mob, GoldenChest); + if (.@mz & MAZE_SIZE_M) + array_push(.@mob, SilverChest); + if (.@mz & MAZE_SIZE_S) + array_push(.@mob, BronzeChest); + + // Spawn & Configure the boss monster + .@mx=getmapinfo(MAPINFO_SIZE_X, MAZE_MAP$)-20; + .@my=getmapinfo(MAPINFO_SIZE_Y, MAZE_MAP$)-20; + .@mob=areamonster(MAZE_MAP$, .@mx/2, .@my/2, .@mx, .@my, "Treasure Chest", any_of(.@mob), 1, "Emergency Exit::OnTalk"); + + InitMaze(4800, true, true); // 1h30, random start, with treasure chest + + // Cleanup old variables and exit + ShovelQuests_DungeonMAP$=""; + ShovelQuests_DungeonX=0; + ShovelQuests_DungeonY=0; + dispbottom l("Now, to find the treasure chest!"); + closeclientdialog; + return; +} + +function script shovel_genranddungeon { + if (getq(LoFQuest_EPISODE) >= 16) + .@m$=any("007-1", "011-1", "015-1", "018-1", "032-2", + "007-1", "011-1", "015-1", "018-1"); + else + .@m$=any("007-1", "011-1", "015-1", "018-1"); + // Dangerous + do { + .@x=rand2(20, getmapinfo(MAPINFO_SIZE_X, .@m$)-20); + .@y=rand2(20, getmapinfo(MAPINFO_SIZE_Y, .@m$)-20); + } while (!checkcell(.@m$, .@x, .@y, cell_chkpass)); + + // Success + if (checkcell(.@m$, .@x, .@y, cell_chkpass)) { + shovel_addquest(.@m$, .@x, .@y, "shovel_randomdungeon"); + ShovelQuests_DungeonMAP$=shovel_getcity(.@m$); + ShovelQuests_DungeonX=.@x; + ShovelQuests_DungeonY=.@y; + } + return; +} + -- cgit v1.2.3-60-g2f50