Skip to content

CreateArea

Makes one of the map’s areas.

shape and the numbers in opts:

  • "box" - x1, y1, z1, x2, y2, z2: two opposite corners;
  • "cylinder" - x, y, radius, zmin, zmax;
  • "sphere" - x, y, z, radius;
  • "polygon" - points ({{x, y}, ...}, 3 to 64, the outline without crossing itself), zmin, zmax.

Any of them takes label (what players see), public (true shows the label to whoever comes in), color (0xRRGGBB, the editor’s outline), nav (what the server’s actors make of it: "auto" nothing, "block" they never walk into it, "walkable" a floor at its bottom they walk on), trespass (the game’s trespass level inside - SetAreaTrespass), rain (the most rain inside, 0 .. 1 - SetAreaRain), layer ("base") and persist (true). A name is used once - letters, digits, _ . - and spaces, at most 64.

CreateArea(name, shape, opts)
Parameter Type
name string the area’s name
shape string "box", "cylinder", "sphere" or "polygon"
opts table the shape’s numbers and the options above

number - the area’s id; nil and the reason when the server has no map, the name is taken or a number is out of its bounds

function OnGameModeInit()
CreateArea("Market", "cylinder", {x = 1290, y = 1095, radius = 25, zmin = 20, zmax = 60,
label = "Kuttenberg market", public = true, persist = false})
SetAreaProperty("Market", "pvp", false)
end

SetArea · DeleteArea · GetArea · OnPlayerEnterArea · the The map’s areas group of the index