I just posted this in another thread. It will work just the same, just change the names of the FX. Adding custom FX are the same as stock FX.
There are many ways to add FX to your map. This is only " 1 " way to do it.
Pick out an FX that you want to use.
1. Navigate to the following path:
Call of Duty 4 - Modern Warfare\raw\maps\mp
2. Create a new text file in the " mp " folder. Change the file extension to .gsc. Name this file:
mp_yourmapname_fx.gsc
3. Open this file and place the following inside it:
Code:
main()
{
level._effect[ "fire_sm" ] = loadfx( "fire/firelp_small_dl_c" );
}
Let's say you had two fx. It would simply look like this:
Code:
main()
{
level._effect[ "fire_sm" ] = loadfx( "fire/firelp_small_dl_c" );
level._effect[ "fire_light" ] = loadfx( "fire/fire_light" );
}
This file is what your map needs to load your fx's. Now what you want to do is edit the line or lines to fit your fx's you want to use.
In the first example,
level._effect[ "fire_sm" ], what is highlighted in red is kinda like an alias or generic name you as the mapper gets to create.
Let's say I was adding a waterfall. I would change what's in red to "
waterfall ". Or, whatever you want, just as long as you know what it is. We will need to reference this alias later.
Now, the second part is the actual effect that needs to be loaded. Here is where you define what effect you want to use.
= loadfx( "fire/firelp_small_dl_c" ); What is highlighted in red is the path and file of the fx.
My new line would look like this:
Code:
main()
{
level._effect[ "waterfall" ] = loadfx( "misc/waterfall_hunted" );
}
As you can see, you are only editing what is in red.
4. Once you have your fx loaded, save and close it. Since you've just created a new file, your map needs to know about it. We need to load this new .gsc now from your main map .gsc.
5. Navigate to:
Call of Duty 4 - Modern Warfare\raw\maps\mp and open your maps main .gsc "
mp_yourmapname.gsc ". In the place where you load your scripts add this new script using the following line.
Code:
maps\mp\mp_yourmapname_fx::main();
6. Save and close. Now your zone file needs to know about it. This way it can pack that script into your FF file. Open your zone file and add the following line:
Code:
rawfile,maps/mp/mp_yourmapname_fx.gsc
7. Now we need to define where these fx would play in the map. Navigate to:
Call of Duty 4 - Modern Warfare\raw\maps\createfx and if the "
createfx " folder doesn't exist, create it. In this folder create a new text file and change the extension to .gsc. What is important here is that we are naming this script the same name as the other script we've created. The only difference is, they are in different paths. Name the file:
mp_yourmapname_fx.gsc
8. Open this script and paste the following:
Code:
//_createfx generated. Do not touch!!
main()
{
ent = maps\mp\_utility::createOneshotEffect( "misc/waterfall_hunted" );
ent.v[ "origin" ] = ( -2432, -826, 98 );
ent.v[ "angles" ] = ( 270, 0, 0 );
ent.v[ "fxid" ] = "waterfall";
ent.v[ "delay" ] = -1;
ent.v[ "soundalias" ] = "";
}
As you can see, I've already edited the lines. Look at how they match up with the line that loads the effect. This is how it is done. Pay attention to the pattern.
main()
{
ent = maps\mp\_utility::createOneshotEffect( "
misc/waterfall_hunted" );
ent.v[ "origin" ] = (
-2432, -826, 98 );
ent.v[ "angles" ] = ( 270, 0, 0 );
ent.v[ "fxid" ] = "
waterfall";
ent.v[ "delay" ] = -1;
ent.v[ "soundalias" ] = "";
}
Since we don't have coordinates yet, which we will get soon, just leave the default (x,y,z) coordinates in there. The angles ( 270, 0, 0 ) shows that this effect with play just as it does in the FX editor, by default. Use these default angles first before you edit this line. Most effects will use these angles. Now that we have a place for the effect to play you can save and close.
Just like your first script, if you wanted to add another place for an fx to play, you can simply copy the code like this:
Code:
//_createfx generated. Do not touch!!
main()
{
ent = maps\mp\_utility::createOneshotEffect( "misc/waterfall_hunted" );
ent.v[ "origin" ] = ( -2432, -826, 98 );
ent.v[ "angles" ] = ( 270, 0, 0 );
ent.v[ "fxid" ] = "waterfall";
ent.v[ "delay" ] = -1;
ent.v[ "soundalias" ] = "";
ent = maps\mp\_utility::createOneshotEffect( "misc/waterfall_hunted" );
ent.v[ "origin" ] = ( -2432, -826, 98 );
ent.v[ "angles" ] = ( 270, 0, 0 );
ent.v[ "fxid" ] = "waterfall";
ent.v[ "delay" ] = -1;
ent.v[ "soundalias" ] = "";
}
Obviously they both wouldn't be identical, it is just for example purposes only. You can see the line about the soundalias? If you have a soundalias and your fx needs to make a sound, you would plug in your soundalias between the quotes.
9. Navigate to:
Call of Duty 4 - Modern Warfare\raw\maps\mp and open your maps main .gsc "
mp_yourmapname.gsc ". In the place where you load your scripts add this new script using the following line. Notice the change in the path.
Code:
maps\createfx\mp_yourmapname_fx::main();
10. Save and close. Now your zone file needs to know about it. This way it can pack that script into your FF file. Open your zone file and add the following line:
Code:
rawfile,maps/createfx/mp_yourmapname_fx.gsc
11. Now open up radiant and navigate to the place where you want the fx to play. Right click the 2D window and create a script > origin. Move the origin into place. Deselect the origin, and then reselect it. Press
N. Collect the (x,y,z) and paste them into the FX file that now needs our coordinates. The file we want is located in the createfx folder.
If you paste the coordinates from radiant, you will have to add back in the commas, or the map will give you an error on load. Save and close the script. You can leave in that script origin if you want as a place holder, but if your map is high in entities, just delete it. I would suggest deleting the origin once you get your fx working and placed ingame.
12. Last thing to do is to add the actual effect to your zone file. Open your zone file and since in this example I used the waterfall effect. You would add the following line to the zone file:
Code:
fx,misc/waterfall_hunted