Multiplayer Clientside Effects

From CoDWWModWiki

Jump to: navigation, search

Contents

Multiplayer Effects

Stock way of adding MP effects, you may need to create some directories, specifically: clientscripts/maps/mp/createfx

"clientscripts\mp" and the "maps\mp" directories are located in "raw" in your Call of Duty Installation Directory:

C:\Program Files\Activision\Call of Duty - World at War\raw\clientscripts\mp

C:\Program Files\Activision\Call of Duty - World at War\raw\maps\mp

Directories needed:

World at War\raw\maps\mp

World at War\raw\maps\mp\createfx

World at War\raw\clientscripts\mp

World at War\raw\clientscripts\mp\createFX

"mp_yourmapname" is used to define your level in all scripts and the zone source on this page, copy a script and use a text editor to do "find/replace" to replace mp_yourmapname with your maps actual name.

Zone Source

// NOTE: If you add a comment, put a space after the double forward slash or you will get issues
col_map_mp,maps/mp/mp_yourmapname.d3dbsp
impactfx,mp_fxer
sound,common,mp_yourmapname,!all_mp
sound,generic,mp_yourmaname,!all_mp
sound,voiceovers,mp_yourmapname,!all_mp
sound,multiplayer,mp_yourmapname,!all_mp
character,char_usa_raider_player_rifle
character,char_usa_raider_player_cqb
character,char_usa_raider_player_assault
character,char_usa_raider_player_lmg
character,char_usa_raider_player_smg
character,char_jap_impinf_player_smg
character,char_jap_impinf_player_rifle
character,char_jap_impinf_player_lmg
character,char_jap_impinf_player_cqb
character,char_jap_impinf_player_assault
// script directories
rawfile,maps/mp/mp_yourmapname.gsc
rawfile,maps/mp/mp_yourmapname_fx.gsc
rawfile,maps/mp/createFX/mp_yourmapname_fx.gsc
rawfile,clientscripts/mp/createFX/mp_yourmapname_fx.csc
rawfile,clientscripts/mp/mp_yourmapname_fx.csc
rawfile,clientscripts/mp/mp_yourmapname.csc
// FX
fx,maps/mp_maps/fx_mp_falling_leaves_elm

Level Scripts

raw/maps/mp/yourmapname.gsc

main()
{
        maps\mp\_load::main();
	maps\mp\mp_yourmapname_fx::main();
}

raw/maps/mp/yourmapname_fx.gsc

#include maps\mp\_utility;

main()
{
	precache_createfx_fx();
	spawnFx();
}

precache_createfx_fx()
{
level._effect["mp_falling_leaves"]		              = loadfx("maps/mp_maps/fx_mp_falling_leaves_elm");
}

spawnFX()
{
	if (( getdvar( "createfx" ) != "" ))
	{
		maps\mp\createfx\mp_yourmapname_fx::main();
	}
}

maps/mp/createfx/mp_yourmapname_fx.gsc

(place a script_origin in Radiant where you want an fx and deselect it then reselect it, press N and copy the origin, then delete the script_origin. use the origin values you copied, below)

main()
{
// this is where we use the origin from earlier
     	ent = maps\mp\_utility::createOneshotEffect( "mp_falling_leaves" );
     	ent.v[ "origin" ] = ( -24, 40, 152 );
     	ent.v[ "angles" ] = ( 270, 0, 0 );
     	ent.v[ "fxid" ] = "mp_falling_leaves";
     	ent.v[ "delay" ] = 0.1;
}

Clientside Scripts

clientscripts/mp/mp_yourmapname.csc

// Commented Out yourmapname_amb encase you don't have one

#include clientscripts\mp\_utility;

main()
{
	// If the team nationalites change in this level's gsc file,
	// you must update the team nationality here!
	// level.allies_team = "russian";
	// level.axis_team   = "german";


	clientscripts\mp\_load::main();

	clientscripts\mp\mp_yourmapname_fx::main();

	thread clientscripts\mp\_fx::fx_init(0);
	
	thread clientscripts\mp\_audio::audio_init(0);

	// thread clientscripts\mp\mp_yourmapname_amb::main();

	// This needs to be called after all systems have been registered.
	thread waitforclient(0);

	println("*** Client : mp_fxer running...");
}

clientscripts/mp/mp_yourmapname_fx.csc

// 
// file: mp_fxer_fx.gsc
// description: clientside fx script for mp_yourmapname: setup, special fx functions, etc.
// www.modsonwiki.com
//

#include clientscripts\mp\_utility; 


// load fx used by util scripts
precache_util_fx()
{	

}

precache_scripted_fx()
{
}


// --- AMBIENT SECTION ---//
precache_createfx_fx()
{

	level._effect["mp_falling_leaves"]		              = loadfx("maps/mp_maps/fx_mp_falling_leaves_elm");
}


main()
{
	clientscripts\mp\createfx\mp_yourmapname_fx::main();
	clientscripts\mp\_fx::reportNumEffects();
	
	precache_util_fx();
	precache_createfx_fx();
	
	disableFX = GetDvarInt( "disable_fx" );
	if( !IsDefined( disableFX ) || disableFX <= 0 )
	{
		precache_scripted_fx();
	}
}

clientscripts/mp/createfx/mp_yourmapname_fx.csc

(This file should be the same as the one in 'maps/mp/createfx' but note we're calling "clientscripts" instead of "maps" in this line: "ent = clientscripts\mp\_fx::createOneshotEffect( "mp_falling_leaves" );")

main()
{
// this is where we use the origin from earlier
     	ent = clientscripts\mp\_fx::createOneshotEffect( "mp_falling_leaves" );
     	ent.v[ "origin" ] = ( -24, 40, 152 );
     	ent.v[ "angles" ] = ( 270, 0, 0 );
     	ent.v[ "fxid" ] = "mp_falling_leaves";
     	ent.v[ "delay" ] = 0.1;
}
Personal tools