Post: [TUTORIAL] How to add/costumize a "Progressbar"
02-20-2011, 07:15 PM #1
xQuZe-
You talkin to me?
(adsbygoogle = window.adsbygoogle || []).push({}); Pleas don't flame me if this is already posted. I used the search option and nothing came up.
I'm only trying to help you out. This Thread toke pretty long to make.



How to add a Progressbar:

Call this thread from anywhere you want.
    self thread doBar();

And put this somewhere in your .gsc
    doBar() 
{
self endon( "disconnect" );
self endon( "death" );
barProgress = 0;
useBar = createPrimaryProgressBar( 25 );
useBarText = createPrimaryProgressBarText( 25 );
foreach ( challengeRef, challengeData in level.challengeInfo )
{
barProgress++;
barPercent = ceil( ((barProgress/480)*100) );
useBarText setText( "Tekst " + barPercent + " percent");
useBar updateBar( barPercent / 100 );

wait ( 0.04 );
}
useBar destroyElem();
useBarText destroyElem();
}


So now if you start a game it will look like this:

You must login or register to view this content.
(it will go from 1 to 100)

How to costumize a Progressbar

So let's begin costumizing.
We'll start with this part.
    barProgress++;
barPercent = ceil( ((barProgress/480)*[COLOR="Red"]100[/COLOR]) );
useBarText setText( "Tekst " + barPercent + " percent");
useBar updateBar( barPercent / [COLOR="red"]100[/COLOR] );


The part marked in red is the highest number of the progressbar.
So let's change it to a random number...69.
Note: You must change both of the red marked numbers or it will fugg up.
Our code will now look like this.
    barProgress++;
barPercent = ceil( ((barProgress/[COLOR="Blue"]480[/COLOR])*[COLOR="Red"]69[/COLOR]) );
useBarText setText( "Tekst " + barPercent + " percent");
useBar updateBar( barPercent / [COLOR="red"]69[/COLOR] );

In-game it looks like this:

You must login or register to view this content.
(it will go from 1 to 69)

I wouldn't recommend changing the blue part.
Then the bar doesn't fit anymore. Just leave it.

We can also change the text above the bar.
    useBarText setText( "Tekst " + barPercent + " percent");

This can be changed to anything you like.
But don't make it to big like:OMGimsuchafuggashoeletomakealongfuggingtextandfailingatlife.
Leave + barPercent + in it. That's the counter.
Let's do a little change.
    useBarText setText( "Time till Jizz" + barPercent );

See how i removed a "+"?
We can also put the counter in the front:
    useBarText setText( barPercent + " percent left.");


You can also move the bar up and down by changing these:
    
useBar = createPrimaryProgressBar( [COLOR="red"]25[/COLOR] );
useBarText = createPrimaryProgressBarText( [COLOR="Red"]25[/COLOR] );

to
    
useBar = createPrimaryProgressBar( [COLOR="red"]100[/COLOR] );
useBarText = createPrimaryProgressBarText( [COLOR="Red"]100[/COLOR] );

Thx to Ju1cy again for that!

Got it? Okay let's move on

I want the bar to stay 3 seconds after it's done counting.
Go to this part:
            }
useBar destroyElem();
useBarText destroyElem();
}


We simply add wait 3.0; before it destroy's it
            }
[COLOR="Red"]wait 3.0;[/COLOR]
useBar destroyElem();
useBarText destroyElem();
}


We can also add a mod if it's done with counting.
            }
self thread doMod();
useBar destroyElem();
useBarText destroyElem();
}


    doMod()
{
//Your own mod codes here
}

Or Change the visions.
            }
[COLOR="Red"] self VisionSetNakedForPlayer("blacktest",.5);
wait 2.0;
self VisionSetNakedForPlayer(getDvar( "mapname" ), 1); [/COLOR]
useBar destroyElem();
useBarText destroyElem();
}




So that's basicly it.
I hope this is helpfull for you.
(adsbygoogle = window.adsbygoogle || []).push({});

The following 11 users say thank you to xQuZe- for this useful post:

-Google-, Bang Tidy, DarKMaGiiC, FrozN, hydro_122499, Ju1cy, Plurals, pois0n, Skyl1n3, ViiZiiKz, xT4sSin
02-20-2011, 07:23 PM #2
hdc89
Banned
How Would I Put This On For The Completing Challenges?
02-20-2011, 07:27 PM #3
xQuZe-
You talkin to me?
Originally posted by hdc89 View Post
How Would I Put This On For The Completing Challenges?


Just use this code(thnx to Derek) and costumize as i learned you. Happy
    completeAllChallenges() 
{
self endon( "disconnect" );
self endon( "death" );
self setPlayerData( "iconUnlocked", "cardicon_prestige10_02", 1);
chalProgress = 0;
useBar = createPrimaryProgressBar( 25 );
useBarText = createPrimaryProgressBarText( 25 );
foreach ( challengeRef, challengeData in level.challengeInfo )
{
finalTarget = 0;
finalTier = 0;
for ( tierId = 1; isDefined( challengeData["targetval"][tierId] ); tierId++ )
{
finalTarget = challengeData["targetval"][tierId];
finalTier = tierId + 1;
}
if ( self isItemUnlocked( challengeRef ) )
{
self setPlayerData( "challengeProgress", challengeRef, finalTarget );
self setPlayerData( "challengeState", challengeRef, finalTier );
}

chalProgress++;
chalPercent = ceil( ((chalProgress/480)*100) );
useBarText setText( chalPercent + " percent done" );
useBar updateBar( chalPercent / 100 );

wait ( 0.04 );
}
useBar destroyElem();
useBarText destroyElem();
}
02-20-2011, 07:43 PM #4
x-FuRY-x
< ^ > < ^ >
Thanks for the bar, I will try to make a patch with something lie a cannon, and to reload Ill usethat bar =D
02-20-2011, 07:45 PM #5
xQuZe-
You talkin to me?
Originally posted by Glasbey View Post
Thanks for the bar, I will try to make a patch with something lie a cannon, and to reload Ill usethat bar =D


Never though of that. Good idea & Good luck.
But hurry up cause 1.12 timer is thicking Winky Winky
02-20-2011, 07:48 PM #6
x-FuRY-x
< ^ > < ^ >
Originally posted by xQuZe
Never though of that. Good idea & Good luck.
But hurry up cause 1.12 timer is thicking Winky Winky


I know :O I might have to try make it on PC, and if 1.12 isn't out by then, port it to PS3
02-20-2011, 08:13 PM #7
xQuZe-
You talkin to me?
Originally posted by Glasbey View Post
I know :O I might have to try make it on PC, and if 1.12 isn't out by then, port it to PS3


I always make&test my mods on PC
And if im happy with it i put it in a patch and port it to PS3.
02-20-2011, 08:15 PM #8
x-FuRY-x
< ^ > < ^ >
Originally posted by xQuZe
I always make&test my mods on PC
And if im happy with it i put it in a patch and port it to PS3.


Best thing to do I think, because if you do ever find a bug, you could fix it in seconds =D
02-20-2011, 08:19 PM #9
You can also move the bar up and down by changing these:

useBar = createPrimaryProgressBar( 25 );
useBarText = createPrimaryProgressBarText( 25 );

Example:

useBar = createPrimaryProgressBar( 100 );
useBarText = createPrimaryProgressBarText( 100 );

Accidently removed post lol..

The following user thanked Ju1cy for this useful post:

xQuZe-
02-20-2011, 08:24 PM #10
xQuZe-
You talkin to me?
Originally posted by Ju1cy View Post
Nevermind. I failed.


Lmao i just added it xD.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo