timeToLive

timeToLive <int>

TimeToLive is a very common property in the BF engine. It is used to describe the length of time an object can live. It's used on projectiles, spawners, etc.. timeToLive can also be used with random number like

ObjectTemplate.timeToLive CRD_UNIFORM/1/2/0

When you see CRD_Uniform or CRD_NONE, that is a random number generator. /1/2/0 means that it will randoming pick a number from 1 - 2 and step by 0 (every number). 1/6/2 would mean random from 1 - 6 stepping by 2.

Example:

In this example, the particle will live between 1 and 2 seconds.

rem *** Em_KubelFireSmoke ***
ObjectTemplate.create Emitter Em_KubelFireSmoke
ObjectTemplate.template Fx_KubelFireSmoke
ObjectTemplate.looping 1
ObjectTemplate.addEmitterSpeed 1
ObjectTemplate.emitterSpeedScale 1
ObjectTemplate.lodDistance 700
ObjectTemplate.timeToLive CRD_UNIFORM/1/2/0
ObjectTemplate.intensity CRD_UNIFORM/10/12/0
ObjectTemplate.relativePositionInDof CRD_UNIFORM/-0.1/-0.1/0
ObjectTemplate.relativePositionInUp CRD_NONE/-0.3/0/0
ObjectTemplate.relativePositionInRight CRD_UNIFORM/0.3/-0.3/0
ObjectTemplate.positionalSpeedInDof CRD_UNIFORM/0/0.05/1
ObjectTemplate.positionalSpeedInRight CRD_UNIFORM/0/0.05/1
ObjectTemplate.startRotation CRD_NONE/1/0/0

In this example, once the object is over 40 units away, it will start to die in 45 seconds.

ObjectTemplate.create ObjectSpawner heavytankspawner
ObjectTemplate.setObjectTemplate 2 m10
ObjectTemplate.setObjectTemplate 1 Tiger
ObjectTemplate.MinSpawnDelay 70
ObjectTemplate.MaxSpawnDelay 110
ObjectTemplate.SpawnDelayAtStart 0
ObjectTemplate.TimeToLive 45
ObjectTemplate.Distance 40
ObjectTemplate.DamageWhenLost 10

Valid object types

ObjectSpawner
Projectile
EffectBundle
Emitter
SpriteParticle