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

Adding perklimit and unlocking all

HOT
broken avatar :(
Created 11 years ago
by HitmanVere
0 Members and 1 Guest are viewing this topic.
6,675 views
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 2 years ago
Posts
3,997
Respect
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere'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.
Mapper Has released one or more maps to the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I was thinking of adding perklimit in Rainy Death and then unlocking perkslots by doing certain thing/things. Cant find topic for it, so I thought I would ask here. Where would I start off?
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 26 May 2014
Last active: 3 years ago
Posts
149
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Mapper and Zombies Player
Signature
Long time custom zombies player
×
Nathiri's Groups
Nathiri's Contact & Social Links-SkorpioSkemaj29blazehead
There is this tutorial here for buyable perk slots which puts a perk limit in as well. Not sure if it works well or not though.

http://ugx-mods.com/forum/index.php/topic,6437.0.html
Last Edit: September 16, 2015, 11:55:43 am by Nathiri
Marked as best answer by HitmanVere 11 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
That seems that it will work. There are many comments with better examples. The main tut seems to give all players another perk slot, not just the player, but I could be wrong. You could do it simpler by editing where your perk is bought. But I don't know what perks you are using. If you are just using zombiemode_perks, it is really easy to intialize a att for each player then add a check when they buy or trigger the perk in the vending trigger think function. When they buy a perk slot, obviously another function for that, it would increase their att by one if less then the max.

Code Snippet
Plaintext
//under this in zombiemode perks:
for( ;; )
{
self waittill( "trigger", player );

//then you add:
if(!IsDefined( player.perklimit )) player.perklimit = 4;

//then you have the option to make another function or track this att better. I would just check myself like so:
if(player MaxPerks()){
player IPrintLnBold( "You already have the max perks." );
continue;
}

//of course you would need the MaxPerks function:
MaxPerks(){
if(self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty ))>= self.perklimit return true;
return false;
}

//Im not actually sure if you can do what I did above, you may need to intialize a var and increase it for every perk they have...
//change all instances of specialty to the perks in your map, and add and delete self HasPerk() as necessary

What this should result in is them buying the perk. Or if they have the max perks, a message appearing.

You can use some from that tut to set up a fancy fx and to purchase another perk. When they trigger it if they can afford it and it is less then the max you want them to have, player.perklimit++; Pretty much the same that the tut has.

Last Edit: September 16, 2015, 12:50:44 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 2 years ago
Posts
3,997
Respect
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere'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.
Mapper Has released one or more maps to the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
That seems that it will work. There are many comments with better examples. The main tut seems to give all players another perk slot, not just the player, but I could be wrong. You could do it simpler by editing where your perk is bought. But I don't know what perks you are using. If you are just using zombiemode_perks, it is really easy to intialize a att for each player then add a check when they buy or trigger the perk in the vending trigger think function. When they buy a perk slot, obviously another function for that, it would increase their att by one if less then the max.

Code Snippet
Plaintext
//under this in zombiemode perks:
for( ;; )
{
self waittill( "trigger", player );

//then you add:
if(!IsDefined( player.perklimit )) player.perklimit = 4;

//then you have the option to make another function or track this att better. I would just check myself like so:
if(player MaxPerks()){
player IPrintLnBold( "You already have the max perks." );
continue;
}

//of course you would need the MaxPerks function:
MaxPerks(){
if(self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty )+self HasPerk( specialty ))>= self.perklimit return true;
return false;
}

//Im not actually sure if you can do what I did above, you may need to intialize a var and increase it for every perk they have...
//change all instances of specialty to the perks in your map, and add and delete self HasPerk() as necessary

What this should result in is them buying the perk. Or if they have the max perks, a message appearing.

You can use some from that tut to set up a fancy fx and to purchase another perk. When they trigger it if they can afford it and it is less then the max you want them to have, player.perklimit++; Pretty much the same that the tut has.

Well, Im using 3 different perk scripts: for stock perks, Black Ops perks and Black Ops 2 perks. And I would probably just do it, so players start with 4 perk limit, then after doing something, all players get the perkslots opened. Would I still follow this?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
Oh, I use one script for everything. Okay. This method is per player. What you want is simpler. You just check the level perk limit similar to that tut. But the only part you need is that it checks when buying the perk if the player has the limit of perks. If all your scripts check that, I would work with that check. If they check if player.perks >= level.perk_limit continue, then I would continue using that method. If they don't currently check anything with perk limits, you can still do that by adding ones similar to what I posted. Basically just stopping the whole purchase perk script from running, returning to the beginning of the loop, unless they are under the max perks.

I haven't done that tut, but I really don't see how it works. (I could be overlooking something) I didn't see one check for the players perk size. I also didn't see any checks for the perk scripts, but maybe they are there by default, lol, my scripts are obviously not stock anymore, so I don't know for sure. If the default scripts check this already, then all that tut is doing is editing how the limit is adjusted. And it should work.
Edit: Of course you could do that simpler as well, since you don't want one slot at a time. You can just set it higher after the thing you want to happen, happens.

This is all you have to do:
- You will need to check when the player purchases the perk, just like it checks if they can afford it, if the player has the limit of perks already, in each script. (It may do this already, if so, use that check's var)
    - I like to check things "live" if you will, rather than trying to keep track of it. hasperk is easy enough to check when needed rather than tracking their perk count, but to each their own.
- If they have the limit you will simply continue; the loop and not even check if they can afford it.
- If they don't have the limit then you will let the loop run and continue the checks and buy the perk


I've said the same thing sorta two ways to make sure I was clear.
Last Edit: September 16, 2015, 02:07:49 pm by MakeCents
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
_zombiemode_perks.gsc
vending_trigger_think()
Code Snippet
Plaintext
		if ( player HasPerk( perk ) )
{
cheat = false;

/#
if ( GetDVarInt( "zombie_cheat" ) >= 5 )
{
cheat = true;
}
#/

if ( cheat != true )
{
//player iprintln( "Already using Perk: " + perk );
self playsound("deny");
player thread play_no_money_perk_dialog();


continue;
}
}

// DUKIP - check if our total perks (based on perk array) is greater or equal to our limit.
if( player.perk_hud.size >= player.num_max_perks )
{
self playsound("deny");
//player thread play_no_money_perk_dialog();
continue;
}

if ( player.score < cost )
{
//player iprintln( "Not enough points to buy Perk: " + perk );
self playsound("deny");
player thread play_no_money_perk_dialog();
continue;
}
Set num_max_perks to 4 on both onPlayerConnect() and onPlayerSpawned() then just mess with the value when needed.
Last Edit: September 16, 2015, 03:50:02 pm by DidUknowiPwn
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
_zombiemode_perks.gsc
vending_trigger_think()
Code Snippet
Plaintext
		if ( player HasPerk( perk ) )
{
cheat = false;

/#
if ( GetDVarInt( "zombie_cheat" ) >= 5 )
{
cheat = true;
}
#/

if ( cheat != true )
{
//player iprintln( "Already using Perk: " + perk );
self playsound("deny");
player thread play_no_money_perk_dialog();


continue;
}
}

// DUKIP - check if our total perks (based on perk array) is greater or equal to our limit.
if( player.perk_hud.size >= player.num_max_perks )
{
self playsound("deny");
//player thread play_no_money_perk_dialog();
continue;
}

if ( player.score < cost )
{
//player iprintln( "Not enough points to buy Perk: " + perk );
self playsound("deny");
player thread play_no_money_perk_dialog();
continue;
}
Set num_max_perks to 4 on both onPlayerConnect() and onPlayerSpawned() then just mess with the value when needed.

Using the perk hud size to count perks, nice one, if that is how he does all his perks then that would work. But I guess most do, do all their perks that way.


Edit: Will this work though? Don't you need an isdefined check in there for the player.perk_hud? Ccause that isn't created until later in that function the first time?
Last Edit: September 16, 2015, 03:58:13 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 2 years ago
Posts
3,997
Respect
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere'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.
Mapper Has released one or more maps to the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Well, read what you wrote, Make, and tried to script it myself first. Atm trying this:
At start of EE, I set perklimit to be 4:
Code Snippet
Plaintext
players[i].perklimit = 4;
players[i].perk_bought = 0;
Then at end of EE:
Code Snippet
Plaintext
players[i].perklimit = 9;
Then in perk scripts, I do check after trigger waittill:
Code Snippet
Plaintext
                if(player.perklimit == 4 || player.perk_bought == 4)
                                player iPrintLn("Perk Limit Hit"):
else
continue;
Then when player buys the perk succesfully:
Code Snippet
Plaintext
player.perk_bought++;
And of course, when player goes down, i set perk_bought back to 0 to avoid perklimit fucking up after downs.
But this doesnt work at all. I can buy all perks and everytime I hit the trigger, I get the iPrintLn.
No idea why it isnt working
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
You're saying:
Code Snippet
Plaintext
if(player.perklimit == 4 || player.perk_bought == 4)

The perklimit is 4, so it will print the lines


You would want to:
Code Snippet
Plaintext
if(player.perk_bought >= player.perklimit){
    player iPrintLn("Perk Limit Hit"):
    continue;
}
Last Edit: September 16, 2015, 04:35:29 pm by MakeCents
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
Using the perk hud size to count perks, nice one, if that is how he does all his perks then that would work. But I guess most do, do all their perks that way.


Edit: Will this work though? Don't you need an isdefined check in there for the player.perk_hud? Ccause that isn't created until later in that function the first time?
easiest away around this is to assume that if player.perk_hud is not defined the amount of perks the player has is 0 / not bought any so you could do this and you would get the same thing as what DUKIP said

Code Snippet
Plaintext
if(IsDefined(player.perk_hud) && player.perk_hud.size >= player.num_max_perks)
{
          //perk limit hit
          wait .1;
          continue;
}
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
easiest away around this is to assume that if player.perk_hud is not defined the amount of perks the player has is 0 / not bought any so you could do this and you would get the same thing as what DUKIP said

Code Snippet
Plaintext
if(IsDefined(player.perk_hud) && player.perk_hud.size >= player.num_max_perks)
{
          //perk limit hit
          wait .1;
          continue;
}

Lol, Thanks for that buddy, lol.

You do know all these answers say the same thing right? It's just there are different arguments that have the same conditions and result.

Let him pick what is easiest to understand. Then go with it.
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
This user is deleted :(
Lol, Thanks for that buddy, lol.

You do know all these answers say the same thing right? It's just there are different arguments that have the same conditions and result.

Let him pick what is easiest to understand. Then go with it.
Yeah i know they all have the same out come but i thought that what you said to DUKIP was unanswered (and to me looks like the easiest solution) so i thought "why not answer it" ;)
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 2 years ago
Posts
3,997
Respect
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere'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.
Mapper Has released one or more maps to the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
You're saying:
Code Snippet
Plaintext
if(player.perklimit == 4 || player.perk_bought == 4)

The perklimit is 4, so it will print the lines


You would want to:
Code Snippet
Plaintext
if(player.perk_bought >= player.perklimit){
    player iPrintLn("Perk Limit Hit"):
    continue;
}

Forgot to change : to ; in my earlier comment, so had to fix that after error :P
But now when I go in-game, even without perks, it spams perk limit hit message on triggers and wont let me buy the perks
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
Forgot to change : to ; in my earlier comment, so had to fix that after error :P
But now when I go in-game, even without perks, it spams perk limit hit message on triggers and wont let me buy the perks
Oops, lol.
Adding iprints may help you troubleshoot the issue.

 
Code Snippet
Plaintext
iprintlnbold("perk_bought defined: " + isdefined(player.perk_bought));
iprintlnbold("perklimit defined: " + isdefined(player.perklimit));
if(player.perk_bought >= player.perklimit){
    player iPrintLn("Perk Limit Hit"):
    continue;
}

These could be undfined at this time. If you get 0s then look at how you are defining those atts. or change up your method, such as a level perk limit var, and then you can use an isdefined check first before this check.

Example:

Code Snippet
Plaintext
iprintlnbold("perk_bought defined: " + isdefined(player.perk_bought));
iprintlnbold("perklimit defined: " + isdefined(level.perklimit));
if(isdefined(player.perk_bought) && isdefined(level.perklimit) && player.perk_bought >= level.perklimit){
    player iPrintLn("Perk Limit Hit"):
    continue;
}

You'll have to fix the perk_bought att though or it will just continue buying again.
Last Edit: September 16, 2015, 05:06:02 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 2 years ago
Posts
3,997
Respect
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere'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.
Mapper Has released one or more maps to the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Oops, lol.
Adding iprints may help you troubleshoot the issue.

 
Code Snippet
Plaintext
iprintlnbold("perk_bought defined: " + isdefined(player.perk_bought));
iprintlnbold("perklimit defined: " + isdefined(player.perklimit));
if(player.perk_bought >= player.perklimit){
    player iPrintLn("Perk Limit Hit"):
    continue;
}

These could be undfined at this time. If you get 0s then look at how you are defining those atts. or change up your method, such as a level perk limit var, and then you can use an isdefined check first before this check.

Example:

Code Snippet
Plaintext
iprintlnbold("perk_bought defined: " + isdefined(player.perk_bought));
iprintlnbold("perklimit defined: " + isdefined(level.perklimit));
if(isdefined(player.perk_bought) && isdefined(level.perklimit) && player.perk_bought >= level.perklimit){
    player iPrintLn("Perk Limit Hit"):
    continue;
}

You'll have to fix the perk_bought att though or it will just continue buying again.



Yep, gives 0 and I can buy all perks. I defined perklimit and perk_bought at start of the game on start of EE script. Should I move these inside the perk function instead and have them update constantly inside while loop?

 
Loading ...