- Creating FX gsc
After the scriping part of the creation process of our map we created the FX gsc.
Wich was this basic one located in
raw/maps :
Levelname_fx.gsc
Code:
#include maps\_utility;
#include common_scripts\utility;
main()
{
scriptedFX();
footsteps();
}
footsteps()
{
animscripts\utility::setFootstepEffect( "asphalt", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "brick", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "carpet", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "cloth", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "concrete", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "dirt", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "foliage", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "gravel", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "grass", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "ice", LoadFx( "bio/player/fx_footstep_snow" ) );
animscripts\utility::setFootstepEffect( "metal", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "mud", LoadFx( "bio/player/fx_footstep_mud" ) );
animscripts\utility::setFootstepEffect( "paper", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "plaster", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "rock", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "sand", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "snow", LoadFx( "bio/player/fx_footstep_snow" ) );
animscripts\utility::setFootstepEffect( "water", LoadFx( "bio/player/fx_footstep_water" ) );
animscripts\utility::setFootstepEffect( "wood", LoadFx( "bio/player/fx_footstep_dust" ) );
}
scriptedFX()
{
level._effect["large_ceiling_dust"] = LoadFx( "env/dirt/fx_dust_ceiling_impact_lg_mdbrown" );
level._effect["poltergeist"] = LoadFx( "misc/fx_zombie_couch_effect" );
}
Description of the FX file:
The main function
Code:
main()
{
scriptedFX();
footsteps();
}
the precacheFx() function
Code:
}
footsteps()
{
animscripts\utility::setFootstepEffect( "asphalt", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "brick", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "carpet", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "cloth", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "concrete", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "dirt", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "foliage", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "gravel", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "grass", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "ice", LoadFx( "bio/player/fx_footstep_snow" ) );
animscripts\utility::setFootstepEffect( "metal", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "mud", LoadFx( "bio/player/fx_footstep_mud" ) );
animscripts\utility::setFootstepEffect( "paper", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "plaster", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "rock", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "sand", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "snow", LoadFx( "bio/player/fx_footstep_snow" ) );
animscripts\utility::setFootstepEffect( "water", LoadFx( "bio/player/fx_footstep_water" ) );
animscripts\utility::setFootstepEffect( "wood", LoadFx( "bio/player/fx_footstep_dust" ) );
}
scriptedFX()
{
level._effect["large_ceiling_dust"] = LoadFx( "env/dirt/fx_dust_ceiling_impact_lg_mdbrown" );
level._effect["poltergeist"] = LoadFx( "misc/fx_zombie_couch_effect" );
}
-Adding FX
We need to edit the main file,adding our personal FX.
In this example we will add the fog cloud FX wich is used in the zombie maps.
The name of the FX is "fx_fog_rolling_thick_600x600",If you execute the effects editor you can load it from raw/FX/env/smoke/fx_fog_rolling_thick_600x600.
So our basic code will change to this:
Code:
#include maps\_utility;
#include common_scripts\utility;
main()
{
maps\createfx\levelname_fx::main();
scriptedFX();
precache_createfx_fx();
footsteps();
}
footsteps()
{
animscripts\utility::setFootstepEffect( "asphalt", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "brick", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "carpet", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "cloth", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "concrete", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "dirt", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "foliage", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "gravel", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "grass", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "ice", LoadFx( "bio/player/fx_footstep_snow" ) );
animscripts\utility::setFootstepEffect( "metal", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "mud", LoadFx( "bio/player/fx_footstep_mud" ) );
animscripts\utility::setFootstepEffect( "paper", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "plaster", LoadFx( "bio/player/fx_footstep_dust" ) );
animscripts\utility::setFootstepEffect( "rock", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "sand", LoadFx( "bio/player/fx_footstep_sand" ) );
animscripts\utility::setFootstepEffect( "snow", LoadFx( "bio/player/fx_footstep_snow" ) );
animscripts\utility::setFootstepEffect( "water", LoadFx( "bio/player/fx_footstep_water" ) );
animscripts\utility::setFootstepEffect( "wood", LoadFx( "bio/player/fx_footstep_dust" ) );
}
// --- Ambient_Effects ---//
precache_createfx_fx()
{
level._effect["fog_thick"] = loadfx ("env/smoke/fx_fog_rolling_thick_600x600");
}
scriptedFX()
{
level._effect["large_ceiling_dust"] = LoadFx( "env/dirt/fx_dust_ceiling_impact_lg_mdbrown" );
level._effect["poltergeist"] = LoadFx( "misc/fx_zombie_couch_effect" );
}
Changes to our FX main file function:
Code:
#include maps\_utility;
#include common_scripts\utility;
main()
{
maps\createfx\levelname_fx::main();
scriptedFX();
precache_createfx_fx();
footsteps();
}
We added the info required for the spawn FX wich is "maps\createfx\levelname_fx::main();" this is our new file where we will input the FX data.
Also added the lines that will make us add our precache data.
Changes to the precacheFX:
Code:
// --- Ambient_Effects ---//
precache_createfx_fx()
{
level._effect["fog_thick"] = loadfx ("env/smoke/fx_fog_rolling_thick_600x600");
}
Spawn FX file:
We know need to create a new gsc file wich will have the spawn data of our FX.
The new levelname_fx.gsc file needs to be in
raw/maps/createFX.
Code:
//_createfx generated. Do not touch!!
main()
{
// CreateFX entities placed: 1
ent = maps\_utility::createOneshotEffect( "fog_thick" );
ent.v[ "origin" ] = ( 180, -95, 16 );
ent.v[ "angles" ] = ( 0, 0, 0 );
ent.v[ "fxid" ] = "fog_thick";
ent.v[ "delay" ] = -15;
}
ent = maps\_utility::createOneshotEffect( "fog_thick" );
This calls what FX you want to play. (the name has been specified in the precache of the main file)
ent.v[ "origin" ] = ( 180, -95, 16 );
Where the FX will be located in X, Y, Z coordinates.
ent.v[ "angles" ] = ( 0, 0, 0 );
This is how the FX will be oriented by rotating the X, Y, Z.
ent.v[ "fxid" ] = "fog_thick";
The name of the FX should be the same as the first line. (we have set this in precache in the main FX file)
ent.v[ "delay" ] = -15;
This is the repeat rate.
Adding files to the zone file.
Open the map zone file
levelmap.csv located in
/zone_source/ and add all the FX scripts.
Code:
rawfile,maps/nazi_zombie_anzio.gsc
rawfile,maps/nazi_zombie_anzio_fx.gsc
rawfile,maps/createfx/nazi_zombie_anzio_fx.gsc
Call of Duty World at War introduces new concepts to the game and the editor.
One of these is in the FX,these have been improved to server and clientscripts.
The previous part of the tutorial covers the server part, we now need to setup the clients so they actually see FX spawns in map.
This is mandatory for single player,co-op or zombie co-op maps.
Clientscripts FX scripts (csc):
Create a basic Levelmap.csc and add it to
raw/clientscripts/
Levelname.csc
Code:
#include clientscripts\_utility;
#include clientscripts\_music;
main()
{
// _load!
clientscripts\_load::main();
clientscripts\LEVELMAP_fx::main();
thread clientscripts\_fx::fx_init(0);
thread clientscripts\_audio::audio_init(0);
// This needs to be called after all systems have been registered.
thread waitforclient(0);
println("*** Client : Enjoy mapping");
}
The main files makes a call for another piece of the puzzle.
We need to create our clientscript FX file, so create a new csc and call it levelname_FX.csc this also goes in
raw/clientscripts
Levelname_FX.csc
Code:
#include clientscripts\_utility;
main()
{
clientscripts\createfx\levelname_fx::main();
clientscripts\_fx::reportNumEffects();
footsteps();
precache_createfx_fx();
disableFX = GetDvarInt( "disable_fx" );
if( !IsDefined( disableFX ) || disableFX <= 0 )
{
precache_scripted_fx();
}
}
precache_scripted_fx()
{
level._effect["zombie_grain"] = LoadFx( "misc/fx_zombie_grain_cloud" );
}
footsteps()
{
clientscripts\_utility::setFootstepEffect( "asphalt", LoadFx( "bio/player/fx_footstep_dust" ) );
clientscripts\_utility::setFootstepEffect( "brick", LoadFx( "bio/player/fx_footstep_dust" ) );
clientscripts\_utility::setFootstepEffect( "carpet", LoadFx( "bio/player/fx_footstep_dust" ) );
clientscripts\_utility::setFootstepEffect( "cloth", LoadFx( "bio/player/fx_footstep_dust" ) );
clientscripts\_utility::setFootstepEffect( "concrete", LoadFx( "bio/player/fx_footstep_dust" ) );
clientscripts\_utility::setFootstepEffect( "dirt", LoadFx( "bio/player/fx_footstep_sand" ) );
clientscripts\_utility::setFootstepEffect( "foliage", LoadFx( "bio/player/fx_footstep_dust" ) );
clientscripts\_utility::setFootstepEffect( "gravel", LoadFx( "bio/player/fx_footstep_sand" ) );
clientscripts\_utility::setFootstepEffect( "grass", LoadFx( "bio/player/fx_footstep_sand" ) );
clientscripts\_utility::setFootstepEffect( "ice", LoadFx( "bio/player/fx_footstep_snow" ) );
clientscripts\_utility::setFootstepEffect( "metal", LoadFx( "bio/player/fx_footstep_dust" ) );
clientscripts\_utility::setFootstepEffect( "mud", LoadFx( "bio/player/fx_footstep_mud" ) );
clientscripts\_utility::setFootstepEffect( "paper", LoadFx( "bio/player/fx_footstep_dust" ) );
clientscripts\_utility::setFootstepEffect( "plaster", LoadFx( "bio/player/fx_footstep_dust" ) );
clientscripts\_utility::setFootstepEffect( "rock", LoadFx( "bio/player/fx_footstep_sand" ) );
clientscripts\_utility::setFootstepEffect( "sand", LoadFx( "bio/player/fx_footstep_sand" ) );
clientscripts\_utility::setFootstepEffect( "snow", LoadFx( "bio/player/fx_footstep_snow" ) );
clientscripts\_utility::setFootstepEffect( "water", LoadFx( "bio/player/fx_footstep_water" ) );
clientscripts\_utility::setFootstepEffect( "wood", LoadFx( "bio/player/fx_footstep_dust" ) );
}
// --- Ambient_Effects ---//
precache_createfx_fx()
{
level._effect["fog_thick"] = loadfx("env/smoke/fx_fog_rolling_thick_600x600");
}
Finally we will make the last script file wich is the spawn file for the FX clientside.
Create a new Levelname_FX.csc and save it in raw/clientscripts/createFX/
Levelname_FX.csc
Code:
//_createfx generated. Do not touch!!
main()
{
//CreateFX entities placed: 1
ent = clientscripts\_fx::createOneshotEffect( "fog_thick" );
ent.v[ "origin" ] = ( 0, 0, 0 );
ent.v[ "angles" ] = ( 0, 0, 0 );
ent.v[ "fxid" ] = "fog_thick";
ent.v[ "delay" ] = -15;
}
Adding the clientscripts to the zone file:
Once again open Levelname.csv (the zone file) and add the clientscripts to it.
Code:
rawfile,clientscripts/nazi_zombie_anzio.csc
rawfile,clientscripts/nazi_zombie_anzio_fx.csc
rawfile,clientscripts/createfx/nazi_zombie_anzio_fx.csc
compile and run your map to see the FX in action.
--------------------------------------------------------------------------------------------------------------
By Rabbit.
Full wiki link (easy viewable)
codmapping.com
hope that helps
Ps:feel free to copy source from my wiki to anyones for easy sharing and viewing.
edited on Dec. 2, 2008 05:56 pm by 4mori_rabbit