- Create a pulsating texture, light, or other effect.
- Delay the removal of objects or effects from the world while still allowing them to fade out gracefully
- Some simple multi-stage effects on a single ODF
To start we are going to be basing our ODF off of mbruine3 which is the mire ruin featured on the singleplayer mission 'Get Help' (isdf08.bzn), where you and Shabayev are stranded in a ruin and you have to hike through Scion territory. Unlike the normal mire ruin buildings this one contains a firepit which is nothing but an effect hardpoint with a fire animation attached to it. However this fire animation does not emit light. We're gonna make one that does. The current ODF looks similar to this.
Code: Select all
[GameObjectClass]
geometryName = "mbruine3.xsi"
classLabel = "i76building"
scrapCost = 8
scrapValue = 3
maxHealth = 5000
maxAmmo = 0
unitName = "Ruins"
heatSignature = 0.8
imageSignature = 8.0
radarSignature = 1.0
collisionRadius = 5.0
canDetect = 0
canInteract = 0
canSnipe = 0
effectHard1 = "hp_emit_1"
effectName1 = "mbruine3.render"
[render]
renderBase = "draw_multi"
renderCount = 3
renderName1 = "mbruine3.smokeemitter"
renderName2 = "mbruine3.flameemitter"
renderName3 = "mbruine3.sparkemitter"
[SmokeEmitter]
renderBase = "draw_twirl_trail"
emitDelay = 0.05
emitDelayVar = 0.03
emitVelocity = "0.0 3.0 0.0"
emitVariance = "2.0 2.0 2.0"
emitInherit = "0.2 0.2 0.2"
emitLife = 2.0
textureName = "smoke.tga"
textureBlend = "srcalpha invsrcalpha modulatealpha"
startColor = "0 0 0 128"
finishColor = "0 0 0 0"
startRadius = 0.5
finishRadius = 2.0
animateTime = 2.0
rotationRate = 2.0
[FlameEmitter]
renderBase = "draw_twirl_trail"
emitDelay = 0.03
emitDelayVar = 0.02
emitVelocity = "0.0 3.0 0.0"
emitVariance = "2.0 2.0 2.0"
emitInherit = "0.5 0.5 0.5"
emitLife = 1.0
textureName = "fire.tga"
textureBlend = "one one modulate"
startColor = "255 255 200 128"
finishColor = "255 0 0 0"
startRadius = 1
finishRadius = .5
animateTime = 1.0
rotationRate = 10.0
[SparkEmitter]
renderBase = "draw_twirl_trail"
emitDelay = 0.02
emitDelayVar = 0.01
emitVelocity = "0.0 2.0 0.0"
emitVariance = "5.0 5.0 5.0"
emitInherit = "1.0 1.0 1.0"
emitLife = 1.0
textureName = "spark.tga"
textureBlend = "one one modulate"
startColor = "255 255 0 255"
finishColor = "255 0 0 0"
startRadius = 0.1
finishRadius = 0.05
animateTime = 1.0
rotationRate = 20.0To start, let's create a new text file in somewhere where bz2 looks for our assets, such as in /addon/ (you can also put it in /tveditor/custom/ if you're using the TVEditor for 1.3), we'll create simple text file called mbruintest.odf and open it in notepad (or your favorite text editor), paste the contents of the ^above ODF inside of the file.
Now let's do some prep work. Add or change the following settings in the ODF.
Code: Select all
maxHealth = 0
lightingType = 1
// Make the effectName point to our current ODF
effectHard1 = "hp_emit_1"
effectName1 = "mbruintest.render"
// Have the renders point to our current ODF as well
[render]
renderBase = "draw_multi"
renderCount = 7
renderName1 = "mbruintest.smokeemitter"
renderName2 = "mbruintest.flameemitter"
renderName3 = "mbruintest.sparkemitter"
renderName4 = "mbruintest.firepitfade"
renderName5 = "mbruintest.firepitgrow"
renderName6 = "mbruintest.fireflickerfade"
renderName7 = "mbruintest.fireflickergrow"
==== Adding our first effect ====
Now, we are going to add an effect to the ODF to demonstrate the StartDelay parameter. Now let's add the firepitfade effect. This is going to be ugly because it's going to cause a sudden transition from dark to light, but just to demonstrate, do it. Add to the bottom of the file.
Code: Select all
[firepitfade]
simulateBase = "sim_null"
lifeTime = 0
renderBase = "draw_emit"
emitName = "mbruintest.firelightfade"
emitDelay = 4.4
emitVelocity = "0 0 0"
emitVariance = "0 0 0"
[firelightfade]
simulateBase = "sim_null"
lifeTime = 4.4
renderBase = "draw_light"
startColor = "500 255 0 455"
finishColor = "500 255 0 155"
startRadius = 40.0
finishRadius = 40.0
animateTime = 1.7
attenuateLinear = 1.0
It's ugly. Sure you could set the animateTime to 4.4 but it's still going to cause an abrupt transition from dark to light at the end of the effect's lifespan.
==== Making it pulse ====
Now we are going to fix that by adding an effect which stays in the background at low intensity and ramps up the brightness to create a 'pulse' effect.
at the bottom of the file add the following
Code: Select all
[firepitgrow]
simulateBase = "sim_null"
lifeTime = 0
renderBase = "draw_emit"
emitName = "mbruintest.firelightgrow"
emitDelay = 4.4
emitVelocity = "0 0 0"
emitVariance = "0 0 0"
[firelightgrow]
simulateBase = "sim_null"
lifeTime = 4.4
renderBase = "draw_light"
startColor = "500 255 0 155"
finishColor = "500 255 0 455"
startRadius = 40.0
finishRadius = 40.0
startDelay = 1.7
animateTime = 2.7
attenuateLinear = 1.0==== Adding some Finesse ====
Now we can see that things look MUCH better. The effect lacks some detail but we'll get to that by doing a set of similar pulsing effects, except this time we're going to play 'out of phase' with the first pulsing effects so that its more random.
Add this to the bottom of your file:
Code: Select all
[fireflickerfade]
simulateBase = "sim_null"
lifeTime = 0
renderBase = "draw_emit"
emitName = "mbruintest.firelight2fade"
emitDelay = 0.6
emitVelocity = "0 0 0"
emitVariance = "0 0 0"
[fireflickergrow]
simulateBase = "sim_null"
lifeTime = 0
renderBase = "draw_emit"
emitName = "mbruintest.firelight2grow"
emitDelay = 0.6
emitVelocity = "0 0 0"
emitVariance = "0 0 0"
[firelight2fade]
simulateBase = "sim_null"
lifeTime = 0.6
renderBase = "draw_light"
startColor = "500 255 0 255"
finishColor = "500 225 0 165"
startRadius = 40.0
finishRadius = 25.0
animateTime = 0.4
attenuateLinear = 1.0
[firelight2grow]
simulateBase = "sim_null"
lifeTime = 0.6
renderBase = "draw_light"
startColor = "500 255 0 165"
finishColor = "500 225 0 255"
startRadius = 25.0
finishRadius = 40.0
startDelay = 0.4
animateTime = 0.2
attenuateLinear = 1.0You should see the secondary effect adding a subtle flickering effect. Congratulations you now know how to use StartDelay to create interesting effects.