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

Custom Perk Help

broken avatar :(
Created 9 years ago
by MZslayer11
0 Members and 1 Guest are viewing this topic.
2,684 views
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 7 March 2014
Last active: 2 months ago
Posts
1,191
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Site Moderator
My Groups
More
My Contact & Social Links
More
×
MZslayer11's Groups
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
MZslayer11's Contact & Social LinksMZslayer11Service_Code_30#2655
I am making a custom perk and I need to know how to make it so that before buying the perk, the player has a perk limit of 4. After buying the perk, the perk limit becomes 8.

thanks,
MZslayer11
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 7 March 2014
Last active: 2 months ago
Posts
1,191
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Site Moderator
My Groups
More
My Contact & Social Links
More
×
MZslayer11's Groups
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
MZslayer11's Contact & Social LinksMZslayer11Service_Code_30#2655
Would this work? Still new to scripting :P

In _zombiemode.gsc:
Code Snippet
Plaintext
	maps\_zombiemode_blockers_new::init();
maps\_zombiemode_spawner::init();
maps\_zombiemode_powerups::init();
maps\_zombiemode_radio::init();
maps\_zombiemode_perks::init();
maps\_zombiemode_tesla::init();
maps\_zombiemode_bowie::bowie_init();
maps\_zombiemode_cymbal_monkey::init();
maps\_zombiemode_betty::init();
maps\_zombiemode_timer::init();
maps\_zombiemode_auto_turret::init();
maps\_moonstyle_teleporter_update::init();
maps\_zombiemode_perks_black_ops::init();

if(self hasperk("specialty_extraammo"))
{
level.perk_limit = 8
}
else
{
level.perk_limit = 4;
}

level.revive_point = getEnt("revive_retreat_point","targetname");
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Where you put that code will only check once, when the game starts. So that won't work there.

If you are controlling your perk_limit with a variable and you want it to be changed with a perk per player, then you wouldn't want to use a level variable. You would want to set a player variable.

Or, each time they go to by a perk, check if the player that is buying the perk has < level.perk_limit perks or if they have this perk, and if they have < 8 perks. If they have < level.perk_limit it will work, if they have this perk and less than 8 perks it will work, else continue.

If you are going to use a variable for each player you can still do it the way I said above, you would just check then if the number of perks the player has is < player.level_perk variable, else continue.

Make sure to reset the variable or unset the perk, which ever you do, if the player goes down, or dies.
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 7 March 2014
Last active: 2 months ago
Posts
1,191
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Site Moderator
My Groups
More
My Contact & Social Links
More
×
MZslayer11's Groups
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
MZslayer11's Contact & Social LinksMZslayer11Service_Code_30#2655
Thanks, would you mind giving an example of this? Also, where would I put it?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Thanks, would you mind giving an example of this? Also, where would I put it?

If you will be using a shader and everything just like a normal perk, you can pretty much just do your perk the same way all the others do. Look through the _zombiemode_perks.gsc. Follow one of the perks, like double tap. You'll notice that double tap uses specialty_rof, as the specialty. There are variations of this through the perk script which all have to do with doubletap. You can shadow what they did with your own perk, with a different specialty, like specialty_shades. Here is a list, but not all work, some are reserved for other things. Once you have set up the script like the others, and made a prefab like the others, with your stuff, then you just need to add the other part to check if the player is at the limit. I would probably start doing that in the for loop in the vending_trigger_think function. Something like:

Code Snippet
Plaintext
	level.perk_limit = 4;
self waittill( "trigger", player );
if(!isdefined(player.numberofperks)){
player.numberofperks = 0;
}
if(!(player.numberofperks<level.perk_limit)&&!(player hasperk("specialty_shades") && player.numberofperks<8)){
iprintlnbold("too many perks");
continue;
}

Then down under where it checks the price:
Code Snippet
Plaintext
		if ( player.score < cost )
{
//player iprintln( "Not enough points to buy Perk: " + perk );
self playsound("deny");
player thread play_no_money_perk_dialog();
continue;
}
player.numberofperks++;


Then in the perk_think function, add self.numberofperks = 0; and unset the new specialty of course, if you didn't already.

Keep in mind I have never tried to add a perk limit and this script is not tested. It is just the first thing that popped in my head. There are tuts for level.perk_limit though if you just want to copy the way someone else has done it before... and start from there?

Uh, ps, if you have other perk scripts, like bams bo perks or something else you would have to handle it there as well.

I actually wanted a perk limit in the next map, so I edited the script above after a little testing.
Last Edit: December 31, 2014, 04:52:53 am by MakeCents

 
Loading ...