return function(mod) local blocks = {} for i = 1, 30 do blocks[i] = 10 end blocks[8], blocks[9] = 11, 11 local pallet = mod.content.maps:get("PALLET_TOWN") local palletBlocks = {} for i, block in ipairs(pallet.blocks) do palletBlocks[i] = block end palletBlocks[7 * pallet.width] = 10 mod.content.maps:register("TUTORIAL_ROUTE", { id = "TUTORIAL_ROUTE", label = "TutorialRoute", index = 1000, tileset = "OVERWORLD", width = 6, height = 5, blocks = blocks, borderBlock = 10, connections = { west = { map = "PALLET_TOWN", offset = -2 } }, objects = { { index = 91, x = 4, y = 2, sprite = "SPRITE_POKE_BALL", movement = "STAY", range = "NONE", item = "NUGGET", text = "TEXT_TUTORIAL_NUGGET", name = "TUTORIAL_ROUTE_NUGGET", }, }, }) mod.content.maps:patch("PALLET_TOWN", { connections = { east = { map = "TUTORIAL_ROUTE", offset = 2 } }, blocks = palletBlocks, objects = { __append = { { index = 90, x = 8, y = 7, sprite = "SPRITE_BEAUTY", movement = "STAY", range = "NONE", text = "TEXT_TUTORIAL_WORLD", name = "TUTORIAL_WORLD_NPC", }, { index = 92, x = 12, y = 8, sprite = "SPRITE_SCIENTIST", movement = "STAY", range = "NONE", text = "TEXT_TUTORIAL_QUEST", name = "TUTORIAL_QUEST_GIVER", }, } }, }) mod.content.encounters:register("TUTORIAL_ROUTE", { grass = { rate = 25, slots = { { species = "PIDGEY", level = 3 }, { species = "RATTATA", level = 3 }, { species = "PIDGEY", level = 4 }, { species = "RATTATA", level = 4 }, { species = "PIDGEY", level = 5 }, { species = "RATTATA", level = 5 }, { species = "PIDGEY", level = 3 }, { species = "RATTATA", level = 3 }, { species = "PIDGEY", level = 6 }, { species = "RATTATA", level = 6 }, } }, }) mod.content.map_scripts:register("PALLET_TOWN", { talk = { TEXT_TUTORIAL_WORLD = { { "face_player" }, { "show_text", "Welcome to the\nTutorial World!" }, }, TEXT_TUTORIAL_QUEST = { { "push_screen", "TutorialQuestLog" }, { "check_flag", "mod:done" }, { "jump_if_true", "thanks" }, { "check_flag", "mod:stage" }, { "jump_if_true", "pending" }, { "set_field", "mod:stage", true }, { "show_text", "Please bring me\na NUGGET." }, { "jump", "end" }, { "label", "pending" }, { "check_item", "NUGGET" }, { "jump_if_false", "wait" }, { "take_item", "NUGGET", 1 }, { "set_field", "mod:done", true }, { "show_text", "Quest complete!" }, { "jump", "end" }, { "label", "wait" }, { "show_text", "The NUGGET is on\nTUTORIAL ROUTE." }, { "jump", "end" }, { "label", "thanks" }, { "show_text", "Thanks again!" }, { "label", "end" }, }, }, }) mod.content.screens:register("TutorialQuestLog", { new = function(game) local Font = mod.ui.Font local state = { isOpaque = true } function state:update() if game.input:wasPressed("b") then game.stack:pop() end end function state:draw() Font.drawBox(0, 0, 20, 18) Font.draw("QUEST LOG", 16, 16) local status if mod.save:get("done", false) then status = "NUGGET QUEST: DONE" elseif mod.save:get("stage", false) then status = "NUGGET QUEST: ACTIVE" else status = "NUGGET QUEST: NOT STARTED" end Font.draw(status, 16, 40) Font.draw("PRESS B TO EXIT", 16, 128) end return state end, }) mod.hooks:wrap("ui.start_menu.items", function(next, game, items) local out = next(game, items) if type(out) ~= "table" then return out end return mod.ui.insertBefore(out, "OPTION", { label = "QUESTS", onSelect = function() mod.ui.push(game, "TutorialQuestLog") end, }) end) end