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

Replacing Grenades With New Grenades

broken avatar :(
Created 8 years ago
by MJPWGaming
0 Members and 1 Guest are viewing this topic.
4,232 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 26 March 2014
Last active: 3 years ago
Posts
200
Respect
Forum Rank
Mr. Elemental
Primary Group
Donator ♥
My Groups
More
×
MJPWGaming's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
MJPWGaming's Contact & Social Links
So I have a new grenade type in my map but when you buy them you get 4 of the new and you'll still have the normal standard grenades. When the next round starts, you'll get two standard and none of the alternate. You'll only get it when you buy them off the wall again.

Also aside from this, when I get it from the box it replaces the gun that you have out :(

If someone could help me that would be fantastic!

By the way, just so if there was a coded reply, my standard grenades are "stielhandgranate" and we'll call the new ones "stielhandgranate2"
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 3 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
Signature
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
If you buy them on the wall, as a normal wall weapon, you need to include your weapon inside the if where it takes the player's weapon (_zombiemode_weapons, weapon_give( weapon, is_upgrade ) ):
Code Snippet
Plaintext
if( isdefined( current_weapon ) )
{
if( !( weapon == "fraggrenade" || weapon == "stielhandgranate" || weapon == "molotov" || weapon == "zombie_cymbal_monkey" || weapon == "stielhandgranate2") )
{
self TakeWeapon( current_weapon );
}
}
Then you have to take the player's grenades, checking if the player has them and that you're giving the new grenades to take his normal grenades.
If they appear in the box the code is very similar but in treasure_chest_give_weapon( weapon_string ) and if you're not using the original script for this, you'll have to find where the script for buying wall weapons is.
And for the round part, with the name you gave to grenades is really simple. Go to award_grenades_for_survivors() and you have to add this inside the first if statement:
Code Snippet
Plaintext
new_grenades = "";
if( players[i] hasWeapon( "stielhandgranate2" ) )
    new_grenades = "2";
And every time it says "stielhandgranate" inside this function, put this:
Code Snippet
Plaintext
"stielhandgranate" + new_grenades

Not tested, though.
Last Edit: December 30, 2015, 11:12:04 am by Soy-Yo
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 26 March 2014
Last active: 3 years ago
Posts
200
Respect
Forum Rank
Mr. Elemental
Primary Group
Donator ♥
My Groups
More
×
MJPWGaming's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
MJPWGaming's Contact & Social Links
If you buy them on the wall, as a normal wall weapon, you need to include your weapon inside the if where it takes the player's weapon (_zombiemode_weapons, weapon_give( weapon, is_upgrade ) ):
Code Snippet
Plaintext
if( isdefined( current_weapon ) )
{
if( !( weapon == "fraggrenade" || weapon == "stielhandgranate" || weapon == "molotov" || weapon == "zombie_cymbal_monkey" || weapon == "stielhandgranate2") )
{
self TakeWeapon( current_weapon );
}
}
Then you have to take the player's grenades, checking if the player has them and that you're giving the new grenades to take his normal grenades.
If they appear in the box the code is very similar but in treasure_chest_give_weapon( weapon_string ) and if you're not using the original script for this, you'll have to find where the script for buying wall weapons is.
And for the round part, with the name you gave to grenades is really simple. Go to award_grenades_for_survivors() and you have to add this inside the first if statement:
Code Snippet
Plaintext
new_grenades = "";
if( players[i] hasWeapon( "stielhandgranate2" ) )
    new_grenades = "2";
And every time it says "stielhandgranate" inside this function, put this:
Code Snippet
Plaintext
"stielhandgranate" + new_grenades

Not tested, though.

Uninitialized variable "weapon"
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 13 days ago
Posts
3,997
Respect
1,024Add +1
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Uninitialized variable "weapon"

Change these:
Code Snippet
Plaintext
			if( !( weapon == "fraggrenade" || weapon == "stielhandgranate" || weapon == "molotov" || weapon == "zombie_cymbal_monkey" || weapon == "stielhandgranate2") )
to be current_weapon instead of weapon
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
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.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
Change these:
Code Snippet
Plaintext
			if( !( weapon == "fraggrenade" || weapon == "stielhandgranate" || weapon == "molotov" || weapon == "zombie_cymbal_monkey" || weapon == "stielhandgranate2") )
to be current_weapon instead of weapon

That'll mess things up, this is the function:
Spoiler: click to open...
Code Snippet
Plaintext
weapon_give( weapon, is_upgrade )
{
primaryWeapons = self GetWeaponsListPrimaries();
current_weapon = undefined;

//if is not an upgraded perk purchase
if( !IsDefined( is_upgrade ) )
{
is_upgrade = false;
}

// This should never be true for the first time.
if( primaryWeapons.size >= 2 ) // he has two weapons
{
current_weapon = self getCurrentWeapon(); // get his current weapon

if ( current_weapon == "mine_bouncing_betty" )
{
current_weapon = undefined;
}

if( isdefined( current_weapon ) )
{
if( !( weapon == "fraggrenade" || weapon == "stielhandgranate" || weapon == "molotov" || weapon == "zombie_cymbal_monkey" ) )
{
self TakeWeapon( current_weapon );
}
}
}

if( weapon == "zombie_cymbal_monkey" )
{
// PI_CHANGE_BEGIN
// JMA 051409 sanity check to see if we have the weapon before we remove it
has_weapon = self HasWeapon( "molotov" );
if( isDefined(has_weapon) && has_weapon )
{
self TakeWeapon( "molotov" );
}

if( isDefined(level.zombie_weapons) && isDefined(level.zombie_weapons["molotov_zombie"]) )
{
has_weapon = self HasWeapon( "molotov_zombie" );
if( isDefined(has_weapon) && has_weapon )
{
self TakeWeapon( "molotov_zombie" );
}
}
// PI_CHANGE_END

self maps\_zombiemode_cymbal_monkey::player_give_cymbal_monkey();
play_weapon_vo( weapon );
return;
}
if( (weapon == "molotov" || weapon == "molotov_zombie") )
{
self TakeWeapon( "zombie_cymbal_monkey" );
}

self play_sound_on_ent( "purchase" );
self GiveWeapon( weapon, 0 );
self GiveMaxAmmo( weapon );
self SwitchToWeapon( weapon );

play_weapon_vo(weapon);
}

The weapon var should be passed on from the function that called it.
Did you put it in the correct function, and not in the function for the box? ( treasure_cheast_give_weapon )
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 13 days ago
Posts
3,997
Respect
1,024Add +1
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
That'll mess things up, this is the function:
Spoiler: click to open...
Code Snippet
Plaintext
weapon_give( weapon, is_upgrade )
{
primaryWeapons = self GetWeaponsListPrimaries();
current_weapon = undefined;

//if is not an upgraded perk purchase
if( !IsDefined( is_upgrade ) )
{
is_upgrade = false;
}

// This should never be true for the first time.
if( primaryWeapons.size >= 2 ) // he has two weapons
{
current_weapon = self getCurrentWeapon(); // get his current weapon

if ( current_weapon == "mine_bouncing_betty" )
{
current_weapon = undefined;
}

if( isdefined( current_weapon ) )
{
if( !( weapon == "fraggrenade" || weapon == "stielhandgranate" || weapon == "molotov" || weapon == "zombie_cymbal_monkey" ) )
{
self TakeWeapon( current_weapon );
}
}
}

if( weapon == "zombie_cymbal_monkey" )
{
// PI_CHANGE_BEGIN
// JMA 051409 sanity check to see if we have the weapon before we remove it
has_weapon = self HasWeapon( "molotov" );
if( isDefined(has_weapon) && has_weapon )
{
self TakeWeapon( "molotov" );
}

if( isDefined(level.zombie_weapons) && isDefined(level.zombie_weapons["molotov_zombie"]) )
{
has_weapon = self HasWeapon( "molotov_zombie" );
if( isDefined(has_weapon) && has_weapon )
{
self TakeWeapon( "molotov_zombie" );
}
}
// PI_CHANGE_END

self maps\_zombiemode_cymbal_monkey::player_give_cymbal_monkey();
play_weapon_vo( weapon );
return;
}
if( (weapon == "molotov" || weapon == "molotov_zombie") )
{
self TakeWeapon( "zombie_cymbal_monkey" );
}

self play_sound_on_ent( "purchase" );
self GiveWeapon( weapon, 0 );
self GiveMaxAmmo( weapon );
self SwitchToWeapon( weapon );

play_weapon_vo(weapon);
}

The weapon var should be passed on from the function that called it.
Did you put it in the correct function, and not in the function for the box? ( treasure_cheast_give_weapon )

Right, I didnt check the actual script, so I went with what was shown in his comment :P
Yeah, check that the function name is weapon_give( weapon, is_upgrade )
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
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.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
Right, I didnt check the actual script, so I went with what was shown in his comment :P


https://youtu.be/G-2NimrRPAQ   :troll:
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 13 days ago
Posts
3,997
Respect
1,024Add +1
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 26 March 2014
Last active: 3 years ago
Posts
200
Respect
Forum Rank
Mr. Elemental
Primary Group
Donator ♥
My Groups
More
×
MJPWGaming's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
MJPWGaming's Contact & Social Links
Did you put it in the correct function, and not in the function for the box? ( treasure_cheast_give_weapon )

I dont believe so :( Where in the function would it go?
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 3 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
I dont believe so :( Where in the function would it go?
You must have put it in other function because weapon is initialized since it's an argument of the function.
The function is the one Blunt copied in the Hidden text.
You only have to find this line inside that function:
Code Snippet
Plaintext
if( !( weapon == "fraggrenade" || weapon == "stielhandgranate" || weapon == "molotov" || weapon == "zombie_cymbal_monkey" ) )
and add:
Code Snippet
Plaintext
|| weapon == "stielhandgranate2"
And you have to do something similar for the box if the grenade appears in the box.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 26 March 2014
Last active: 3 years ago
Posts
200
Respect
Forum Rank
Mr. Elemental
Primary Group
Donator ♥
My Groups
More
×
MJPWGaming's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
MJPWGaming's Contact & Social Links
You must have put it in other function because weapon is initialized since it's an argument of the function.
The function is the one Blunt copied in the Hidden text.
You only have to find this line inside that function:
Code Snippet
Plaintext
if( !( weapon == "fraggrenade" || weapon == "stielhandgranate" || weapon == "molotov" || weapon == "zombie_cymbal_monkey" ) )
and add:
Code Snippet
Plaintext
|| weapon == "stielhandgranate2"
And you have to do something similar for the box if the grenade appears in the box.

Okay now I have uninitialized variable "new_grenades"
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 3 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
Okay now I have uninitialized variable "new_grenades"
lol, I'll PM you what you have to change.

 
Loading ...