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

I need a little help on a script for Mule Kick (take away weapon on revive)

broken avatar :(
Created 13 years ago
by JR-Imagine
0 Members and 1 Guest are viewing this topic.
3,013 views
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 5 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
Signature
"Deleted code is debugged code." - Jeff Sickel
"Mathematicians stand on each others' shoulders and computer scientists stand on each others' toes." - Richard Hamming
×
JR-Imagine's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
I've been asking for a lot of help lately, lol. :P

So I modified the laststand_giveback_player_weapons() function:
Code Snippet
Plaintext
laststand_giveback_player_weapons()
{
ASSERTEX( IsDefined( self.weaponInventory ), "player.weaponInventory is not defined - did you run laststand_take_player_weapons() first?" );

self TakeAllWeapons();

for( i = 0; i < self.weaponInventory.size; i++ )
{
weapon = self.weaponInventory[i];

switch( weapon )
{
// this player was killed while reviving another player
case "syrette":
// player was killed drinking perks-a-cola
case "zombie_perk_bottle_doubletap":
case "zombie_perk_bottle_revive":
case "zombie_perk_bottle_jugg":
case "zombie_perk_bottle_sleight":
case "zombie_bowie_flourish":
case "zombie_knuckle_crack":
continue;
}

self GiveWeapon( weapon );
self SetWeaponAmmoClip( weapon, self.weaponAmmo[weapon]["clip"] );

if ( WeaponType( weapon ) != "grenade" )
self SetWeaponAmmoStock( weapon, self.weaponAmmo[weapon]["stock"] );
}

// if we can't figure out what the last active weapon was, try to switch a primary weapon
//CHRIS_P: - don't try to give the player back the mortar_round weapon ( this is if the player killed himself with a mortar round)
if( self.lastActiveWeapon != "none" && self.lastActiveWeapon != "mortar_round" && self.lastActiveWeapon != "mine_bouncing_betty" )
{
self SwitchToWeapon( self.lastActiveWeapon );
}
else
{
primaryWeapons = self GetWeaponsListPrimaries();
if( IsDefined( primaryWeapons ) && primaryWeapons.size > 0 )
{
self SwitchToWeapon( primaryWeapons[0] );
}
}
primaryWeapons = self GetWeaponsListPrimaries();
if(primaryWeapons.size == 3) // he has three weapons
{
current_weapon = self getCurrentWeapon(); // get his current weapon
self TakeWeapon( current_weapon );
}
}

The last part is what I made. The problem is, it doesn't work. I'm trying to check if the player has 3 guns and if so, take away his third gun. It's the last thing I need to fix for Mule Kick, got the rest working just like in BO. :) Help would be greatly apreciated.

Stock map btw.
Last Edit: November 03, 2013, 10:49:29 am by JR-Imagine
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Just throwing a random idea out there, not sure if it'll actually work or not:

Code Snippet
Plaintext
for (i = 0; i < players.size; i++)
primaryWeapons = players[i] GetWeaponsListPrimaries();

Source:

Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;

initAmmoBox()
{

trig = getent("ammo_box", "targetname");
trig.is_available = 1;
trig.zombie_cost = 10000;
trig.in_use = 0;
trig sethintstring(&"ZOMBIE_AMMO_BOX");
trig setCursorHint( "HINT_NOICON" );


while(1)
{
trig waittill( "trigger", who );

if(trig.is_available)
{
if( is_player_valid( who ) )
{
if( who.score >= trig.zombie_cost )
{
if(!trig.in_use)
{
trig.in_use = 1;
trig.is_available = 0;

trig trigger_off();

play_sound_at_pos( "purchase", who.origin );

players = get_players();

for (i = 0; i < players.size; i++)
{
primaryWeapons = players[i] GetWeaponsListPrimaries();

for( x = 0; x < primaryWeapons.size; x++ )
{
players[i] GiveMaxAmmo( primaryWeapons[x] );
}

}
who maps\_zombiemode_score::minus_to_player_score( who.score );
trig trigger_on();

trig.is_available = 1;
trig.in_use = 0;
}
}
}
}
}
}

Last Edit: November 03, 2013, 10:57:58 am by daedra descent
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 5 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Uninitialised variable "players". Lol, CoD is drunk again. :P
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Uninitialised variable "players". Lol, CoD is drunk again. :P

oops, this might help

Code Snippet
Plaintext
players = get_players();
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 5 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
oops, this might help

Code Snippet
Plaintext
players = get_players();
Oh lol, I must be retarded not to see that either. xD Doesn't work though. :(
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 7 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature

(Click to enter portfolio)
×
SajeOne'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.
That code above was already in here^

Code Snippet
Plaintext
primaryWeapons = self GetWeaponsListPrimaries(); 
    if(primaryWeapons.size == 3) // he has three weapons
    {
        current_weapon = self getCurrentWeapon(); // get his current weapon
        self TakeWeapon( current_weapon );
    }
}
Are you sure this if statement is even being hit? 'Cause I'm guessing the mule kick script deletes the one index on down, not after he's revived. Put a print inside that if statement and see if it's read.
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 5 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
That code above was already in here^

Code Snippet
Plaintext
primaryWeapons = self GetWeaponsListPrimaries(); 
    if(primaryWeapons.size == 3) // he has three weapons
    {
        current_weapon = self getCurrentWeapon(); // get his current weapon
        self TakeWeapon( current_weapon );
    }
}
Are you sure this if statement is even being hit? 'Cause I'm guessing the mule kick script deletes the one index on down, not after he's revived. Put a print inside that if statement and see if it's read.

Hmm... Turns out that function isn't even used in solo. Lol. Silly me. I'll have to test that one to see if it works on co-op. But for now, I'll have to find the function for solo.

Edit: Got it working now, thanks for the help guys!
Last Edit: November 03, 2013, 04:43:29 pm by JR-Imagine

 
Loading ...