Creating and Controlling a Squad


In order to use a squad you need to place guys in a squad, make a guy a leader, and then use the threads in squad.scr.Do not use the squad_XXXXX events or the order_XXXXX events as they are only for individuals.These may already be removed from the code by the time you read this doc.


  1. you must have actors in your level that you can spawn that all share the same spawnset number (typically �100�).
  2. in your level script initialization thread, set the level var: level.squad_spawnset = 100
  3. now call squad.scr::SpawnSquad:

����� level waittill prespawn

����� waitthread global/squad.scr::SpawnSquad //spawn the player squad

����� level waittill spawn



Squadnodes and Covernodes.No pathnodes here.

Squads do not follow pathnodes, rather squadnodes which also have to be attached to covernodes (which all have the same name as each other, but obviously a different name than the squadnode).So in Radiant for each squadnode you put down, put down several covernodes around it, connect the squadnode (via Ctrl-K in Radiant) to one of the covernodes and it will then form a spiderweb shape which we call a squad area.Basically, a squad area is all of that area in that spiderweb which squad members will take advantage of when using commands to move around like squad_advance, squad_retreat, etc.





The information displayed through the use of the cvar �g_entinfo 1� is as follows:

Line 1: �

Line 2: targetname (actorname)

Line 3: morale info

Line 4: current order

Line 5: Thinker that is currently running, and script that that thinker is executing

Line 6: the squad name and the order current being followed.


Please note that the squad name is different than the targetname, as everything in the game has a targetname, but a squad name is uniquely assigned by an event in squad.scr::InitSquad which allows all other squad behaviour to then be called on it.By default in squad.scr, the squad name is (and always should be) �playersquad�.







Squad Thinkers:

There are several types of thinkers for squads.A thinker being an object that�s created based on the state of the AI, e.g. a mover thinker, a shoot thinker, a leader thinker, or follow thinker.The following events set thinkers:


����� self type_idle idlecover

����� self type_squad squad_mover





Hand Signals:

Due to code in ActorSquad::DoOrder, hand signals are only displayed by the captain and only when he�s not idle.


Hand signals are fired by calling squad_XXXX commands, which will make the captain issue the command, do the animation, and the icon will be displayed on your HUD as necessary.


squad_advance: captain does handsignal and squad runs to squadnode (e.g. $playersquad squad_advance $newnode)


squad_fallback: captain does handsignal and squad runs backward to squadnode provided by script (e.g. $playersquad squad_fallback $node1)


HALT: this animation has to be scripted as it is not a command or tactic. it will be displayed through global/squad.scr::SquadStop