Lua API

LuaMapGenerator classmod

A class used in map generation.

Methods

LuaMapGenerator:stood_world_map_tile () Gets the world map tile the player was standing on when they entered the map being generated.
LuaMapGenerator:is_first_generation () Returns true if the map is being generated for the first time, across all regenerations.
LuaMapGenerator:is_deepest_level () Returns true if the current dungeon level is the deepest in this map.
LuaMapGenerator:create (width, height) Creates a blank map of the specified size.
LuaMapGenerator:load_custom (map_name) Loads a custom map with the given name.
LuaMapGenerator:generate_nefia () Generates a random nefia (dungeon).
LuaMapGenerator:set_name (name) Sets the created map's name.
LuaMapGenerator:set_tileset (tileset_id) Initializes the created map's tileset.
LuaMapGenerator:set_stair_up_pos (x, y) Sets the position of the stairs up in the created map.
LuaMapGenerator:set_stair_down_pos (x, y) Sets the position of the stairs down in the created map.
LuaMapGenerator:set_entrance_type (type) Sets the created map's entrance type.
LuaMapGenerator:set_no_aggro_refresh (flag) Sets the created map's no aggro refresh flag.
LuaMapGenerator:place_player () Sets the position of the player based on the entrance type.
LuaMapGenerator:place_player_xy (x, y) Sets the position of the player to the given coordinates and updates the entrance type accordingly.
LuaMapGenerator:update_quests_in_map () Creates new quests for the characters in the created map if necessary.
LuaMapGenerator:mark_quest_targets () Marks all characters in this map as being enemies and quest targets.
LuaMapGenerator:initialize_world_map () Initializes this map as a world map,

Methods

# LuaMapGenerator:stood_world_map_tile ()

Gets the world map tile the player was standing on when they entered the map being generated.

Returns:
  • (num) the tile ID
# LuaMapGenerator:is_first_generation ()

Returns true if the map is being generated for the first time, across all regenerations.

Returns:
  • (bool)
# LuaMapGenerator:is_deepest_level ()

Returns true if the current dungeon level is the deepest in this map.

Returns:
  • (bool)
# LuaMapGenerator:create (width, height)

Creates a blank map of the specified size.

Parameters:
  • width : (num)
  • height : (num)
# LuaMapGenerator:load_custom (map_name)

Loads a custom map with the given name.

Parameters:
  • map_name : (string)
# LuaMapGenerator:generate_nefia ()

Generates a random nefia (dungeon).

# LuaMapGenerator:set_name (name)

Sets the created map's name.

Parameters:
  • name : (string)
# LuaMapGenerator:set_tileset (tileset_id)

Initializes the created map's tileset.

Parameters:
  • tileset_id : (num)
# LuaMapGenerator:set_stair_up_pos (x, y)

Sets the position of the stairs up in the created map.

Parameters:
  • x : (num)
  • y : (num)
# LuaMapGenerator:set_stair_down_pos (x, y)

Sets the position of the stairs down in the created map.

Parameters:
  • x : (num)
  • y : (num)
# LuaMapGenerator:set_entrance_type (type)

Sets the created map's entrance type.

Parameters:
  • type : (Enums.EntranceType)
# LuaMapGenerator:set_no_aggro_refresh (flag)

Sets the created map's no aggro refresh flag.

If true, characters will not have their enemyid and hate reset after map initialization. Set this flag to true if you change the "enemyid" or "hate" fields of any characters in the generation function.

Parameters:
  • flag : (bool)
# LuaMapGenerator:place_player ()

Sets the position of the player based on the entrance type.

# LuaMapGenerator:place_player_xy (x, y)

Sets the position of the player to the given coordinates and updates the entrance type accordingly.

Parameters:
  • x : (num)
  • y : (num)
# LuaMapGenerator:update_quests_in_map ()

Creates new quests for the characters in the created map if necessary.

# LuaMapGenerator:mark_quest_targets ()

Marks all characters in this map as being enemies and quest targets.

# LuaMapGenerator:initialize_world_map ()

Initializes this map as a world map,