Call of Duty 5: FXs Script Struct
This tutorial describe an alternative method to spawn FXs in a map using Radiant and a few scripts.
The example belwo will show you how to spawn 3 FXs in your map:
env/smoke/fx_smoke_crater env/fire/fx_fire_barrel_small env/fire/fx_fire_barrel_pm

Updating broken File
First of all to use this tutorial you will need a new version (cod4's version ;)) of the following file that Treyarch seems to have broken/modified:
C:\Program Files\Activision\Call of Duty - World at War\raw\maps\mp\_createfx.gsc
You can download it HERE
- To install, simply unpack the ZIP archive under your COD:WAW Root.
Create the GSC file
- In your /raw/maps/mp/mp_yourmap.gsc and after maps\mp\_load::main(); type this:
maps\mp\_example_struct::main();
So as an Example, my mp_example.gsc looks like this:
main()
{
maps\mp\_load::main();
maps\mp\_example_struct::main();
game["allies"] = "marines";
game["axis"] = "japanese";
game["attackers"] = "allies";
game["defenders"] = "axis";
game["allies_soldiertype"] = "pacific";
game["axis_soldiertype"] = "pacific";
}
- Save and exit
- Using Notepad create a new file under /raw/maps/mp/ called _example_struct.gsc, inside copy paste the following code:
#include common_scripts\utility;
#include maps\mp\_utility;
main()
{
//Assigning a random delay for start of FX
randomStartDelay = randomfloatrange( -20, -15);
//Each line describes a different FX
global_FX( "barrel_fireFX_origin", "global_fire", "env/fire/fx_fire_barrel_pm", randomStartDelay, "fire_barrel_small" );
global_FX( "barrel_fireFX_small_origin", "global_fire_small", "env/fire/fx_fire_barrel_small", randomStartDelay, "fire_barrel_small" );
global_FX( "barrel_smokeFX_origin", "global_smoke", "env/smoke/fx_smoke_crater", randomStartDelay );
}
global_FX( targetname, fxName, fxFile, delay, soundalias )
{
// get script_structs created in Radiant
ents = getstructarray(targetname,"targetname");
if ( !isdefined( ents ) )
return;
if ( ents.size <= 0 )
return;
for ( i = 0 ; i < ents.size ; i++ )
ents[i] global_FX_create( fxName, fxFile, delay, soundalias );
}
global_FX_create( fxName, fxFile, delay, soundalias )
{
if ( !isdefined( level._effect ) )
level._effect = [];
if ( !isdefined( level._effect[ fxName ] ) )
level._effect[ fxName ] = loadfx( fxFile );
// default effect angles if they dont exist
if ( !isdefined( self.angles ) )
self.angles = ( 0, 0, 0 );
ent = createOneshotEffect( fxName );
ent.v[ "origin" ] = ( self.origin );
ent.v[ "angles" ] = ( self.angles );
ent.v[ "fxid" ] = fxName;
ent.v[ "delay" ] = delay;
if ( isdefined( soundalias ) )
{
ent.v[ "soundalias" ] = soundalias;
}
}
- Save and Exit
- Finally add the FXs and the new files to your /zone_source/mp_yourmap.csv
rawfile,maps/mp/_example_struct.gsc rawfile,maps/mp/_createfx.gsc fx,env/smoke/fx_smoke_crater fx,env/fire/fx_fire_barrel_small fx,env/fire/fx_fire_barrel_pm
In Radiant
This method of spawning FXs uses script_struct entities, they are placed in your Level in Radiant
- In radiant, in the 2D view, Right-click and select script>script_struct
- Now move and place the Script_struct entity where you want your FX to show up
- With the Script_struct entity selected bring up its properties with n
- Now add the targetname for the FX required (as entered in the _example_struct,gsc file above)
Key:Targetname Value:depends on FX you wish
Possible Values in this Example:
barrel_fireFX_origin barrel_fireFX_small_origin barrel_smokeFX_origin
- Another thing to do might be the Angle, if you need to orient your FXs.
Key: angles Value: Depends on the direction you want to the FX to show, for Fire (going upwards) it would be 180 0 0 ; For a Streetlight (pointing downwards) it would be 90 0 0
Results

Files used
All the files used here can be downloaded HERE
--Zeroy. 16:05, 2 December 2008 (UTC)
