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

Point Cap - AKA "Wallet system"

broken avatar :(
Created 10 years ago
by Deleted User
0 Members and 1 Guest are viewing this topic.
4,553 views
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
Sorry it took me some time... I ran into some problems and got help from: daedra descent

Today I am going to show you how to make a limit to the amount a person can have...

Difficulty: Easy-Medium


  • Open up your _zombiemode.gsc
  • Paste this code at the bottom of it:
Code Snippet
Plaintext
wallet_checker() {
do_check = true;
if(do_check) {
players = get_players();
for(i = 0; i < players.size; i++)
                players = get_players();
 
                for(i=0;i<players.size;i++)
                {
               
                        players[0] wallet_check();
                        players[1] wallet_check();
                        players[2] wallet_check();
                        players[3] wallet_check();
                }
        }
}
wallet_check() {
       
        while(1)
        {
                players = get_players();
players = get_players();
for(i = 0; i < players.size; i++)
 
                if(players[i].score >= 1000) //change 1000 to the amount you want it to stop
                {
                        //iprintln("Checking...");
                        players[i].score = 1000; // make this the same number as the one above
                        players[i].old_score = 0;
 
                        if(isdefined(players[i].score) && isdefined(players[i].old_score) )
                        {
                                players[i] thread set_player_score_hud_new();
                        }
                        else
                        {
                                iprintln("^1Coult not find the scores");
                        }
 
                        if(players[i].score == 1000)
                        {
                               // iprintln("^2Fixed");
                        }
                       
                }
        wait(1);
        }
}
set_player_score_hud_new( init )
{
num = self.entity_num;

score_diff = self.score - self.old_score;

//self thread score_highlight( self.score, score_diff );

if( IsDefined( init ) )
{
return;
}

self.old_score = self.score;
}
  • Now add these lines to the end of your Main() function:
Code Snippet
Plaintext
	thread wallet_check();
thread wallet_checker();
    NOTE: Edit these the way you want them to be. Also be sure to credit dedra in your map and not me. I will stop releasing tutorials if i get credit so please don't.


    Also it does not stop you at 1000 (or what ever score you choose, but it reduces it to that right away.)
    -this has been tested co-op
    broken avatar :(
    ×
    broken avatar :(
    drago
    Location: mx
    Date Registered: 5 July 2013
    Last active: 4 years ago
    Posts
    941
    Respect
    Forum Rank
    The Decider
    Primary Group
    Member
    My Contact & Social Links
    More
    ×
    jjbradman's Groups
    jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
    lol i didnt thought that someone would make something to make hard maps even harder so congratulations! you deserve it  :lol:
    broken avatar :(
    ×
    broken avatar :(
    ☭ Soviet Commander ☭
    Location: us
    Date Registered: 13 August 2012
    Last active: 8 years ago
    Posts
    2,790
    Respect
    Forum Rank
    King of the Zombies
    Primary Group
    Community Daedra
    My Groups
    More
    My Contact & Social Links
    More
    Signature
    Let's keep this thread on topic from here on in. -DBZ

    +1 to off-topic reply -DBZ

    lmao. Too funny.

    Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

    "...Christ, people. Learn C, instead of just stringing random characters
    together until it compiles (with warnings)..."

    -Linus Torvalds
    ×
    daedra descent's Groups
    Community Daedra
    Community Daedra
    daedra descent's Contact & Social LinksBlueSoviet
    The do_check was for testing. xD

    Should be changed to:

    Code Snippet
    Plaintext
    wallet_checker()
     {
                            players = get_players();

                            players[0] wallet_check();
                            players[1] wallet_check();
                            players[2] wallet_check();
                            players[3] wallet_check();
    }

    Works either way.
    broken avatar :(
    ×
    broken avatar :(
    Location: gbComing up in the world
    Date Registered: 26 November 2013
    Last active: 9 years ago
    Posts
    325
    Respect
    Forum Rank
    Perk Hacker
    Primary Group
    Community Scripter Elite
    My Groups
    More
    My Contact & Social Links
    More
    Personal Quote
    I own the hat!
    ×
    DuaLVII's Groups
    Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
    Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
    DuaLVII's Contact & Social Linksthomas.gascoigne.7DuaLVIIDuaLVIITheProlonger
    Code Snippet
    Plaintext
    wallet_checker() 
    {
    /*---------
    :Optimized by DuaLVII's:
    Removed a lot of unnecessary junk from the script
    ---------*/
    level.score_limiter = 5000; //Global level variable for any future changes which could include picking up wallets for larger cap size
    players = get_players();
    array_thread(players,::wallet_check);
    }
    wallet_check()
    {
    /*
    Example:
    if(isDefined(level.score_limiter))
    {
    level.score_limiter += 1000;
    }
    :Example
    */
    while(1)
    {
    if(self.score >= level.score_limiter)
    {
    self.score = level.score_limiter;
    self.old_score = 0;
    self thread set_player_score_hud_new(); //No point in finding if it's defined since the rest of the process wouldn't of worked in the first place
    }
    wait(0.1);
    }
    }
    set_player_score_hud_new( init )
    {
    num = self.entity_num;
    score_diff = self.score - self.old_score;
    if( IsDefined( init ))
    {
    return;
    }
    self.old_score = self.score;
    }

    Main function only needs;
    Code Snippet
    Plaintext
    thread wallet_checker();
    Last Edit: March 29, 2014, 10:56:40 am by DuaLVII
    broken avatar :(
    • DeletedUser
    • Deleted Member
    ×
    broken avatar :(
    DeletedUser
    This user is deleted :(
    Code Snippet
    Plaintext
    wallet_checker() 
    {
    /*---------
    :Optimized by DuaLVII's:
    Removed a lot of unnecessary junk from the script
    ---------*/
    level.score_limiter = 5000; //Global level variable for any future changes which could include picking up wallets for larger cap size
    players = get_players();
    array_thread(players,::wallet_check);
    array_thread(players,::wallet_hud_notify);
    }
    wallet_hud_notify()
    {
    /*
    Ray's Wallet Cap exceeded HUD notification
    */
    for(;;){
    self waittill("zombie_wallet_cap_exceeded");
    notification = NewClientHudElem(self);
    notification SetText("Can't hold more points");
    notification.alpha = 1;
    notification FadeOverTime(5);
    notification.alignY = "center";
    notification.alignX = "middle";
    notification.y = -75;
    notification.alpha = 0;
    wait(5);
    notification Destroy();
    wait(1);
    }
    }
    wallet_check()
    {
    /*
    Example:
    if(isDefined(level.score_limiter))
    {
    level.score_limiter += 1000;
    }
    :Example
    */
    while(1)
    {
    if(self.score >= level.score_limiter)
    {
    self.score = level.score_limiter;
    self.old_score = 0;
    self notify("zombie_wallet_cap_exceeded");
    self thread set_player_score_hud_new(); //No point in finding if it's defined since the rest of the process wouldn't of worked in the first place
    }
    wait(0.1);
    }
    }
    set_player_score_hud_new( init )
    {
    num = self.entity_num;
    score_diff = self.score - self.old_score;
    if( IsDefined( init ))
    {
    return;
    }
    self.old_score = self.score;
    }
    Added HUD notification like in Ghosts' Extinction with anti-spamming :D
    Main function still only needs:
    Code Snippet
    Plaintext
    thread wallet_checker();
    broken avatar :(
    • n123q45
    • Deleted Member
    ×
    broken avatar :(
    n123q45
    This user is deleted :(
    wow this has changed from a 2 person script to a comunity script
    broken avatar :(
    • DeletedUser
    • Deleted Member
    ×
    broken avatar :(
    DeletedUser
    This user is deleted :(
    wow this has changed from a 2 person script to a comunity script
    Yep
    broken avatar :(
    ×
    broken avatar :(
    ☭ Soviet Commander ☭
    Location: us
    Date Registered: 13 August 2012
    Last active: 8 years ago
    Posts
    2,790
    Respect
    Forum Rank
    King of the Zombies
    Primary Group
    Community Daedra
    My Groups
    More
    My Contact & Social Links
    More
    ×
    daedra descent's Groups
    Community Daedra
    Community Daedra
    daedra descent's Contact & Social LinksBlueSoviet
    Not sure why the extra coding was put in there(besides the do_check()), but either way it works. I don't see why people need to butcher the code and call it their "Optimized" version(which i take offense to), unless to remove the few extra bits of code.

    broken avatar :(
    ×
    broken avatar :(
    drago
    Location: mx
    Date Registered: 5 July 2013
    Last active: 4 years ago
    Posts
    941
    Respect
    Forum Rank
    The Decider
    Primary Group
    Member
    My Contact & Social Links
    More
    ×
    jjbradman's Groups
    jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
    "remove the "few") extra bits of code"
    there you have your answer for what optimization is
    also the code had a lot of stuff that had loops that just werent needed man
    Last Edit: March 29, 2014, 07:28:44 pm by jjbradman
    broken avatar :(
    ×
    broken avatar :(
    Location: gbComing up in the world
    Date Registered: 26 November 2013
    Last active: 9 years ago
    Posts
    325
    Respect
    Forum Rank
    Perk Hacker
    Primary Group
    Community Scripter Elite
    My Groups
    More
    My Contact & Social Links
    More
    Personal Quote
    I own the hat!
    ×
    DuaLVII's Groups
    Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
    Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
    DuaLVII's Contact & Social Linksthomas.gascoigne.7DuaLVIIDuaLVIITheProlonger
    Not sure why the extra coding was put in there(besides the do_check()), but either way it works. I don't see why people need to butcher the code and call it their "Optimized" version(which i take offense to), unless to remove the few extra bits of code.

    Daedra, I really don't care. If I see better ways to do things then I do it and hope that others learn from it.
    broken avatar :(
    ×
    broken avatar :(
    Location: fi
    Date Registered: 25 June 2013
    Last active: 9 months ago
    Posts
    3,997
    Respect
    1,024Add +1
    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.
    Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
    BO3 Modtools Alpha
    BO3 Modtools Alpha
    This user has access to the Black Ops 3 Modtools Alpha
    So, what do I add in Radiant and/or here to make, for say, buyable wallets, that increase the size of the wallet (as seen in Skyland Beta)

    Btw, 100 posts, wohoo

     
    Loading ...