Building: Auto Objects

Auto Objects

Auto objects are for creating copies of objects automatically on load or reset time. This can be used for scenery, for equipment, and many other purposes.

Rather than either manually creating or copying objects for this, you can use the "auto" array. The auto ID contains subelements which are JSON maps with these properties.

Property Function
item The ID of the object to clone
count The number of clones auto auto.n to make
worn If set to 1, make the owner of this object wear it (if possible)
wield If set to 1, make the owner of this object wield it
hold If set to 1, make the owner of this object hold it
mount If set to 1, make the owner of this object mount it
invis Set to 1 or 0, controls the state of the Invisible flag on the clone(s)
state Sets the initial state of the clone(s)
seatfor If set to the ID of a mobile with the same owner, makes them sit on it
bedfor If set to the ID of a mobile with the same owner, makes them sleep on it
start Start is the ID of the location that the object should start! This is used to create auto objects inside other zones, or inside other auto objects. especially in combination with the props property.
props Props is a json dictionary to apply to the cloned object as an override. This allows you to override particular properties of auto cloned objects to e.g. have a different name, or to have their own Lua code, while still not having them be fully instantiated copies; they will thus inherit any changes from their original.

The sitting/sleeping status set by seatfor/bedfor on a mobile is only set as a temporary flag, so make sure you use unreset or setflag to make the change permanent, or dynreset will think that the mobile has been tampered with and needs resetting.

For beds, seats, clothing and weapons, though you can use them in combination with count, you shouldn't. Only the last clone will actually 'win' and become the weapon or seat or whatever. If you want one item to be used by a mobile and the rest to be lying around, consider using multiple entries instead.

There is a handy "addauto <object-id>" command that will add a new auto object to the room, taking care of all the details for you!