MODSon[line.com] Wiki - Beta 1.0
World at War: SP Effects
From MODSonline Wiki
Contents |
[edit] Single Player Effects
Effects are spawned through co-ordinates that are placed in the createFX/yourmapname_fx.csc and pre-cached from the maps/yourmapname_fx.gsc.
Example:
[edit] zone_source
yourmapname.csv
fx,env/electrical/fx_elec_wire_spark_burst rawfile,maps/yourmapname.gsc rawfile,maps/yourmapname_fx.gsc rawfile,clientscripts/yourmapname.csc rawfile,clientscripts/yourmapname_fx.csc rawfile,clientscripts/createFX/yourmapname_fx.csc
This is the effect we are using, this ensures the compiler packs the effect into the FastFile.
[edit] Radiant
Place a script_origin in radiant where you want your FX to be, copy the origin (press N for entity editor) and use the copied origin in the scrips below. (note: delete the script_origin after you have it's origin, we use this as it's a simple way of getting co-ordinates, you can also get angles with this)
[edit] Scripts
rawfile,maps/yourmapname.gsc:
#include common_scripts\utility;
#include maps\_utility;
main()
{
maps\_load::main();
maps\yourmapname_fx::main();
}
rawfile,maps/yourmapname_fx.gsc
#include maps\_utility;
#include common_scripts\utility;
main()
{
precache_createfx_fx();
}
precache_createfx_fx()
{
level._effect["elec_wire_spark_burst"] = loadfx ("env/electrical/fx_elec_wire_spark_burst");
}
We call effects like this:
level._effect["a_short_name_chosen_by_you"] = loadfx ("location/the_actual_effects_name");
The short name makes it easier to call it later on and the location is ALWAYS inside the "FX" folder which is in the directory:
raw/fx
So in the example above, the fx_elec_wire_spark_burst.efx effect is at the location:
raw/fx/env/electrical/fx_elec_wire_spark_burst.efx
(note: we never include the file type (".efx") in the script)
--next (located in raw still) clientscripts/yourmapname.csc (csc is the same as gsc so open with notepad)
#include clientscripts\_utility;
main()
{
// _load!
clientscripts\_load::main();
clientscripts\yourmapname_fx::main();
// This needs to be called after all systems have been registered.
thread waitforclient(0);
}
clientscripts/yourmapname_fx.csc
#include clientscripts\_utility;
main()
{
clientscripts\createfx\yourmapname_fx::main();
clientscripts\_fx::reportNumEffects();
precache_createfx_fx();
disableFX = GetDvarInt( "disable_fx" );
if( !IsDefined( disableFX ) || disableFX <= 0 )
}
precache_createfx_fx()
{
level._effect["elec_wire_spark_burst"] = loadfx ("env/electrical/fx_elec_wire_spark_burst");
}
clientscripts/CreatFX/yourmapname_fx.csc
Here's where we specify our FX the origin of them and their angles.
main()
{
// this is where we use the origin from earlier
ent = clientscripts\_fx::createOneshotEffect( "elec_wire_spark_burst" );
ent.v[ "origin" ] = ( 100, 100, 10 );
ent.v[ "angles" ] = ( 270, 0, 0 );
ent.v[ "fxid" ] = "elec_wire_spark_burst";
ent.v[ "delay" ] = 0.1;
}
When compiling FX after compiling your level, you then only have to compile the FastFile again to have your FXs updated in-game.
Delay is the time in which the effect repeats itself, trial an error or the use of the effects editor is needed here.
