Call of Duty: Black Ops III

Call of Duty: Black Ops III

Not enough ratings
[Scripting] Playing FX
By Mysti and 1 collaborators
   
Award
Favorite
Favorited
Unfavorite
Introduction
Hey everyone, this is going to be a quick tutorial, it usually will only take a few lines of code to get it done. So I'm not going to mess around, let's get right into it.
Scripting Requirements
So, this requires a tiny bit of scripting. First off you'll need to know the name of the FX you want to play. You can find them here
Call of Duty Black Ops III\share\raw\fx
You can look at them in Radiant to see what they'll look like when you play them. Once you've found the FX you want to play you need to a few things before you can play it. First off you'll need to add it to your Zone file. You can find it here
Call of Duty Black Ops III\usermaps\*MAP NAME*\zone_source\*MAP NAME*.zone
So once you open it in Notepad or similar programs add on a new line
fx,*FX NAME*
You'd replace FX NAME with the name of the FX of course, for example if I was wanting to add "fx_elec_sparks_directional_orange" I'd add
fx,electric/fx_elec_sparks_directional_orange
Since the FX is located under the Electric folder. Keep in mind when adding FX you need to give the relitive path.

Now, that's out of the way we need to do something similar in our MAP_NAME.gsc file, it can be found here
Call of Duty Black Ops III\usermaps\*MAP NAME*\scripts\zm
Make sure you're choosing the GSC not CSC. Up the top of the file under your usings add the line
#precache( "fx", "FX_NAME" );
Make sure to keep the quotes in, so I'd add
#precache( "fx", "electric/fx_elec_sparks_directional_orange" );

So now, we have the FX precached and let the game know we're wanting to use it now we can play it. It's up to you what's going to make it play. All you need to do is put this in your script resposible for triggering the FX

PlayFX("electric/fx_elec_sparks_directional_orange",<origin>);

You will obviously need to replace <origin> for where you want to the FX to play, if you want to play on a Model or something you can do something like this
Model = GetEnt("PlayFXHere","targetname"); PlayFX("electric/fx_elec_sparks_directional_orange", Model GetOrigin());
That will play the Sparks FX on the model, you can set up a trigger to kick it off, but that is out of the scope for this tutorial. But there we go, that's everything you need to know on FX.
Closing Words
Thanks for reading another one of my tutorials, I know I skipped on how to set it up using triggers, but this tutorial is for playing FX not how to set them up to be played. I am here to help so you need pointers on how to play things via Triggers I can offer help to get you on your way.

Reguardless, Thanks for reading.
Johnathon.