CEG-OldInfo: Difference between revisions
FoeOfTheBee (talk | contribs) |
FoeOfTheBee (talk | contribs) |
||
| Line 58: | Line 58: | ||
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) | 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) | ||
NaodW29-pre3d9b41193195736e00000001 | |||
Revision as of 19:55, 18 September 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) NaodW29-pre3d9b41193195736e00000001