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 check to see if a player is still holding on a trigger?

broken avatar :(
Created 8 years ago
by FinalKill9175
0 Members and 1 Guest are viewing this topic.
1,691 views
broken avatar :(
×
broken avatar :(
Location: usChicago, IL
Date Registered: 8 January 2015
Last active: 2 years ago
Posts
136
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
×
FinalKill9175's Groups
FinalKill9175's Contact & Social LinksFinalKillGamingFinalKill917FinalKill9175
Hey guys, as you may know, I am trying to make the acid gat kit. I am scripting the buildable right now and I have a question. Is there a way to see if a player is still holding on a trigger (maybe a flag or something?)
Here is my chunk of code for the buildable:
Code Snippet
Plaintext
while(1){
kit_trig waittill("trigger", player);
sawsound = spawn("script_origin", kit_trig.origin);
sawsound playsound ("buildable_loop");
kit_trig SetHintString("");
player thread crack_knuckles();
wait 7;
player notify("buildable_completed");
sawsound playsound("buildable_completed");
playfx(level._effect["powerup_grabbed"], kit_model.origin);
kit_model show();
break;
}

Maybe I could do something like:
Code Snippet
Plaintext
kit_trig waittill("trigger", player);
sawsound = spawn("script_origin", kit_trig.origin);
sawsound playsound ("buildable_loop");
kit_trig SetHintString("");
player thread crack_knuckles();
while(PLAYER IS ON/HOLDING TRIGGER){
                           //Update progress bar, count, etc.
                }
player notify("buildable_completed");
sawsound playsound("buildable_completed");
playfx(level._effect["powerup_grabbed"], kit_model.origin);
kit_model show();
break;
Last Edit: June 14, 2016, 06:56:32 pm by FinalKill9175
Marked as best answer by FinalKill9175 8 years ago
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 6 months ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Player UseButtonPressed() returns a boolean
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
For something like this you would use a progress bar probably. Here are some of my helper functions that you may be able to take something from to work for what you want.


Code Snippet
Plaintext
ProgressBars(timer, knuckle, deleteit){
/* timer = optional, int or float for time to finish progress bar
knuckle = optional, boolean to have knuckle crack during or not
deleteit = optional, delete this trigger when done, boolean, default deletes it

Requires: knuckle_crack() and #include maps\_hud_util;
Displays a progress bar while player is holding use button until time is up, notifies
stop_building when progress bar is done, used for knuckle crack timer

Calls:
trig ProgressBars();
trig ProgressBars(timer);
trig ProgressBars(timer, knuckle);
trig ProgressBars(timer, knuckle, deleteit);
*/
if(!IsDefined( self )) return false;
if(!isDefined(timer)) timer=3;
constTime = timer;
player = undefined;
while(timer>0){
self waittill("trigger", player);
if(!is_player_valid( player )) return false;
if(isDefined(knuckle) && knuckle){
player thread knuckle_crack();
while(player GetCurrentWeapon() != "zombie_knuckle_crack") wait(.1);
}
player.PBar = player CreatePrimaryProgressBar();
player.PBar.color = ( .5, 1, 1 );
player.PBar UpdateBar( 0.01, 1/constTime );
while(player UseButtonPressed() && distance(player.origin, self.origin)<100 && player isOnGround() && !player maps\_laststand::player_is_in_laststand() && timer>0){
wait(.1);
timer = timer-.1;
}
player notify("stopped_building");
player.PBar destroyElem();
player.PBar = undefined;
}
if(!IsDefined( deleteit ) || deleteit) self delete();
}

knuckle_crack(){// self is player
/* no vars

Requires: AllowMoving(cond) and zombie_knuckle_crack
Cracks players knuckles, checks if has deathmachine before giving back last weapon

Calls:
player thread knuckle_crack();

*/
if(is_player_valid( self )) return;
self DisableOffhandWeapons();
self AllowMoving(false);
if( self GetStance() == "prone" ) self SetStance("crouch");
gun = self GetCurrentWeapon();
self GiveWeapon( "zombie_knuckle_crack" );
self SwitchToWeapon( "zombie_knuckle_crack" );
self waittill_any( "fake_death", "death", "player_downed", "stopped_building", "weapon_change_complete");
self EnableOffhandWeapons();
if(self GetCurrentWeapon()=="zombie_knuckle_crack" && IsSubStr( gun,"deathmachine" ) && (self !HasWeapon( "deathmachine" ) && self !HasWeapon( "deathmachine_upgraded" ))) self SwitchToWeapon( self GetWeaponsListPrimaries()[0] );
if(self GetCurrentWeapon()=="zombie_knuckle_crack" && is_player_valid(self)) self SwitchToWeapon( gun );
self TakeWeapon( "zombie_knuckle_crack" );
self AllowMoving(true);
}

AllowMoving(cond){//true to allow moving, false to not allow moving
/* cond = true or false, true will allow moving, false will prevent it

*/
self AllowLean(cond);
self AllowAds(cond);
self AllowSprint(cond);
self AllowProne(cond);
self AllowMelee(cond);
}
broken avatar :(
×
broken avatar :(
Location: usChicago, IL
Date Registered: 8 January 2015
Last active: 2 years ago
Posts
136
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
It's my hobby
×
FinalKill9175's Groups
FinalKill9175's Contact & Social LinksFinalKillGamingFinalKill917FinalKill9175
For something like this you would use a progress bar probably. Here are some of my helper functions that you may be able to take something from to work for what you want.


Code Snippet
Plaintext
ProgressBars(timer, knuckle, deleteit){
/* timer = optional, int or float for time to finish progress bar
knuckle = optional, boolean to have knuckle crack during or not
deleteit = optional, delete this trigger when done, boolean, default deletes it

Requires: knuckle_crack() and #include maps\_hud_util;
Displays a progress bar while player is holding use button until time is up, notifies
stop_building when progress bar is done, used for knuckle crack timer

Calls:
trig ProgressBars();
trig ProgressBars(timer);
trig ProgressBars(timer, knuckle);
trig ProgressBars(timer, knuckle, deleteit);
*/
if(!IsDefined( self )) return false;
if(!isDefined(timer)) timer=3;
constTime = timer;
player = undefined;
while(timer>0){
self waittill("trigger", player);
if(!is_player_valid( player )) return false;
if(isDefined(knuckle) && knuckle){
player thread knuckle_crack();
while(player GetCurrentWeapon() != "zombie_knuckle_crack") wait(.1);
}
player.PBar = player CreatePrimaryProgressBar();
player.PBar.color = ( .5, 1, 1 );
player.PBar UpdateBar( 0.01, 1/constTime );
while(player UseButtonPressed() && distance(player.origin, self.origin)<100 && player isOnGround() && !player maps\_laststand::player_is_in_laststand() && timer>0){
wait(.1);
timer = timer-.1;
}
player notify("stopped_building");
player.PBar destroyElem();
player.PBar = undefined;
}
if(!IsDefined( deleteit ) || deleteit) self delete();
}

knuckle_crack(){// self is player
/* no vars

Requires: AllowMoving(cond) and zombie_knuckle_crack
Cracks players knuckles, checks if has deathmachine before giving back last weapon

Calls:
player thread knuckle_crack();

*/
if(is_player_valid( self )) return;
self DisableOffhandWeapons();
self AllowMoving(false);
if( self GetStance() == "prone" ) self SetStance("crouch");
gun = self GetCurrentWeapon();
self GiveWeapon( "zombie_knuckle_crack" );
self SwitchToWeapon( "zombie_knuckle_crack" );
self waittill_any( "fake_death", "death", "player_downed", "stopped_building", "weapon_change_complete");
self EnableOffhandWeapons();
if(self GetCurrentWeapon()=="zombie_knuckle_crack" && IsSubStr( gun,"deathmachine" ) && (self !HasWeapon( "deathmachine" ) && self !HasWeapon( "deathmachine_upgraded" ))) self SwitchToWeapon( self GetWeaponsListPrimaries()[0] );
if(self GetCurrentWeapon()=="zombie_knuckle_crack" && is_player_valid(self)) self SwitchToWeapon( gun );
self TakeWeapon( "zombie_knuckle_crack" );
self AllowMoving(true);
}

AllowMoving(cond){//true to allow moving, false to not allow moving
/* cond = true or false, true will allow moving, false will prevent it

*/
self AllowLean(cond);
self AllowAds(cond);
self AllowSprint(cond);
self AllowProne(cond);
self AllowMelee(cond);
}
Thanks man, I will use these and give you credit.

 
Loading ...