spawnSoldier 74

Spawn an AI soldier. Faction Ids and loadout Ids can be acquired in the Script Settings menu -> Id tables section


Return value

Return TypeDescription
SoldierReference to the spawned soldier

Parameters

ParameterTypeDescription
1vec3World position where the soldier should spawn
2stringID of the faction that the soldier belong to
3integerRank value: 0 = private, 1 = pre-corporal, 2 = corporal, 3 = pre-sergeant, 4 = sergeant, 5 = staff sergeant, 6 = technical-sergeant, 7 = first-sergeant, 8 = leutenant, 9 = captain, 10 = major, 11 = general
4stringId to the vanilla or custom loadout to give to the soldier. Will have a placeholder loadout if empty. Notice: List of possible loadouts will be given soon

Examples

Example 38

-- spawn a German soldier with leutenant rank at position 0,0,0
spawnSoldier(vec3(0,0,0), "Germany_axis", 8, "ger_infantry_tankcrew_leader")

Example 39

-- spawn a British soldier at position 10,0,10
local sold = spawnSoldier(vec3(10,0,10), "England_allies", 0, "eng_infantry_gunner")

-- now you can do some stuff with 'sold' variable
sold.addNewItem("some_item")
-- ...

Back to Scripting API