UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: AlecKeaneDUB on September 02, 2016, 03:43:39 am

Title: Where do i put the scripts for a custom perk?
Post by: AlecKeaneDUB on September 02, 2016, 03:43:39 am
I have a custom perk setup within _zombiemode_perks, but where exactly do I thread and script the function for the perk after you buy it? Can't figue it out and have been searching for hours  :-\
Title: Re: Where do i put the scripts for a custom perk?
Post by: fanmagic on September 02, 2016, 01:56:55 pm
I have a custom perk setup within _zombiemode_perks, but where exactly do I thread and script the function for the perk after you buy it? Can't figue it out and have been searching for hours  :-\
Code Snippet
Plaintext
perk_function()
{
while(1)
{
if(self HasPerk("specialty_perk"))
self perk_effect();
else self effect_without_perk();

wait(.1);
}
}
Thread this as a check for all players somewhere under maps\_zombiemode::main(); in your mapname.gsc like this:
Code Snippet
Plaintext
players = get_players();
for(i=0;i<players.size;i++)
{
players[i] thread perk_function();
}

Bamskater used this code for his perks. So you only have to change the effect for the player i.e. Stamin-Up:
Code Snippet
Plaintext
staminup()
{
while(1)
{
if(self hasperk("specialty_longersprint"))    //rename the perk to yours
self setmovespeedscale(1.3);                     // add an effect
else
self setmovespeedscale(1);                        // reset the effect if the player has not the perk
wait .5;
}
}