Help creating stores with makeEntity

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Posts: 71
Joined: Tue Jan 15, 2013 7:01 am

Help creating stores with makeEntity

#1 Post by EatThisShoe »

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:

Code: Select all

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:

Code: Select all


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.

Post Reply