Answered Does anyone know the script for the perma perks

jcal147

Veteran
Messages
63
Reaction score
12
Points
568
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
4,700
Reaction score
2,808
Points
1,053
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

Insane-Known Member
Messages
181
Reaction score
61
Points
388
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