easy fx

broken avatar :(
Created 2436 days ago
by trebeltom1
0 Members and 1 Guest are viewing this topic.
1,699 views
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 17 February 2013
Last active: 1169 days ago
Posts
107
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Signature
MAPS:
Dale's Dock
Compound
Dale's Dig

[You are not allowed to view external links. Register or Login to see them]
×
trebeltom1's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
trebeltom1's Contact & Social LinksWaffle Fries
here is my easy fx script, the thread trigger_progress_fx, is meant to trigger an effect when a level notify occurs with the same name as the script_struct's script_string. I'm not sure this is right though, and I wasn't sure how to show a script_string of progress(with a number after it)...

some guidance is needed, thanks




fx_setup() //This is where the FX are precached. Any FX you want to use must be added to your mapname_patch.csv as well as listed below. 
{
//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

//Usage: level._effect["alias"] = loadFX("path/to/fx/name");
//Where 'alias' is your personal name for the fx that you will use later in the code, and 'path/to/fx/name' is the file location + name of the fx you want to assign to the variable. See below for examples:
//When entering the fx path, be sure to only include folder names that are within /raw/fx, and make sure to leave off the file extension (.efx).
//If you want to preview any of these FX, open Launcher, click the EffectsEd button, then File>Open the file you wish to preview. Then press the green play button.

//Fire\\
level._effect["fire1"] = loadFX("env/fire/fx_fire_brush_smolder_sm");
level._effect["fire2"] = loadFX("env/fire/fx_fire_detail_fade_14");
level._effect["fire3"] = loadFX("env/fire/fx_fire_blown_md_blk_smk_distant_w");
level._effect["fire4"] = loadFX("env/fire/fx_fire_oil_md");
level._effect["fire5"] = loadFX("env/fire/fx_fire_campfire_small");
level._effect["fire6"] = loadFX("env/fire/fx_fire_player_torso");
//End Fire\\

//Smoke/Smolder\\
level._effect["smoke1"] = loadFX("env/smoke/fx_smoke_smolder_sm_blk");
level._effect["smoke2"] = loadFX("env/smoke/fx_smoke_smolder_md_gry");
level._effect["smoke3"] = loadFX("env/smoke/fx_smoke_smolder_lg_gry");
level._effect["smoke4"] = loadFX("env/smoke/fx_smoke_wood_chimney_med");
//End Smoke/Smolder\\
level._effect["bogsmoke"] = loadFX("smoke/tunnel_smoke_bog_a");

//Explosions\\
level._effect["explosion1"] = loadFX("explosions/fx_default_explosion"); //non stationary
level._effect["explosion2"] = loadFX("explosions/tank_impact_dirt"); //non stationary
//End Explosions\\


//Light Rays\\
level._effect["light1"] = loadFX("env/light/fx_glow_hanginglamp");
level._effect["light2"] = loadFX("env/light/fx_glow_emergency_red_blink");
//End Light Rays\\


//Electrical\\
level._effect["electric1"] = loadFX("env/electrical/fx_elec_player_md"); // 1.4 only!
level._effect["electric2"] = loadFX("maps/zombie/fx_zombie_wire_spark"); // 1.4 only!
//End Electrical\\


//User-Additions\\
//Place your fx lines below this line, or below other fx in their respective sections.
level._effect["bugs1"] = loadFX("bio/insects/fx_insect_carcass_flies");
level._effect["meteor1"] = loadFX("maps/zombie/fx_meteor_ambient");
level._effect["lazer"] = loadFX("maps/zombie/fx_zombie_lght_marker");
level._effect["battle1"] = loadFX("env/smoke/fx_battlefield_smokebank_low_thick");
level._effect["beach1"] = loadFX("env/smoke/fx_battlefield_beach_smokebank_ling_lg");
level._effect["billow1"] = loadFX("maps/ber3b/fx_smk_plume_xlg_slow_blk_3b");
//End User-Additions\\

//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//DEBUG SETTING:

level.fx_debug = 1; // '1' = ON, 'undefined' = OFF

//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//Do not edit or add anything below this line.
}

fx_start()
{
fx_spots = getstructarray("fx","targetname");

if(isDefined(level.fx_debug))
{
if(fx_spots.size == 0 || !isDefined(fx_spots))
iPrintLn("Easy-FX: ^1ERROR: ^7No FX structs were found! Ensure that you used SCRIPT_STRUCTS and you gave them the correct TARGETNAME.");
else
iPrintLn("Easy-FX found "+fx_spots.size+" fx structs in your level.");
}


for(i=0;i<fx_spots.size;i++)
{
usage = fx_spots[i].script_string;
if(usage == "stationary")
fx_spots[i] thread stationary_fx();
if(usage == "stationary_loop")
fx_spots[i] thread stationary_fx(true);
else if(usage == "touch")
fx_spots[i] thread triggered_touch_fx();
else if(usage == "use")
fx_spots[i] thread triggered_use_fx();
else if(usage == "use_loop")
fx_spots[i] thread triggered_use_fx(true);
else if(usage == "touch_loop")
fx_spots[i] thread triggered_touch_fx(true);
else if(usage == "damage")
fx_spots[i] thread triggered_damage_fx(true);
else if(usage == "progress[i]")
fx_spots[i] thread triggered_progress_fx(true);
else if(!isDefined(fx_spots[i].script_string))
if(isDefined(level.fx_debug)) iPrintLn("Easy-FX: ^1ERROR: ^7FX struct at origin "+fx_spots[i].origin+" is missing its stript_string for fx usage! Set it as stationary, use, or touch.");
}
}

stationary_fx(loop) //These are untriggered FX that will play on loop while the level is running.
{

fx = self.script_noteworthy;
if(!isDefined(fx) && isDefined(level.fx_debug)) iPrintLn("Easy-FX: ^1ERROR: ^7 FX struct at origin "+self.origin+" is missing its script_noteworthy for fx name!");

    fxTag = "tag_origin";
   
    self.fx = Spawn( "script_model", self.origin );
    self.fx SetModel( "tag_origin" );
    self.fx.angles = self.angles;
    self.fx.origin = self.origin;
    self.fx LinkTo( self, fxTag );

if(isDefined(loop))
{
if(!isDefined(self.speed))
{
self.speed = 1;
if(isDefined(level.fx_debug))iPrintLn("Easy-FX: ^1ERROR: ^7No speed was specified on the struct at origin "+self.origin+". It has defaulted to 1 second.");
}
PlayLoopedFX(level._effect[fx], self.speed, self.origin);
}
else
PlayFxOnTag( level._effect[fx], self.fx, fxTag );
}

triggered_touch_fx(loop) //These are triggered FX. They are triggered when the player walks though a trigger_multiple that you create in Radiant.
{
trigger = getEnt(self.target,"targetname");
if(!isDefined(trigger.script_string))
trigger.script_string = "SET THIS TEXT USING THE SCRIPT_STRING KVP ON THE TRIGGER";
trigger setHintString(trigger.script_string);
trigger SetCursorHint("HINT_NOICON");
fx = self.script_noteworthy;
trigger waittill("trigger");

fxTag = "tag_origin";
    self.fx = Spawn( "script_model", self.origin );
    self.fx SetModel( "tag_origin" );
    self.fx.angles = self.angles;
    self.fx.origin = self.origin;
    self.fx LinkTo( self, fxTag );

if(isDefined(loop))
{
if(!isDefined(self.speed))
{
self.speed = 1;
if(isDefined(level.fx_debug))iPrintLn("Easy-FX: ^1ERROR: ^7No speed was specified on the struct at origin "+self.origin+". It has defaulted to 1 second.");
}
PlayLoopedFX(level._effect[fx], self.speed, self.origin);
}
else
PlayFxOnTag( level._effect[fx], self.fx, fxTag );
}

triggered_use_fx(loop) //These are triggered FX. They are triggered when the player uses a trigger (by pressing F) that you create in Radiant.
{
trigger = getEnt(self.target,"targetname");
if(!isDefined(trigger.script_string))
trigger.script_string = "SET THIS TEXT USING THE SCRIPT_STRING KVP ON THE TRIGGER";
trigger setHintString(trigger.script_string);
trigger SetCursorHint("HINT_NOICON");
fx = self.script_noteworthy;
trigger waittill("trigger");

fxTag = "tag_origin";
    self.fx = Spawn( "script_model", self.origin );
    self.fx SetModel( "tag_origin" );
    self.fx.angles = self.angles;
    self.fx.origin = self.origin;
    self.fx LinkTo( self, fxTag );

if(isDefined(loop))
{
if(!isDefined(self.speed))
{
self.speed = 0.5;
if(isDefined(level.fx_debug))iPrintLn("Easy-FX: ^1ERROR: ^7No speed was specified on the struct at origin "+self.origin+". It has defaulted to 0.5 seconds");
}
PlayLoopedFX(level._effect[fx], self.speed, self.origin);
}
else
PlayFxOnTag( level._effect[fx], self.fx, fxTag );
}
triggered_damage_fx(loop)
{
trigger = getEnt(self.target,"targetname");
fx = self.script_noteworthy;
trigger waittill("trigger");

fxTag = "tag_origin";
    self.fx = Spawn( "script_model", self.origin );
    self.fx SetModel( "tag_origin" );
    self.fx.angles = self.angles;
    self.fx.origin = self.origin;
    self.fx LinkTo( self, fxTag );

PlayFxOnTag( level._effect[fx], self.fx, fxTag );
}
triggered_progress_fx (true)
{
self waittill("self.script_string");
fx = self.script_noteworthy;


fxTag = "tag_origin";
    self.fx = Spawn( "script_model", self.origin );
    self.fx SetModel( "tag_origin" );
    self.fx.angles = self.angles;
    self.fx.origin = self.origin;
    self.fx LinkTo( self, fxTag );

PlayFxOnTag( level._effect[fx], self.fx, fxTag );
}
Last Edit: March 22, 2013, 08:40:51 am by trebeltom1
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 30 days ago
Posts
5,545
Respect
6,505Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
If it's a level notify you want to wait for, then you do level waittill, not self waittill. You also want to have waittill(self.script_string);. If you put a variable in quotes, it is no longer a variable...

I think PHP and its derivatives are the only language that allow you to use variables in quotes.

triggered_progress_fx (true)
{
level waittill(self.script_string);
fx = self.script_noteworthy;
   
   
    fxTag = "tag_origin";
    self.fx = Spawn( "script_model", self.origin );
    self.fx SetModel( "tag_origin" );
    self.fx.angles = self.angles;
    self.fx.origin = self.origin;
    self.fx LinkTo( self, fxTag );
   
    PlayFxOnTag( level._effect[fx], self.fx, fxTag );
}
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 17 February 2013
Last active: 1169 days ago
Posts
107
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
×
trebeltom1's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
trebeltom1's Contact & Social LinksWaffle Fries
cheers thanks a lot

 

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 Twitch
Loading ...