Skip to content

UnpackMapPrefab

Turns a prefab unit into the prefab’s objects, each a map object of its own.

One edit: the unit goes, its objects stay where they stood as ordinary map objects (they no longer follow the prefab), and what sat on the unit stays where it is. The map editor’s inspector has “Unpack” for a selected unit; admins: /map prefab unpack <id>.

UnpackMapPrefab(id)
Parameter Type
id number the unit

table - the new objects’ ids in the prefab’s order; nil and the reason

local ids = UnpackMapPrefab(house)
if ids then SetMapObject(ids[1], {tint = 0x806040FF}) end -- one of its objects changed on its own

CreateMapPrefab · GetMapPrefabParts · the The server’s map group of the index