SquadID is the delcaration of one squad (or unit) in exsistance, on the battlefield/map:
You cannot normally just use a Squad ID, it has to be got from a variety of sources. Normally, it is a single squad from a Squad Group (SGroup)?, and can have actions performed on it, or information got from it. See the example for a way to use squad ID's.
function RandomlyMoveThings()
-- We run the code on squads in the group "sg_myunits", defined beforehand.
-- Local function to run on each Squad in a Squad Group.
local RandomMove = function (sgroupid, itemindex, squadID)
-- Get position of squadID
local pos = Squad_GetPosition(squadID)
-- Modify the position a bit. 20M isn't very much at all (say, side of a mekshop)
-- Note: x is left/right, z is in/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
-- Run above function for each.
SGroup_ForEach(SGroup_FromName("sg_myunits"), RandomMove)
Squad Index Category
Data Types
Functions
SCAR Home
Wiki Home