Help: How to correctly add a new dungeon entrance to the Maj’Eyal overworld (my hook does not fire)

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
WIZARDING_WIZARD
Posts: 1
Joined: Wed Nov 26, 2025 3:12 pm

Help: How to correctly add a new dungeon entrance to the Maj’Eyal overworld (my hook does not fire)

#1 Post by WIZARDING_WIZARD »

Hi everyone,

I’m working on an addon that adds a new dungeon to the Maj’Eyal overworld.
I cannot get the overworld entrance to appear, I cannot figure out why my placement hook never runs or why it does not work
I want to place a volcano entrance on the West overworld at specific coordinates. The addon loads with no errors. All I want is to place a visible volcano icon on the Maj’Eyal overworld at (62,40) that loads my custom zone:
Is there anything wrong with my hook structure
Any help or examples of best practice for placing new overworld dungeons would be greatly appreciated!

Here is my current hooks/load.lua:



local class = require "engine.class"
local Map = require "engine.Map"
local Grid = require "mod.class.Grid"
local colors = require "engine.colors"

class:bindHook("Game:loaded", function(self, data)
game:onLevelLoad("wilderness", function(zone, level)
local map = level.map
if not map then return end

if level.ashen_lock_added then return end
level.ashen_lock_added = true

local x, y = 62, 40

map:addSpot{
x = x, y = y,
type = "zone-pop",
subtype = "ashen-lock",
change_zone = "ashen-lock",
change_level = 1,
}

local caldera = Grid.new{
name = "Ashen Caldera",
display = "&",
color = colors.LIGHT_RED,
image = "terrain/lava/volcano_01.png",
add_mos = { { image = "terrain/lava/volcano_02.png" } },
show_tooltip = true,
notice = true,
change_zone = "ashen-lock",
change_level = 1,
}

map(x, y, Map.TERRAIN, caldera)
end)
end)

Zizzo
Sher'Tul Godslayer
Posts: 2546
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: Help: How to correctly add a new dungeon entrance to the Maj’Eyal overworld (my hook does not fire)

#2 Post by Zizzo »

Well, I can tell you why your code doesn't work: there's no "Game:loaded" hook. :wink: You're probably aiming for the "ToME:load" hook, but I don't remember whether the Game:​onLevelLoad() infrastructure has been set up by that point.

If you're looking to add a zone entrance to the world map, there are two approaches I could suggest:
  • A map overlay, via the 'MapGeneratorStatic:subgenRegister' hook. You can see, for instance, my Recalling Home addon for an example.
  • An event, like the one that adds the Noxious Caldera zone entrance to the map. You can see my Melinda on the Map addon for an example of how to use the 'Zone:loadEvents' hook to add the event.
(Also, just for future reference, you'll usually want to wrap code samples like this in [​code]…[​/code] to make it easier to read.)
"Blessed are the yeeks, for they shall inherit Arda..."

Post Reply