Well... As far as I know, you have to stick to the classes; you have to define each object as the class of choice. But what you can do for for a complex set of objects that all have to show up in the same cell with the same facing, is write a script for it.chaoscommencer wrote:Sorry I didn't catch that; I just sort of assumed he was using an alcove for the patch area as well. Actually is there a way to instantiate two items as one? In this case for example he needs a lever and an alcove for this patchable gas flow controller. Can you define an object type that inherits both lever and alcove? Or do you need to manually place both objects? I've seen this problem pop up in other places too like with Skuggasveinn's town door. Anything really that you need to place two or more objects to get all the desired functionality.
For example: Say you want a button, and two decorations to be placed as a set. You can place a script object that spawns all of those items in relation to each other.
Like this...
Code: Select all
-- In the script Object; named 'MyScriptedSet'
spawn('wall_button', MyScriptedSet.level, MyScriptedSet.x, MyScriptedSet.y, MyScriptedSet.facing)
spawn('dungeon_ivy_2', MyScriptedSet.level,MyScriptedSet.x, MyScriptedSet.y, MyScriptedSet.facing)
spawn('gobelin', MyScriptedSet.level, MyScriptedSet.x, MyScriptedSet.y, MyScriptedSet.facing)
A variation of this is to rewrite the script to be called by other scripts, and use their location and facing; this cuts down on duplicate code; because you don't need copies of the spawned-set script everywhere, just ones that call it.
Code: Select all
-- Script object named 'myTemplate'
function createSet(caller)
spawn('wall_button', caller.level, caller.x, caller.y, caller.facing)
spawn('dungeon_ivy_2', caller.level,caller.x, caller.y, caller.facing)
spawn('gobelin', caller.level, caller.x, caller.y, caller.facing)
end
Code: Select all
myTemplate.createSet(self)
Here is a more practical use for it:
Put this in a script by a wall, facing away from it.
Code: Select all
if not extinguished_torch then
spawn('torch_holder', self.level, self.x, self.y, self.facing, 'extinguished_torch')
extinguished_torch:addItem(spawn('torch'))
extinguished_torch:destroy()
spawn('torch_holder', self.level, self.x, self.y, self.facing, 'extinguished_torch')
end
Code: Select all
spawn('torch_holder', self.level, self.x, self.y, self.facing):addItem(spawn('torch')):destroy()
spawn('torch_holder', self.level, self.x, self.y, self.facing)