UGX-Mods

Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: worstgabena on April 25, 2017, 03:34:31 am

Title: Deleting FX
Post by: worstgabena on April 25, 2017, 03:34:31 am
I need a way of getting an FX by targetname or something to trigger a terminal deletion of said FX. Here's what I tried:
Code Snippet
Plaintext
trigger = GetEnt("trigger_1", "targetname");
fx = GetEnt("fx_1", "targetname");

trigger waittill("trigger", player);

fx Delete();
trigger Delete();
Title: Re: Deleting FX
Post by: MakeCents on April 25, 2017, 07:33:21 pm
I need a way of getting an FX by targetname or something to trigger a terminal deletion of said FX. Here's what I tried:
Code Snippet
Plaintext
trigger = GetEnt("trigger_1", "targetname");
fx = GetEnt("fx_1", "targetname");

trigger waittill("trigger", player);

fx Delete();
trigger Delete();

In order to delete an fx you must use playfxontag.  To use playfxontag you have to use a model. So what you can do is spawn the script_model where you want the fx, set it to a tag_origin model, and then playfxontag on that tag_origin of the model.

Code Snippet
Plaintext
	ent = Spawn( "script_model", origintospawn );//replace origintoispawn with the position to spawn model
ent SetModel("tag_origin");
fx = pathandnameoffxyouprecached;//or however your adding fx
PlayFXOnTag(fx,ent,"tag_origin");

Then when your ready to delete the fx, delete the model:

Code Snippet
Plaintext
	ent delete();
Title: Re: Deleting FX
Post by: worstgabena on April 25, 2017, 07:38:44 pm
Is there any way to fetch an existing FX by chance?
Title: Re: Deleting FX
Post by: MakeCents on April 25, 2017, 07:40:03 pm
no, you can play and stop fx in csc, but not in gsc.
Title: Re: Deleting FX
Post by: worstgabena on April 25, 2017, 07:41:09 pm
How exactly would I do that?
Title: Re: Deleting FX
Post by: MakeCents on April 25, 2017, 07:44:12 pm
How exactly would I do that?

Its not as easy, but you would still prob playfxontag but using csc syntax in a csc script and then using stopfx.

you can find many examples in the scripts. You want to prob use gsc, and spawn the model and delete the model. It works just fine, unless your fx has some odd delay and you want it to stop quicker.
Title: Re: Deleting FX
Post by: worstgabena on April 25, 2017, 08:24:25 pm
Alright, thanks. I'll use GSC then. :)