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

Ray Gun Powerup Help

broken avatar :(
Created 10 years ago
by hiimachicken
0 Members and 1 Guest are viewing this topic.
1,078 views
broken avatar :(
×
broken avatar :(
Location: gbScotland
Date Registered: 21 August 2014
Last active: 4 years ago
Posts
59
Respect
Forum Rank
Rotting Walker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
hi m8
×
hiimachicken's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
hiimachicken's Contact & Social Linkshiimachicken
I had this working then realised if the player had a ray gun it wouldn't give him the weapon back so i did this, but now if he has a ray gun it works and it gives it back to him, but if he doesn't it doesn't even give him a ray gun anyway


cant anyone please tell me how to get the ray gun, because in theory it would work.

Thanks


CODE:
Code Snippet
Plaintext
magic_ray_powerup( drop_item, player_won )
{
if(level.player hasWeapon("ray_gun"))
{

curgun = self getCurrentWeapon();
//self giveWeapon("ray_gun");
setSavedDvar("player_sustainAmmo", "1");



//switch gun
self switchToWeapon("ray_gun");
self DisableWeaponCycling();

iPrintLn ("Ray gun given");

wait( 20 );
setSavedDvar("player_sustainAmmo", "0");
self EnableWeaponCycling();
self switchToWeapon( curgun );

}
else
{
curgun = self getCurrentWeapon();
self giveWeapon("ray_gun");
setSavedDvar("player_sustainAmmo", "1");



//switch gun
self switchToWeapon("ray_gun");
self DisableWeaponCycling();

iPrintLn ("Ray gun given");

wait( 20 );

setSavedDvar("player_sustainAmmo", "0");
self EnableWeaponCycling();
self takeWeapon("ray_gun");
self switchToWeapon( curgun );
}
}

Double Post Merge: August 30, 2014, 12:23:55 pm
WOW, fixed it myself i had 'level.player' instead of 'self'
Last Edit: August 30, 2014, 12:23:55 pm by hiimachicken
Marked as best answer by hiimachicken 10 years ago
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 7 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
Code Snippet
Plaintext
//Better way to code your powerup.
magic_ray_powerup( drop_item, player_won )
{
held_weap = self GetCurrentWeapon();
//I'm assuming player_won = is self or so.
SetSavedDvar("player_sustainAmmo", "1");

if(!(self HasWeapon("ray_gun"))
self GiveWeapon("ray_gun");

self SwitchToWeapon("ray_gun");
self DisableWeaponCycling();

IPrintLn("Ray Gun given");
wait 20;

SetSavedDvar("player_sustainAmmo", "0");
self EnableWeaponCycling();
self TakeWeapon("ray_gun");
self SwitchToWeapon(held_weap);

}
Don't need to do separate if/else blocks :P

 
Loading ...