spawnSquadOnVehicle 140
Spawn an AI squad inside a given vehicle. Faction Ids and Squad Ids can be acquired in the Script Settings menu -> Id tables section. Vehicle crew squads will automatically fit the seats inside the vehicle. Can spawn custom squads made with Squad Editor
Return value
| Return Type | Description |
|---|---|
| Squad | Reference to the spawned squad |
Parameters
| Parameter | Type | Description |
|---|---|---|
| 1 | vec3 | Position where to spawn the squad |
| 2 | float | Radius where soldiers will be spawn within |
| 3 | string | Faction to assign the squad to |
| 4 | string | Id of the squad to spawn. |
| 5 | Vehicle | Reference to the vehicle to spawn in |
Examples
Example 154
-- spawn a vehicle
local veh = spawnVehicle("GMC CCKW open", vec3(4, 1.5, 0), vec3(0, 90, 0))
-- spawn squad inside the vehicle and assign to each AI a script "example.lua", located inside <mission>/scripts/ai/
local squad = spawnSquadOnVehicle_script(vec3(0,1.5,0), 50, "Canada_allies", "can_infantry", veh, "example.lua")