ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Sun Apr 11, 2021 9:52 am

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Apr 30, 2015 11:26 am 

Joined: Tue Jan 15, 2013 7:01 am
Posts: 71
I'm trying to make an addon that randomly generates stores. I can make traps, and I can make stores using makeEntityByName, but I cannot seem to figure out how to make stores with makeEntity.

The generator code is pretty simple just to test, half copied from the random trap generator:
require "engine.class"
local Map = require "engine.Map"
require "engine.Generator"
module(..., package.seeall, class.inherit(engine.Generator))

function _M:init(zone, map, level)
   engine.Generator.init(self, zone, map, level)
   local data =

   self.filters = data.filters
   self.nb_trap = data.nb_trap or {10, 20}
   self.level_range = data.level_range or {level, level}

function _M:generate()

function _M:generate()
   local o =, "trap", nil, nil, true)
--   local o =, "trap", "HEAVY_ARMOR_STORE", true), o, "trap", 1, 1)

and traps.lua for the zone:

newEntity{ base = "BASE_STORE", define_as = "HEAVY_ARMOR_STORE",
   name="Hormond & Son Plates",
   display='2', color=colors.UMBER,"HEAVY_ARMOR", "allied-kingdoms", "store/shop_door.png", "store/shop_sign_hormond_sons.png"),

I pretty much just copied a store from Last Hope.

When I add other traps to the traps.lua file then it always generates those traps. When the store is the only trap available I get a lua error because makeEntity is returning nil. My best guess is that makeEntity is not loading the store onto its' list of possible traps, but I'm not sure why.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group