Position is a special table, an lua table with three entries (x, y, z).
The values are, of course, Real Numbers, and are distances.
For positions, it is unlikely you will ever put them in. Instead, getting a position of, for example, a marker, and perhaps editing the value will be enough.
3D Positions have the x axis left to right, the z axis in to out, and the y axis down to up (y axis represents the height of the terrain).
If you have no height variable for a potion, use Util_ScarPos? to convert a top-down 2D position to a 3D world position.
Note: (0,0) is in the center of the map.
Note 2: ScarPosition is interchangable with Position. There is absolutely no difference, and is mearly another way of defining the data type in SCAR's documentation.
-- Move squad (squadID) to a random point around thier position. function movesquad(squadID) -- Get position of squadID local pos = Squad_GetPosition(squadID) -- Modify the position a bit. By up to 20M in this case. -- Change x, left to right, and z, in to out. pos.x = pos.x + World_GetRand(0, 40) - 20 pos.z = pos.z + World_GetRand(0, 40) - 20 -- Move them SGroup_CreateIfNotFound("sg_temp") SGroup_Clear(SGroup_FromName("sg_temp")) SGroup_Add("sg_temp", squadID) Cmd_AttackMovePos("sg_temp", pos) end
Data Types
Functions
SCAR Home
Wiki Home