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

Weapon Giving Problem

broken avatar :(
Created 7 years ago
by Deminate
0 Members and 1 Guest are viewing this topic.
3,172 views
broken avatar :(
×
broken avatar :(
Location: usOhio
Date Registered: 25 August 2016
Last active: 6 years ago
Posts
16
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Personal Quote
(Professional Whining Bitch)
Signature
https://gyazo.com/93315dd4d3fef896f930a9c88ad95026" width="958
×
Deminate's Groups
Deminate's Contact & Social Linksfirefromfrenchfryff1225GameForCHEEZDeminate
I have a script using "giveWeapon" but every time I get the weapon while I have 2 weapons already, it tries to give me 3 and of course Samantha curses me. How can I fix this to make it have the normal behavior of replacing a weapon if I have 2? I will put some of my script in just in case it helps, but not the whole script, because it's quite large.

Code Snippet
Plaintext
workbench waittill("trigger",player);

player thread do_knuckle_crack();
wait(2.7);
player playLocalSound("zmb_cha_ching");
player giveWeapon(getWeapon(level.weaponGiven));
player switchtoweapon(level.weaponGiven);
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: gbSomewhere in the UK
Date Registered: 20 July 2013
Last active: 2 months ago
Posts
79
Respect
Forum Rank
Rotting Walker
Primary Group
Donator ♥
My Groups
More
×
AoKMiKeY's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
AoKMiKeY's Contact & Social Links
Before you give the weapon your going to want to take the players current weapon. Here is a nice and simple play to do it.

Code Snippet
Plaintext
workbench waittill("trigger",player);

player thread do_knuckle_crack();
wait(2.7);
player playLocalSound("zmb_cha_ching");
player takeWeapon( player getCurrentWeapon() ); // new
player giveWeapon(getWeapon(level.weaponGiven));
player switchtoweapon(level.weaponGiven);

On my phone so check the ref to make sure those function names are right.
Last Edit: November 28, 2016, 07:20:43 am by AoKMiKeY
broken avatar :(
×
broken avatar :(
Location: usOhio
Date Registered: 25 August 2016
Last active: 6 years ago
Posts
16
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Personal Quote
(Professional Whining Bitch)
×
Deminate's Groups
Deminate's Contact & Social Linksfirefromfrenchfryff1225GameForCHEEZDeminate
Thanks, but what if he has 1 gun? Will it give another or replace it? How can I check how many weapons he has for that. One last thing, where do you find these functions?
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
Have you tried to use
Code Snippet
Plaintext
zm_weapons::weapon_give(weaponobject);
It does a lot more checks, and I think one of them will handle mule kick and if player has max weapons.


And are you using the do_knucke_crack from _zm_pack_a_punch.gsc? I would assume they have compensated for that issue in there, most likely using the zm_utility::increment_is_drinking() function, and the zm_utility::decrement_is_drinking() one.

Code Snippet
Plaintext
workbench waittill("trigger",player);

player thread _zm_pack_a_punch::do_knuckle_crack();
wait(2.7);
player playLocalSound("zmb_cha_ching");
player zm_weapons::weapon_give(getWeapon(level.weaponGiven));
player switchtoweapon(getweapon(level.weaponGiven));


For your original issue, if this stuff ^ doesn't help, you can just check the primary size, something like this:
Code Snippet
Plaintext
	if ( player HasPerk( "specialty_additionalprimaryweapon" ) )
{
if(player GetWeaponsListPrimaries().size > 2)
{
player TakeWeapon(player GetCurrentWeapon());
}
}
else
{
if(player GetWeaponsListPrimaries().size > 1)
{
player TakeWeapon(player GetCurrentWeapon());
}
}
player GiveWeapon(getweapon(weapon));
player SwitchToWeapon(getweapon(weapon));

But there will be other concerns, like the minigun powerup and laststand and so on...
Last Edit: November 29, 2016, 02:50:38 am by MakeCents
Marked as best answer by Deminate 7 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 February 2014
Last active: 1 year ago
Posts
69
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
What is broken can be reforged
Signature
Completed maps:
Kingdom Hearts - World at War Link
Minecraft - Black ops 3 Link

WIP:
~

×
shinged's Groups
shinged's Contact & Social LinksShingedvinny545TheShingedMatarra_
This is what i used to give the player the wunderwaffe in my Minecraft map
Code Snippet
Plaintext
weapon = getweapon( "tesla_gun" );
player zm_weapons::weapon_give(weapon, false, false);
broken avatar :(
×
broken avatar :(
Location: at
Date Registered: 26 November 2016
Last active: 6 years ago
Posts
45
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Signature
12 year old music critic, quadrasexual Minecrafter, Linkin Park fan, Hentai enthusiast, intelligent atheist and vegan.
×
Cxwh's Groups
Cxwh's Contact & Social LinksCxwhModsGodAspire
Have you tried to use
Code Snippet
Plaintext
zm_weapons::weapon_give(weaponobject);
It does a lot more checks, and I think one of them will handle mule kick and if player has max weapons.


And are you using the do_knucke_crack from _zm_pack_a_punch.gsc? I would assume they have compensated for that issue in there, most likely using the zm_utility::increment_is_drinking() function, and the zm_utility::decrement_is_drinking() one.

Code Snippet
Plaintext
workbench waittill("trigger",player);

player thread _zm_pack_a_punch::do_knuckle_crack();
wait(2.7);
player playLocalSound("zmb_cha_ching");
player zm_weapons::weapon_give(getWeapon(level.weaponGiven));
player switchtoweapon(getweapon(level.weaponGiven));
You won't be able to do so since all functions in '_zm_pack_a_punch' are private, atleast I think so (and it also #namespace isn't used)

 
Loading ...