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

Player doesn't lose perks after downed?

broken avatar :(
Created 10 years ago
by NaviLlusShore
0 Members and 1 Guest are viewing this topic.
3,486 views
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
Signature
NaviLlicious
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
Alright so any perk you buy you will lose upon death, but any perks obtained from a drop you will keep when revived? So obviously It's something wrong with the script
Code Snippet
Plaintext
thegtlad()
{
    vending_triggers = GetEntArray( "zombie_vending", "targetname" );

    perks = [];
    for ( i = 0; i < vending_triggers.size; i++ )
    {
        perk = vending_triggers[i].script_noteworthy;

        if ( isdefined( self.perk_purchased ) && self.perk_purchased == perk )
        {
            continue;
        }

        if ( !self HasPerk( perk ) )
        {
            perks[ perks.size ] = perk;
        }
    }

    if ( perks.size > 0 )
    {
        perks = array_randomize( perks );
        self SetPerk( perks[0] );
        self perk_hud_create( perks[0] );
    }
}
seems alright to me but I could be missing something,
Code Snippet
Plaintext
powerup_grab()
{
    self endon ("powerup_timedout");
    self endon ("powerup_grabbed");

    while (isdefined(self))
    {
        players = get_players();

        for (i = 0; i < players.size; i++)
        {
            if (distance (players[i].origin, self.origin) < 64)
            {
                playfx (level._effect["powerup_grabbed"], self.origin);
                playfx (level._effect["powerup_grabbed_wave"], self.origin);

                if( IsDefined( level.zombie_powerup_grab_func ) )
                {
                    level thread [[level.zombie_powerup_grab_func]]();
                }
                else
                {
                    switch (self.powerup_name)
                    {
                    case "nuke":
                        level thread nuke_powerup( self );
                       
                        //chrisp - adding powerup VO sounds
                        players[i] thread powerup_vo("nuke");
                        zombies = getaiarray("axis");
                        players[i].zombie_nuked = get_array_of_closest( self.origin, zombies );
                        players[i] notify("nuke_triggered");
                       
                        break;
                    case "full_ammo":
                        level thread full_ammo_powerup( self );
                        players[i] thread powerup_vo("full_ammo");
                        break;
                    case "double_points":
                        level thread double_points_powerup( self );
                        players[i] thread powerup_vo("double_points");
                        break;
                    case "insta_kill":
                        level thread insta_kill_powerup( self );
                        players[i] thread powerup_vo("insta_kill");
                        break;
                    case "carpenter":
                        level thread start_carpenter( self.origin );
                        players[i] thread powerup_vo("carpenter");
                        break;
                    case "gtlad":
                        level thread gtlad_powerup( self );
                        break;
                    default:
                        println ("Unrecognized poweup.");
                        break;
                    }
                }

                wait( 0.1 );

                playsoundatposition("powerup_grabbed", self.origin);
                self stoploopsound();

                self delete();
                self notify ("powerup_grabbed");
            }
        }
        wait 0.1;
    }
}
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
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
You need to do a check to see if a player is dead and then take the perks when he dies.
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
You need to do a check to see if a player is dead and then take the perks when he dies.
How would I do that? Thing Is this script worked a few days ago I didn't change anything with It now It doesn't take perks when downed, but If the player were to buy the perk from the perk machine and go down then he would lose the perk
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 5 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.
How would I do that? Thing Is this script worked a few days ago I didn't change anything with It now It doesn't take perks when downed, but If the player were to buy the perk from the perk machine and go down then he would lose the perk
Do you mean like when the game is started? For instance the player dies and the game restarts? If so make sure at the beginning of the game you are setting the initial values for what you are changing your perks with. That way they will be reset.
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
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
No idea if it works but here:

Code Snippet
Plaintext
thegtlad()
{
    vending_triggers = GetEntArray( "zombie_vending", "targetname" );

    perks = [];
    for ( i = 0; i < vending_triggers.size; i++ )
    {
        perk = vending_triggers[i].script_noteworthy;

        if ( isdefined( self.perk_purchased ) && self.perk_purchased == perk )
        {
            continue;
        }

        if ( !self HasPerk( perk ) )
        {
            perks[ perks.size ] = perk;
    level thread player_death_perk_take(perk);
        }
    }

    if ( perks.size > 0 )
    {
        perks = array_randomize( perks );
        self SetPerk( perks[0] );
        self perk_hud_create( perks[0] );
    }
}
player_death_perk_take()
{
players = get_players();
for ( i = 0; i < players.size; i++ )
{
players[i] waittill_any( "fake_death", "death", "player_downed" ); // waittill any of these
{
players[i] unsetperk(perk); //should unset all the perks
}
}
}
Last Edit: January 18, 2014, 11:47:09 pm by daedra descent
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
Do you mean like when the game is started? For instance the player dies and the game restarts? If so make sure at the beginning of the game you are setting the initial values for what you are changing your perks with. That way they will be reset.
You don't die at the start but at any point of the game If the player has a perk from a drop and goes down he keeps the perk, but perks bought from perk machines are lost on down

Post Merge: January 19, 2014, 02:11:59 am
No idea if it works but here:

Code Snippet
Plaintext
thegtlad()
{
    vending_triggers = GetEntArray( "zombie_vending", "targetname" );

    perks = [];
    for ( i = 0; i < vending_triggers.size; i++ )
    {
        perk = vending_triggers[i].script_noteworthy;

        if ( isdefined( self.perk_purchased ) && self.perk_purchased == perk )
        {
            continue;
        }

        if ( !self HasPerk( perk ) )
        {
            perks[ perks.size ] = perk;
    level thread player_death_perk_take(perk);
        }
    }

    if ( perks.size > 0 )
    {
        perks = array_randomize( perks );
        self SetPerk( perks[0] );
        self perk_hud_create( perks[0] );
    }
}
player_death_perk_take()
{
players = get_players();
for ( i = 0; i < players.size; i++ )
{
players[i] waittill_any( "fake_death", "death", "player_downed" ); // waittill any of these
{
players[i] unsetperk(perk); //should unset all the perks
}
}
}
I will try this In a minute

Post Merge: January 19, 2014, 11:40:36 am
I get an error, uninitialized variable (perk) It's on this line
Code Snippet
Plaintext
players[i] unsetperk(perk);
Last Edit: January 19, 2014, 11:40:36 am by NaviLlusShore
Marked as best answer by NaviLlusShore 10 years ago
broken avatar :(
×
broken avatar :(
Location: usYork, SC
Date Registered: 30 March 2013
Last active: 10 years ago
Posts
24
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Coder
Signature
PROxFTW
×
blackbird431's Groups
blackbird431's Contact & Social Linksiso4lif3PROxFTWPROxFTWJTAGxHACKER
Try this script and let me know how it ends up
Code Snippet
Plaintext
thegtlad()
{
    vending_triggers = GetEntArray( "zombie_vending", "targetname" );

    perks = [];
    for ( i = 0; i < vending_triggers.size; i++ )
    {
        perk = vending_triggers[i].script_noteworthy;

        if ( isdefined( self.perk_purchased ) && self.perk_purchased == perk )
        {
            continue;
        }

        if ( !self HasPerk( perk ) )
        {
            perks[ perks.size ] = perk;
        }
    }

    if ( perks.size > 0 )
    {
        perks = array_randomize( perks );
        self SetPerk( perks[0] );
        self perk_hud_create( perks[0] );
        // If this code is in _zombiemode_perks
        self thread perk_think( perks[0] );
        // Otherwise comment out above line and take comment(//) out below
        //self thread maps\_zombiemode_perks::perk_think( perks[0] );
    }
}
broken avatar :(
×
broken avatar :(
Location: usThe North Pole
Date Registered: 12 September 2013
Last active: 10 years ago
Posts
123
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
I have come from the future
×
NaviLlusShore's Groups
NaviLlusShore's Contact & Social LinksTheHubbyNaviLlusShore
That seems to have got It working thank you
broken avatar :(
×
broken avatar :(
Location: usYork, SC
Date Registered: 30 March 2013
Last active: 10 years ago
Posts
24
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Coder
×
blackbird431's Groups
blackbird431's Contact & Social Linksiso4lif3PROxFTWPROxFTWJTAGxHACKER
That seems to have got It working thank you
No problem, glad I could help out.

 
Loading ...