Answered Does anyone know the script for the perma perks

jcal147

Veteran
Messages
63
Reaction score
12
Points
793
Can someone please help me with the script for the perma perks. thank you for your time and consideration.
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,093
Reaction score
2,881
Points
1,103
Can someone please help me with the script for the perma perks. thank you for your time and consideration.
With these two function you can give/take perma perks:
Code:
//perma perks
PermaPerkGive(name)
{
    self endon("disconnect");
    level endon("game_ended");
    self endon("death");
    self endon("StopPermaPerks_" + name);
    pers_upgrade = level.pers_upgrades[ name ];
    for ( ;; )
    {
        i = 0;
        while ( i < pers_upgrade.stat_names.size )
        {
            stat_name = pers_upgrade.stat_names[ i ];
            stat_value = pers_upgrade.stat_desired_values[ i ];
            self maps/mp/zombies/_zm_stats::set_global_stat( stat_name, stat_value );
            self.stats_this_frame[ stat_name ] = true;
            i++;
            wait 0.05;
        }
        wait 10;
    }
}
PermaPerkTake(name)
{
        self notify("StopPermaPerks_" + name);
        wait 0.05;
        pers_upgrade = level.pers_upgrades[ name ];
        i = 0;
        while ( i < pers_upgrade.stat_names.size )
        {
            stat_name = pers_upgrade.stat_names[ i ];
            stat_value = 0;
            self maps/mp/zombies/_zm_stats::set_global_stat( stat_name, stat_value );
            self.stats_this_frame[ stat_name ] = true;
            i++;
        }
}

That was my menu create system. I recommend to you to do something like this too:
Code:
UpdatePermaPerksMenu()
{
    input = [];
    input[0] = "permaperk";
    input[1] = self;
    input[2] = "";
    input[3] = "";
    self addMenu("perksmenu", "permaperksmenu", "Perma Perks");
    for(i = 0; i < (level.pers_upgrades_keys.size); i++)
    {      
        input[3] = level.pers_upgrades_keys[i];
        self addOption("permaperksmenu", input[3], ::PermaPerkGive, input);
    }

}
Mainly use the level.pers_upgrades_keys array to generate the menu base. :smile:
 

Bossnagev420

Veteran
Messages
201
Reaction score
65
Points
813
does it work like this? trying to make a menu for me and friends and ive been trying to get perma perks to work for hours

Code:
self addMenuPar("perk name", ::PermaPerkGive, "perk name");
 
Top