CEG-OldInfo: Difference between revisions
Explanation of the custom explosion system |
No edit summary |
||
| Line 1: | Line 1: | ||
== Custom explosion generators == | |||
== What are they? == | === What are they? === | ||
Custom explosions are small explosion scripts read from gamedata/explosions/*.tdf. | Custom explosions are small explosion scripts read from gamedata/explosions/*.tdf. | ||
The explosion script specifies which particles/projectiles have to be created when the explosion happens, and their initial properties (position,speed,...) | The explosion script specifies which particles/projectiles have to be created when the explosion happens, and their initial properties (position,speed,...) | ||
== Explosion script definition == | === Explosion script definition === | ||
The explosion script directly specifies which C++ projectile classes have to be created, and also which properties the projectiles should have. | The explosion script directly specifies which C++ projectile classes have to be created, and also which properties the projectiles should have. | ||
| Line 35: | Line 35: | ||
Default of count is 1. | Default of count is 1. | ||
== Projectile properties == | === Projectile properties === | ||
To begin, you should run | To begin, you should run | ||
spring /p (or "spring -p" on linux) | spring /p (or "spring -p" on linux) | ||
to let spring export "projectiles.txt", which contains all the classes you can use in an explosion script. | to let spring export "projectiles.txt", which contains all the classes you can use in an explosion script. At the time of writing, this would contain [[projectiles.txt]] | ||
The items listed in "properties" are directly mapped to the class properties in projectiles.txt | The items listed in "properties" are directly mapped to the class properties in projectiles.txt | ||
| Line 97: | Line 97: | ||
== How to link a custom explosion to a weapon == | === How to link a custom explosion to a weapon === | ||
The weapon definitions needs to have this in it: | The weapon definitions needs to have this in it: | ||
| Line 106: | Line 106: | ||
You can also link the weapons for self-destruct and normal destruct to an explosion script. | You can also link the weapons for self-destruct and normal destruct to an explosion script. | ||
== Adding ground flashes == | === Adding ground flashes === | ||
The ground flash is currently not an actual projectile, so it's specified in a different way: | The ground flash is currently not an actual projectile, so it's specified in a different way: | ||
Revision as of 13:08, 5 June 2006
Custom explosion generators
What are they?
Custom explosions are small explosion scripts read from gamedata/explosions/*.tdf. The explosion script specifies which particles/projectiles have to be created when the explosion happens, and their initial properties (position,speed,...)
Explosion script definition
The explosion script directly specifies which C++ projectile classes have to be created, and also which properties the projectiles should have.
The explosion script is structured like this:
[ExplosionScriptName]
{
[projectile scriptname] // this specifies the class of the projectile
{
[properties]
{
size = 40;
sizeGrowth = -2;
pos = -30 r60, r30, -30 r60; // These codes are explained below
speed=0.75 r-1.5, 1.7 r1.6, 0.75 r-1.5;
}
underwater=0; // should this projectile be created when underwater?
air=0; // should this projectile be created when in air?
water=1; // should this projectile be created on water?
ground=1; // should this projectile be created when on ground?
count=10; // number of projectiles of this type
}
.. other projectiles types can follow here ..
}
Defaults for air/underwater/ground/water are zero. Default of count is 1.
Projectile properties
To begin, you should run
spring /p (or "spring -p" on linux)
to let spring export "projectiles.txt", which contains all the classes you can use in an explosion script. At the time of writing, this would contain projectiles.txt
The items listed in "properties" are directly mapped to the class properties in projectiles.txt The properties are specified with a bit of a cryptic syntax. You can use extra commands in them (r,d,i). For example this:
pos = -30 r60, r30, -30 r60;
The x coordinate (specified with -30 r60) will be:
x = -30 + (Random value between 0 and 60);
Commands:
rX: add a number between 0 and X iX: multiply the projectile index with X and add it. See the example for this below. dX: multiply the damage with X and add it.
Explosion script examples
This is an example of a script that makes 10 smoke projectiles (yeah they should have been called particles, but they are handled by spring using the projectile system)
[ARM_HLT_Expl]
{
[smoke]
{
[properties]
{
ageSpeed=0.04; // age increase per frame, when age >= 1 the particle is destroyed
size = 40;
sizeGrowth = -2;
pos = -30 r60, r30, -30 r60;
speed=0.75 r-1.5, 1.7 r1.6, 0.75 r-1.5;
}
water=1;
ground=1;
count=10;
}
}
This particular script would be linked to with "explosiongenerator=custom:ARM_HLT_Expl;"
Here is an example that uses the index (i) command in the properties:
[heatcloud] { [properties] { pos = 0, i20, 0; heat = 10; maxheat=10; heatFalloff=1; size = 30; } ground=1; count=10; }
This script creates a tower of heatcloud projectile. Look at the The first projectile gets y=0, the second y=20,.. y=40, y=60, and finally y=180
How to link a custom explosion to a weapon
The weapon definitions needs to have this in it:
explosiongenerator = custom:ExplosionScriptName;
The explosion definition for ExplosionScriptName would be one of the TDF files in gamedata/explosions/
You can also link the weapons for self-destruct and normal destruct to an explosion script.
Adding ground flashes
The ground flash is currently not an actual projectile, so it's specified in a different way:
[ARM_HLT_Expl]
{
.. projectiles definitions ..
[groundflash]
{
flashSize = 100; // flash size
flashAlpha = 1; // initial alpha of the flash
circleGrowth = 60; // size increase/frame
circleAlpha = 1; // initial alpha of the ring
ttl = 10; // number of frames
color = 0,0,1; // color RGB
}
}