Contents |
Overview
There are three places where you can call a CEG: weapons, COB, and Lua.
Weapon CEGs
There are three weapon tags that can spawn CEGs:
- cegtag: Spawns the CEG every frame at the weapon projectile's position and direction.
- explosionGenerator: Spawns the CEG when the weapon hits its target.
- bounceExplosionGenerator: For bouncing weapons only. Spawns the CEG when the weapon bounces.
You need to set these tags equal to custom:ExplosionGeneratorName. For example, in a .tdf,
explosionGenerator=custom:ExplosionGeneratorName;
COB CEGs
Calling a CEG from COB requires two steps. First, in the unit's definition, you need to put
[sfxtypes] {
explosiongenerator0 = custom:ExplosionGeneratorName0; explosiongenerator1 = custom:ExplosionGeneratorName1; //and so on...
}
for a .fbi, or
sfxtypes = {
explosiongenerators = {
"custom:ExplosionGeneratorName0",
"custom:ExplosionGeneratorName1",
--and so on...
},
},
To actually generate the explosion, you need to emit-sfx 1024 plus the number of the explosion generator in the unit definition (the first one is 0, the next is 1, and so on). The CEG will have the position and direction of the piece you emit it from.
There is another tag, pieceTrailCEGTag, which is used in explode [piece] FALL; to spawn CEG trails behind falling pieces.
CEG_DAMAGE: In a COB script, you can do SET CEG_DAMAGE [value]. Any emit-sfx instructions will then use that value for the "damage" (use the 'd' operator to access this value).
Lua CEGs
See Lua_SyncedCtrl.
