Page 1 of 1

Weapon kit spawn on vehicle.

Posted: Thu Nov 19, 2009 10:00 pm
by Poow
Is it possible to spawn a weapon kit on a PCO?
A tank eg.

Code: Select all

ObjectTemplate.addTemplate M551_Supportspawner
ObjectTemplate.setPosition x/y/z


ObjectTemplate.create ObjectSpawner M551_Supportspawner
ObjectTemplate.setObjectTemplate 1 German_Engineer
ObjectTemplate.setObjectTemplate 2 German_Engineer
ObjectTemplate.minSpawnDelay 20
ObjectTemplate.maxSpawnDelay 20
ObjectTemplate.TimeToLive 30
ObjectTemplate.Distance 20
ObjectTemplate.spawnOffset 0/0/0
ObjectTemplate.holdObject 1
ObjectTemplate.team 1
ObjectTemplate.MaxNrOfObjectSpawned 2
ObjectTemplate.damageWhenLost 10
Does not work without a ctd.

Re: Weapon kit spawn on vehicle.

Posted: Thu Nov 19, 2009 10:11 pm
by Apache Thunder
Yes. But the kit must have a engine on it for the holdObject command to work. You can code a simple dummy engine with no network info and it will do the job. You might also need to turn on mobile physics for the kit:

Code: Select all

ObjectTemplate.setHasMobilePhysics 1
However the kit won't behave right in muliplayer. It won't be visible if it has mobile physics. But it will stick to the vehicle and remain visible when mobile physics for the kit is not present. But the kit will not pitch/rotate with the vehicle/spawner in multiplayer. :(

But it does work!