Call of Duty 5: FXs: Difference between revisions

From COD Modding & Mapping Wiki
Jump to navigation Jump to search
(New page: center ===Creating your FX=== *Create a GSC file, Intro To Scripting but fill it with the text below instead. <pre> #include maps\mp\_utility; ...)
 
mNo edit summary
Line 2: Line 2:


===Creating your FX===
===Creating your FX===
*Create a GSC file, [[Intro_To_Scripting|Intro To Scripting]] but fill it with the text below instead.
<font color="yellow">'''1.''' Create a new GSC file, but fill it with the text below instead.</font>
 
<pre>
<pre>
#include maps\mp\_utility;
#include maps\mp\_utility;
Line 27: Line 28:
</pre>
</pre>


'''2.''' Save the file as mp_yourmapname_fx.gsc in the same directory as your main script file.<br><br>
<font color="yellow">'''2.''' Save the file as mp_yourmapname_fx.gsc in the same directory as your main script file.
'''3.''' Add the below line to your mp_yourmapname.gsc right under "maps\mp\_load::main();".
 
'''3.''' Add the below line to your mp_yourmapname.gsc right under </font>
 
maps\mp\_load::main();
 
<pre>
<pre>
maps\mp\mp_yourmapname_fx::main();
maps\mp\mp_yourmapname_fx::main();
</pre>
</pre>
'''4.''' Update your zone file with "rawfile,maps\mp\mp_yourmapname_fx.gsc" if it is missing.<br><br>
 
<font color="yellow">'''4.''' Update your zone file with "rawfile,maps\mp\mp_yourmapname_fx.gsc" if it is missing.<br><br></font>


----
----


===Description of your FX GSC===
===Description of your FX GSC===
'''1.''' Your main function.
 
<font color="yellow">'''1.''' Your main function.</font>
<pre>
<pre>
main()
main()
Line 47: Line 54:
*This can do everything if you want but for organization purposes it is advised you have at least these two functions to separate the steps.
*This can do everything if you want but for organization purposes it is advised you have at least these two functions to separate the steps.


'''2.''' precacheFX() function
<font color="yellow">'''2.''' precacheFX() function</font>
<pre>
<pre>
precacheFX()
precacheFX()
Line 57: Line 64:
*'''loadfx("maps/mp_maps/fx_mp_fire_medium")''' is the path to the tagged FX, notice that there is no extension on the end of the path.
*'''loadfx("maps/mp_maps/fx_mp_fire_medium")''' is the path to the tagged FX, notice that there is no extension on the end of the path.


'''3.''' spawnFX() function
<font color="yellow">'''3.''' spawnFX() function</font>
<pre>
<pre>
spawnFX()
spawnFX()

Revision as of 00:07, 11 November 2008

Creating your FX

1. Create a new GSC file, but fill it with the text below instead.

#include maps\mp\_utility;

main()
{
        precacheFX();
        spawnFX();
}

precacheFX()
{
        level._effect["mp_fire_medium"] = loadfx("maps/mp_maps/fx_mp_fire_medium");
}

spawnFX()
{
        ent = maps\mp\_utility::createOneshotEffect( "mp_fire_medium" );
        ent.v[ "origin" ] = ( 0, 0, 0 );
        ent.v[ "angles" ] = ( 270, 0, 0 );  
        ent.v[ "fxid" ] = "mp_fire_medium";
        ent.v[ "delay" ] = -15;
}

2. Save the file as mp_yourmapname_fx.gsc in the same directory as your main script file.

3. Add the below line to your mp_yourmapname.gsc right under

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

4. Update your zone file with "rawfile,maps\mp\mp_yourmapname_fx.gsc" if it is missing.


Description of your FX GSC

1. Your main function.

main()
{
        precacheFX();
        spawnFX();
}
  • This can do everything if you want but for organization purposes it is advised you have at least these two functions to separate the steps.

2. precacheFX() function

precacheFX()
{
        level._effect["mp_fire_medium"] = loadfx("maps/mp_maps/fx_mp_fire_medium");
}
  • level._effect["mp_fire_medium"] is the name "mp_fire_medium" that will be referenced by all your scripts, this can be anything.
  • loadfx("maps/mp_maps/fx_mp_fire_medium") is the path to the tagged FX, notice that there is no extension on the end of the path.

3. spawnFX() function

spawnFX()
{
        ent = maps\mp\_utility::createOneshotEffect( "mp_fire_medium" );
        ent.v[ "origin" ] = ( 0, 0, 0 );
        ent.v[ "angles" ] = ( 270, 0, 0 );  
        ent.v[ "fxid" ] = "mp_fire_medium";
        ent.v[ "delay" ] = -15;
}
  • ent = maps\mp\_utility::createOneshotEffect( "mp_fire_medium" );
    • This calls what FX you want to play.
  • ent.v[ "origin" ] = ( 0, 0, 0 );
    • Where the FX will be located in X, Y, Z coordinates.
  • ent.v[ "angles" ] = ( 270, 0, 0 );
    • This is how the FX will be oriented by rotating the X, Y, Z.
  • ent.v[ "fxid" ] = "mp_fire_medium";
    • The name of the FX should be the same as the first line.
  • ent.v[ "delay" ] = -15;
    • This is the repeat rate.