Herds and packs: groups that follow a leader, share alerts, flee and hunt together (since API 3).
A group is a set of creatures with a leader. The others keep a formation (or a loose distance) around it and move
with it; when one member notices danger the whole group reacts; a herd flees together, a pack hunts together:
it spreads around its target, then attacks in turns while the others circle. A group can have a territory (a home
zone it returns to) and zones it avoids, and it regroups when it was split.
Groups steer the game's own AIs through their walk targets and alert state, so the creatures keep their own animations
and movement; script-driven members (c.ai = false) get the same targets (c.targetX / c.targetZ, c.state, or
g:slot(c)) and are moved by the group when it has drive = true. A script's groups end with a new hunt and with a
reload; populations make groups for every hunt. The guide: Zones, populations, herds and
packs.
kind ("herd", "pack" or "group"), members = {creatures}, leader = a creature (default: the first member), name, and any options (see the guide): formation, spacing, spread, sharedAlert, flee ("together", "own", false), hunt, huntHunter, prey = {species}, huntRange, surround, attackers, turnTime, ring, territory (a Zone or its name), leash, avoid = {zones}, regroup, wary, drive, feedTime, huntCooldown
local herd = {}
for i = 1, 5do herd[i] = world.spawn("parasaurolophus", x + i * 400, z) endlocal g = group.create{kind = "herd", members = herd, formation = "loose", wary = 2500}