Raised This Month: $12 Target: $400
 3% 

math_counter seems buggy [L4D2]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CR0NO
New Member
Join Date: Jan 2023
Old 01-06-2023 , 13:49   math_counter seems buggy [L4D2]
Reply With Quote #1

Hi guys,

I am making a kingdom inspired mod for l4d2, (not a single asset being used from kingdom bytheway) all costum and L4D2 only.
And i have a problem with the "math_counter"!

I use the math_counter as the main goldbag / coins counter.
So if you chop down a tree the math_counter gets= add 1
And if you spend a single coin the math_counter gets = substract 1
commands

Ive set in the math_counter = initial value 1 , minimum legal 1, maximum legal 0 (no clamping).

outputs math_counter = on hit max = spend coins // on hit min = cant spend coins.

problem is = even if you chop down 11 trees wich gives + 11 in math_counter, once you spend a single coin, the output go's straith to = cant spend coins.... even tho i should be able to spend another 10 coins..... somehow it gos straith to hit min output.

very anoying, ive already tried different values (min, max,initial) but the porblem persists....

anyknow know how to fix this, or a good work around or a nice vscript to use for good counting and output??? (i cant script myself)

thnx

here is a video to get a better idea = https://www.youtube.com/watch?v=JzsaRU9c20o

but in that video the coins is unlimited (just for showing off)

Last edited by CR0NO; 01-06-2023 at 13:51.
CR0NO is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 01-06-2023 , 17:08   Re: math_counter seems buggy [L4D2]
Reply With Quote #2

Use vscript it will make your life a lot easier and would allow for expansion.

Here is a basic script that might work for you.

PHP Code:
// Global variable for coins.
::Coins    <- 0;

// Vscripting is weird about sending function variables as an output so keeping it simple. 
function AddCoin()
{
    
Coins++;
}

function 
SpendCoin()
{
    if ( 
Coins <= )
    {
        
ClientPrint(nullDirectorScript.HUD_PRINTTALK"\x03" " You don't have enough coins. " );
        return;
    }
    
Coins--;
    
ClientPrint(nullDirectorScript.HUD_PRINTTALK"\x03" " You have " Coins " coins left. " );

__________________
Spirit_12 is offline
CR0NO
New Member
Join Date: Jan 2023
Old 01-07-2023 , 05:30   Re: math_counter seems buggy [L4D2]
Reply With Quote #3

I got a working script from a other guy, that works, thanks anyway for your help, cause i did use some of your code in his script with copy pasting, and it works, so thanks for the help

Last edited by CR0NO; 01-07-2023 at 13:06. Reason: see comment
CR0NO is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 01-07-2023 , 15:10   Re: math_counter seems buggy [L4D2]
Reply With Quote #4

Glad it worked out in the end. Good luck with your project.
__________________
Spirit_12 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode