UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

How do I spawn FX on a trigger

broken avatar :(
Created 8 years ago
by worstgabena
0 Members and 1 Guest are viewing this topic.
1,653 views
broken avatar :(
×
broken avatar :(
Location: usAnywhere but here
Date Registered: 31 October 2016
Last active: 7 years ago
Posts
32
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
worstgabena's Groups
worstgabena's Contact & Social Links
I want to activate a trigger and for an FX to spawn, this is what I tried:
Code Snippet
Plaintext
function postPuzzleFxInit() {
totalSwitches = 1;
for(i = 1; i <= totalSwitches; i++) {
trigger = GetEnt("fx_trig_" + i, "targetname");
trigger SetCursorHint("HINT_NOICON");
trigger SetHintString("Press &&1 to activate");
struct = GetEnt("fx_struct_" + i, "targetname");
trigger waittill("trigger", player);
origin = struct GetOrigin();
thread postPuzzleFx(origin);
trigger Delete();
struct Delete();
}
}

function postPuzzleFx(origin) {
SpawnFX("electric/fx_elec_sparks_burst_xsm_omni_blue_os", origin);
}
What am I doing wrong? Is there a better way to do this? Thanks in advance.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2014
Last active: 4 years ago
Posts
103
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
Signature
Dead Palace
×
Riptide1106's Groups
Riptide1106's Contact & Social Links
here is part of a script i made to do what you are asking, in my case it was on a lantern:

Code Snippet
Plaintext
lantern_light1 = getEnt("lantern_light1", "targetname"); 		//this is a script origin
lantern1_trig = getEnt("lantern1_trig", "targetname");

lantern1_trig waittill("trigger");

lantern_egg_fx = spawn("script_model", lantern_light1.origin);
lantern_egg_fx setmodel("tag_origin");
playfxontag(level._effect["YOUR_EFFECT"], lantern_egg_fx, "tag_origin");

YOUR_EFFECT - this is whatever name you gave your effect, which should be in
mapname.csv
mapname_patch.csv
ugx_easy_fx.gsc (if using this in your mod)
mod.csv ----> this one is in launcher
;)
broken avatar :(
×
broken avatar :(
Location: usAnywhere but here
Date Registered: 31 October 2016
Last active: 7 years ago
Posts
32
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
worstgabena's Groups
worstgabena's Contact & Social Links
Sorry, let me specify:
It's a map, not a mod. There is a trigger that once activated should spark like the power switch.  The FX I'm using is a built in one, if that makes a difference. Also, if possible, I'd prefer not to use external mods. Thanks again.

 
Loading ...