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,701 views
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
I'll have to see that script. Is players a valid object at the time and so on...
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'll have to see that script. Is players a valid object at the time and so on...

Code Snippet
Plaintext
vending_trigger_think()
{
 
        //self thread turn_cola_off();
        perk = self.script_noteworthy;
       
 
        self SetHintString( &"ZOMBIE_FLAMES_UNAVAILABLE" );
 
        self SetCursorHint( "HINT_NOICON" );
        self UseTriggerRequireLookAt();
 
        notify_name = perk + "_power_on";
        level waittill( notify_name );
       
        perk_hum = spawn("script_origin", self.origin);
        perk_hum playloopsound("perks_machine_loop");
 
        self thread check_player_has_perk(perk);
       
        self vending_set_hintstring(perk);
        // Perk limit testing
        for( ;; )
        {
                self waittill( "trigger", player );
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;
}
                if(!isDefined(player.buying_perk) || player.buying_perk == false)
                {
                        self thread vending_trigger_drink(player);
                        self thread player_perk_think_timer();
player.perk_bought++;
                }
    }
}

Perk script

Code Snippet
Plaintext
Main()
{
  level._effect["step_fx"] = loadfx( "env/smoke/fx_smk_column_md_gray_dir" );
level._effect["step2_fx"] = loadfx( "env/electrical/fx_elec_sparking" );
level._effect["step1_fx"] = loadFX("env/light/fx_glow_emergency_red_static");
level._effect["soul"]         = LoadFX("customfx/soul_fx");
  level.light_count = 0;
  level.part_picked_up = 0;

  thread light();
thread lever();
thread fuse();
thread wires();
thread build();

players = get_players(); // Perk limit testing
for(i = 0; i < players.size; i++)
{
players[i].perklimit = 4;
players[i].perk_bought = 0;
}

   thread target_step();
   
  level.consoles = 0;
 
  thread steps_done();

flag_init("ee_trees_done");

  level.num_trees_lit = 0;
  level.ee_trees_captured = false;

  trees = GetEntArray("pipe_trigg", "targetname");
  array_thread(trees, ::trees_think);
}

Main of EE-script

Edit: Taking a look at Pwns suggestion now, if that would work better
Last Edit: September 16, 2015, 05:34:55 pm by HitmanVere
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
Edit: Taking a look at Pwns suggestion now, if that would work better

You'll have the same issue because the initialization part is the problem, not your perks. It's where you chose to initialize those atts. That is why it was saying that it wasn't defined. When it got the players array, the array was empty atm.

What I would do is remove this:

Code Snippet
Plaintext
		players = get_players(); // Perk limit testing
for(i = 0; i < players.size; i++)
{
players[i].perklimit = 4;
players[i].perk_bought = 0;
}
But keep it whereever you make it 9.

And then make this modification:

Code Snippet
Plaintext
if(!isDefined(player.perk_bought)) player.perk_bought = 0;//initializes here when needed
if(!isDefined(player.perklimit)) player.perklimit = 4;//initializes here when needed
if(player.perk_bought >= player.perklimit){
    player iPrintLn("Perk Limit Hit"):
    continue;
}

Edit: Only issue with this method of initializing, per player, here, is that if the player didn't get any perks before the ee was completed, when they do, they will be left with 4 perk limit, lol. So again, I would go with a level var if the ee is not player based. Replacing that first part I told you to delete with level.perklimit = 4; and the second part replace player.perklimit with level.perklimit.
Last Edit: September 16, 2015, 05:46:00 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
You'll have the same issue because the initialization part is the problem, not your perks. It's where you chose to initialize those atts. That is why it was saying that it wasn't defined. When it got the players array, the array was empty atm.

What I would do is remove this:

Code Snippet
Plaintext
		players = get_players(); // Perk limit testing
for(i = 0; i < players.size; i++)
{
players[i].perklimit = 4;
players[i].perk_bought = 0;
}
But keep it whereever you make it 9.

And then make this modification:

Code Snippet
Plaintext
if(!isDefined(player.perk_bought)) player.perk_bought = 0;//initializes here when needed
if(!isDefined(player.perklimit)) player.perklimit = 4;//initializes here when needed
if(player.perk_bought >= player.perklimit){
    player iPrintLn("Perk Limit Hit"):
    continue;
}

Edit: Only issue with this method of initializing, per player, here, is that if the player didn't get any perks before the ee was completed, when they do, they will be left with 4 perk limit, lol. So again, I would go with a level var if the ee is not player based. Replacing that first part I told you to delete with level.perklimit = 4; and the second part replace player.perklimit with level.perklimit.

Yeah, I had done few modifications to the script, so Pwns thing didnt work :P Testing this now

Edit: Throwing bad syntax:
Code Snippet
Plaintext
if(player.perk_bought >= level.perklimit{
Not sure, if you meant this on last line of your comment or :P

Another edit: I derped out, lol, fixing it now

Last edit: First thing was working. Then I added the level vars like said and now perklimit doesnt get changed
Last Edit: September 16, 2015, 07:21:05 pm by HitmanVere
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
Last edit: First thing was working. Then I added the level vars like said and now perklimit doesnt get changed

Do you mean the perk limit that you set to 9 after the ee isn't changing? Did you add iprintlnbold statements to check if the code makes it there or if it is a typo or something?
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
Do you mean the perk limit that you set to 9 after the ee isn't changing? Did you add iprintlnbold statements to check if the code makes it there or if it is a typo or something?

Going through everything again, just in case, lol.
Start of EE:
Code Snippet
Plaintext
level.perklimit = 4;
When perklimit gets to 9:
Code Snippet
Plaintext
level.perklimit = 9;
And in perkscript:
Code Snippet
Plaintext
        // Perk limit testing
        for( ;; )
        {
                self waittill( "trigger", player );
if(!isDefined(player.perk_bought)) player.perk_bought = 0;//initializes here when needed
if(!isDefined(player.perklimit)) player.perklimit = 4;//initializes here when needed
if(player.perk_bought >= player.perklimit){
    player iPrintLn("Perk Limit Hit"):
    continue;
}
                if(!isDefined(player.buying_perk) || player.buying_perk == false)
                {
                        self thread vending_trigger_drink(player);
                        self thread player_perk_think_timer();
player.perk_bought++;
                }
    }
}
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
Since you changed it to level vars instead of player you will need to change this also:

Code Snippet
Plaintext
if(!isDefined(player.perklimit)) player.perklimit = 4;//initializes here when needed
if(player.perk_bought >= player.perklimit){
to this:
Code Snippet
Plaintext
if(!isDefined(level.perklimit)) level.perklimit = 4;//initializes here when needed
if(player.perk_bought >= level.perklimit){

The initialization prob isn't needed, since you added it to the other script, but will not hurt to have it here too, but without it in the other script you risk resetting perk limits when buying a perk. So make sure you have the level.perklimit in the other script where you put the player ones before and it didn't' work. it will work as a level var though.
Last Edit: September 17, 2015, 02:00:10 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
Since you changed it to level vars instead of player you will need to change this also:

Code Snippet
Plaintext
if(!isDefined(player.perklimit)) player.perklimit = 4;//initializes here when needed
if(player.perk_bought >= player.perklimit){
to this:
Code Snippet
Plaintext
if(!isDefined(level.perklimit)) level.perklimit = 4;//initializes here when needed
if(player.perk_bought >= level.perklimit){

The initialization prob isn't needed, since you added it to the other script, but will not hurt to have it here too, but without it in the other script you risk resetting perk limits when buying a perk. So make sure you have the level.perklimit in the other script where you put the player ones before and it didn't' work. it will work as a level var though.

Okay, it works now! But there is one issue. To remove the perk buying delay, I had to move rest of the function to new function, as seen from comment before. This happens, when Im buying perk and I keep hitting the trigger:

That makes me hit the perklimit immediately (Not sure, if it hits it with one hit or multiple, but spamming it = instant perklimit hit)
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've chosen to add or increase the perk limit var as you buy perks and then reset it when you die or go down. These are the things I spoke of earlier. This is the reason I don't do it that way and I use hasperk or Dukips idea of getting the hud size will work too if you use the same hud array for all your perks. This means you change your if to what Dukip said, with the ifDefined added to it. Or you use what I made. Both should work.

With that being said, you put your increment
player.perk_bought++;
in the right place where that should not be happening if player.buying_perk is defined, so it must not be.

Add iprintlinbold statments to the if right below that iprintlnbold and print the value of each level.perklimit, and player.perk_bought. This will verify that the numbers are working correctly and that your issue is that it is incrementing when you spam the button.

Its up to you how you wish to resolve that issue.
 - move that increment line to another area, like where the shader gets added down below in the perk more.
 - fix the buying_perk attribute
 - switch to using the hud size method.


Edit: If you want, send me the scripts and I will just do this for you. Some people hate scripting, lol. But if you want to continue learning, I don't mind trying to help.
Last Edit: September 17, 2015, 05:18:52 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
You've chosen to add or increase the perk limit var as you buy perks and then reset it when you die or go down. These are the things I spoke of earlier. This is the reason I don't do it that way and I use hasperk or Dukips idea of getting the hud size will work too if you use the same hud array for all your perks. This means you change your if to what Dukip said, with the ifDefined added to it. Or you use what I made. Both should work.

With that being said, you put your increment
player.perk_bought++;
in the right place where that should not be happening if player.buying_perk is defined, so it must not be.

Add iprintlinbold statments to the if right below that iprintlnbold and print the value of each level.perklimit, and player.perk_bought. This will verify that the numbers are working correctly and that your issue is that it is incrementing when you spam the button.

Its up to you how you wish to resolve that issue.
 - move that increment line to another area, like where the shader gets added down below in the perk more.
 - fix the buying_perk attribute
 - switch to using the hud size method.


Edit: If you want, send me the scripts and I will just do this for you. Some people hate scripting, lol. But if you want to continue learning, I don't mind trying to help.

Moved it under player perk_hud_create( perk ); and it works now perfectly! Best answer given and +1, since now I know better how to use level.stuff = something; and player.stuff = something; :P Credits will be also given in update
broken avatar :(
×
broken avatar :(
Location: caOntario
Date Registered: 31 August 2014
Last active: 4 weeks ago
Posts
273
Respect
Forum Rank
Mr. Elemental
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Kiss me daddy
×
NGcaudle's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Mapper Has released one or more maps to the UGX-Mods community.
NGcaudle's Contact & Social LinksNGcaudle
Hopefully I can get this working

 
Loading ...