UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: javipotter on August 13, 2014, 09:32:14 pm

Title: staff buildable fx prob
Post by: javipotter on August 13, 2014, 09:32:14 pm
hi, i write this because im making buildables of staff, each piece has an fx but theproblem is that when i take the piece the fx doesnt dissapear, here is the script i hope u know how to solve this little problem
Code Snippet
Plaintext
//================================================================================================
// Notes      : call after zombiemode main in MAPNAME.GSC
// Fire Staff Buildable Script
//================================================================================================
#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_utility;

main()
{
flag_init("gas_cantrue");
flag_init("oiltrue");
flag_init("recipetrue");
gas_can = GetEnt("pickup_lightningstaff_1_trigger","targetname");// trigger in radiant that players use to pick up model
gas_can thread gas_can(gas_can);
oil = GetEnt("pickup_lightningstaff_2_trigger","targetname");// // trigger in radiant that players use to pick up model
oil thread oil(oil);
recipe = GetEnt("pickup_lightningstaff_3_trigger","targetname");// // trigger in radiant that players use to pick up model
recipe thread recipe(recipe);
recipetrue = GetEnt("build_lightningstaff","targetname");///trigger in radiant that players use to build model
recipetrue recipetrue(recipetrue);
}

gas_can()
{
self sethintstring( "^4press &&1 to pick up Piece"  );
self setCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookat();
player = undefined;
gas_canpart1 = getent("lightningstaff_1", "targetname");// model that u want to actually pick up
playfx (level._effect["lightning_fx"], self.origin);// add your fx here optional
self waittill("trigger", player);
gas_canpart1 Delete();
flag_set( "gas_cantrue" );
player thread builablehud("I hope there is a gas station on this rock");
playfx (level._effect["powerup_grabbed"], self.origin);
playfx (level._effect["powerup_grabbed_wave"], self.origin);
self Delete();
}

oil()
{
self sethintstring( "^4press &&1 to pick up Piece"  );
self setCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookat();
oilpart1 = getent("lightningstaff_2", "targetname");// model that u want to actually pick up
player = undefined;
playfx (level._effect["lightning_fx"], self.origin);// add your fx here optional
self waittill("trigger", player);
oilpart1 Delete();
flag_set( "oiltrue" );
player thread builablehud("Now maybe that engine wont jam");
playfx (level._effect["powerup_grabbed"], self.origin);
playfx (level._effect["powerup_grabbed_wave"], self.origin);
self Delete();
}

recipe()
{
self sethintstring( "^4press &&1 to pick up Piece"  );
self setCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookat();
recipepart1 = getent("lightningstaff_3", "targetname");// model that u want to actually pick up
player = undefined;
playfx (level._effect["lightning_fx"], self.origin);// add your fx here optional
self waittill("trigger", player);
recipepart1 Delete();
flag_set( "recipetrue" );
player thread builablehud("Now maybe that engine wont jam");
playfx (level._effect["powerup_grabbed"], self.origin);
playfx (level._effect["powerup_grabbed_wave"], self.origin);
self Delete();
}


recipetrue()
{
self sethintstring( "^4Missing Piece"  );
self setCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookat();
recipepart = getent("lightning_staff_view", "targetname");// model that will actually show up once player builds it
recipepart hide();
player = undefined;
flag_wait( "recipetrue" );
flag_wait( "oiltrue" );
flag_wait( "gas_cantrue" );
self sethintstring( "^4press &&1 to Place Pieces"  );
self waittill("trigger", player);
player thread maps\_zombiemode_perks::do_knuckle_crack();
playfx (level._effect["powerup_grabbed"], self.origin);
playfx (level._effect["powerup_grabbed_wave"], self.origin);
self sethintstring( "^4press &&1 to pick up gun"  );
    self waittill("trigger", player);
    player GiveWeapon("staff_lightning");
    player SwitchToWeapon("staff_lightning");
self Delete();
recipepart show();
recipepart solid();
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////
builablehud( text )
{
hint_hud = create_simple_hud( self );
hint_hud.alignX = "center";
hint_hud.alignY = "middle";
hint_hud.horzAlign = "center";
hint_hud.vertAlign = "middle";
hint_hud.fontscale = 8;
hint_hud.color = ( 1, 1, 1 );
hint_hud.x = 0;
hint_hud.y = -4; // -265;
hint_hud.alpha = 0;
hint_hud SetText( text );
hint_hud FadeOverTime( 1 );
hint_hud.alpha = 1;
wait( 1 );
hint_hud FadeOverTime( 2 );
hint_hud.color = ( 0, 0.4, 0 );
wait(2.5);
hint_hud Destroy();
}
Title: Re: staff buildable fx prob
Post by: steviewonder87 on August 13, 2014, 09:51:31 pm
I'm not a scripter so I haven't looked at the script, but is the fx looping? That could be the problem.
Title: Re: staff buildable fx prob
Post by: n123q45 on August 13, 2014, 10:08:16 pm
also the best way to remove the fx is delete the item its spawned on :) learned that the hard way
Title: Re: staff buildable fx prob
Post by: jjbradman on August 13, 2014, 11:37:43 pm
you're using "playfx" which spawns the fx at given origin but cant be deleted, so the fx must not be a naturally looped fx because. well, it will loop forever and you cant stop that.
thats why people use "playfxontag" which can be spawned at any tag of a model. normally "tag_origin". and theres a model called "tag_origin" with the same tag name which is invisible so you can play fx on that also. and to stop the fx you must delete the model(ent) it is being played on.
Title: Re: staff buildable fx prob
Post by: javipotter on August 14, 2014, 05:59:00 pm
But can anyone add the scripting lines cause i dont know how to write that
Title: Re: staff buildable fx prob
Post by: n123q45 on August 14, 2014, 06:24:32 pm
Code Snippet
Plaintext
staff = getEnt("box","targetname");
fx = PlayFxOnTag( level._effect["powerup_grabbed"], staff, "tag_origin" );
Title: Re: staff buildable fx prob
Post by: javipotter on August 14, 2014, 07:02:59 pm
Where do i have toplaceit and do I have to modify smthing?
Title: Re: staff buildable fx prob
Post by: n123q45 on August 14, 2014, 10:55:07 pm
modify the variables based on your script. and it goes exactly where the old fx would