For this tutorial, I am using the Hovercraft (LCAC) from Point of existence mod for BFV for my example. The code will be the same for Vietnam or BF42 mods.

- First of all add the spawners to the PCO object:

ObjectTemplate.create PlayerControlObject LCAC
ObjectTemplate.NetworkableInfo LCACBodyInfo
.
.
.
rem soldier spawns
ObjectTemplate.addTemplate LCAC_SoldierSpawn
ObjectTemplate.setPosition -2.82/2/-6.96
ObjectTemplate.addTemplate LCAC_SoldierSpawn
ObjectTemplate.setPosition -2.35/1.8/7.7
ObjectTemplate.addTemplate LCAC_SoldierSpawn
ObjectTemplate.setPosition 2.35/1.8/7.7
rem ------------------------------------------
rem vehicle LAV spawner
ObjectTemplate.addTemplate LCAC_LAV-25Spawner
ObjectTemplate.setPosition 0/3.3/0


- The LCAC soldier spawns are set to just ride in the vehicle and not for a particular vehicle postion. However, most of the time you want to spawn a soldier into vehicle postions.

- Next you want to create a vehicle group for the soldier spawner. The group number can't be much higher then 150. Numbers between 100 -120 should be safe to use. Just make sure to use a unique number for ever new group you use an object for. You could also reuse this for another object if you wanted the same settings. If you have multiple vehicles with the same group number, you will only get one shared spawn selection that will be centered between the vehicles. Its best to use a different group for each vehicle, unless the spawner will be only used for bots.

>> spawn group for only players by US/Allies
spawnPointManager.group 76 -- unique group number
spawnPointManager.groupTeam 2 -- this sets 2 for US use
spawnPointManager.groupIcon test1.tga -- standard icon
spawnPointManager.onlyForHuman 1 -- sets for use only by players


>> spawn group for players and bots by US/Allies
spawnPointManager.group 77 -- unique group number
spawnPointManager.groupTeam 2 -- this sets 2 for US use
spawnPointManager.groupIcon test1.tga -- standard icon

>> spawn group for only bots by US/Allies
spawnPointManager.group 78 -- unique group number
spawnPointManager.groupTeam 2 -- this sets 2 for US use
spawnPointManager.groupIcon test1.tga -- standard icon
spawnPointManager.onlyForAI 1 -- set to 1 for only bot use



rem *** LCAC_SoldierSpawn1 ***
ObjectTemplate.create SpawnPoint LCAC_SoldierSpawn
ObjectTemplate.setSpawnRotation 0/0/0
ObjectTemplate.setSpawnPositionOffset 0/0/0
ObjectTemplate.setSpawnPreventionDelay 0
ObjectTemplate.setSpawnId 0 -- This should be unique to this object
ObjectTemplate.setGroup 76 -- this number ties to the group above
ObjectTemplate.setEnterOnSpawn 0 -- Controls player
ObjectTemplate.setAIEnterOnSpawn 1 -- Controls bot
ObjectTemplate.setSpawnAsParaTroper 0 -- This would auto deploy a chute

- Now this does not make any since to have setAIEnterOnSpawn 1 when the group for this spawner is for Human only. Usually you don't want to force players to spawn into vehicles, by setting setEnterOnSpawn 1 unless you are using this


rem *** LCAC_SoldierSpawn2 ***
ObjectTemplate.create SpawnPoint LCAC_SoldierSpawn2
ObjectTemplate.setSpawnRotation 0/0/0
ObjectTemplate.setSpawnPositionOffset 0/0/0
ObjectTemplate.setSpawnPreventionDelay 0
ObjectTemplate.setSpawnId 1 -- This should be unique to this object
ObjectTemplate.setGroup 76 -- this number ties to the group above
ObjectTemplate.setEnterOnSpawn 1

- Now the LCAC_SoldierSpawn2 spawner is not used but I created it to show how an additional player spawn would be created that spawns players into the vehicle for a mobile spawner. Note that if all vehicle postions become full, that the spawner will automatically dissappear until a vehicle postion is available.



>> vehicle spawner
rem *** LCAC_LAV-25Spawner ***
ObjectTemplate.create ObjectSpawner LCAC_LAV-25Spawner
ObjectTemplate.setObjectTemplate 1 LAV-25 >>spawn LAV-25 for Team 1
ObjectTemplate.setObjectTemplate 2 LAV-25 >>spawn LAV-25 for Team 2
ObjectTemplate.holdObject 1 >>Holds the object in its spawn position
ObjectTemplate.minSpawnDelay 20 >> time in seconds
ObjectTemplate.maxSpawnDelay 20 >>time in seconds
ObjectTemplate.TimeToLive 30 >> time in seconds
ObjectTemplate.Distance 20
ObjectTemplate.spawnOffset 0/0/0
ObjectTemplate.team 2 - team that owns vehicle
ObjectTemplate.MaxNrOfObjectSpawned 1 >> Number of vehicles to spawn
ObjectTemplate.damageWhenLost 10

Notes:

holdObject 1 - keeps the spawned object in its place relative to what spawned it. This is how landing craft stay on the sides of ships and how you can spawn a plane in midair. It will stay in its place until someone gets in it and starts moving it. In this case it spawns an vehicle on the Hovercraft that travels with it.

MaxNrofObjectsSpawned 1 - Is the number of vehicles that can be spawned and live at the same time from this spawner. If left out, it defaults to 1. If set higher, multiple vehicles will appear at the spawndelay intervals, up to the max. Its very useful on a carrier to allow multiple planes to be launched quickly.

If you want to restrict enemy bots from stealing a vehicle, use this code in the spawner with a 1 for Vietnam/Axis, 2 for US/Allies, 0 is neutral/default setting

ObjectTemplate.teamOnVehicle 0

 

If there is a conflict between the group setting and the spawner setting, I found that the group setting takes over. So, in the case of the LCAC, since the group setting is for Human only, the spawner setting for AIEnterOnEntry is apparently useless since bots don't spawn with this group setting.

Now what would happen if you used both in the group settings like so:

>> spawn group for only players by US/Allies
spawnPointManager.group 76 -- unique group number
spawnPointManager.groupTeam 2 -- this sets 2 for US use
spawnPointManager.groupIcon test1.tga -- standard icon
spawnPointManager.onlyForHuman 1 -- sets for use only by players
spawnPointManager.onlyForAI 1 -- set to 1 for only bot use

I don't know. My guess is either CTD like Corolon thinks or possibly the last setting will take priority.

But you can use bot settings for the spawner if the group does not have any restrictions. So if the group is unrestricted, then both Ai and players can be set to enter the vehicle when spawning:

rem unrestricted group
spawnPointManager.group 76 -- unique group number
spawnPointManager.groupTeam 2 -- this sets 2 for US use
spawnPointManager.groupIcon test1.tga -- standard icon

rem *** LCAC_SoldierSpawn1 ***
ObjectTemplate.create SpawnPoint LCAC_SoldierSpawn
ObjectTemplate.setSpawnRotation 0/0/0
ObjectTemplate.setSpawnPositionOffset 0/0/0
ObjectTemplate.setSpawnPreventionDelay 0
ObjectTemplate.setSpawnId 0 -- This should be unique to this object
ObjectTemplate.setGroup 76 -- this number ties to the group above
ObjectTemplate.setEnterOnSpawn 1 -- Controls player
ObjectTemplate.setAIEnterOnSpawn 1 -- Controls bot