ItsMods
[Tutorial] Progress Bar Tutorial - Printable Version

+- ItsMods (https://www.itsmods.com)
+-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html)
+--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html)
+--- Thread: [Tutorial] Progress Bar Tutorial (/Thread-Tutorial-Progress-Bar-Tutorial.html)



Progress Bar Tutorial - alistair3149 - 12-27-2010

This tutorial is originally wrote by kiwimoosical for MW2, but progress bar is working in BO as same as MW2, so I quoted his tutorial to hereBig Grin

Step 1: Declare your progress bar:
Code:
b = createPrimaryProgressBar( 45 ); //the number is the initial y position

Step 2: Create your progress bar's color:
First you need to get the RGB of your color and divide it by 255, then you put it where i say:
Code:
b.bar.color = (0,1,1); //Mine is cyan

Step 3: Fill the bar:
Code:
b updateBar(1); //1 is the highest it can go, updateBar is also used for changing the bar's filled level

Step 4: Reposition maybeh? Here:
Code:
b.bar.x = 100; // This is the main coord you want, find it first b.x = 160; // Add 60 to the previous coord to get it so the bar and color align b.bar.y = 10; // Find coord for y axis b.y = 10; // Make this the same as the above choice

Step 5: Text pl0x:
Step 5a: Create the text element:
Code:
t = createPrimaryProgressBarText( 25 );

Step 5b: text reposition?
Code:
t.x = 160; // Same as b.x t.y = 20; // Add 10 for below the bar and subtract 10 for above the bar (subtract from b.y)

Step 5c: Setting the text:
Code:
t setText("Test");

Step 6: Updating your progress bar:
Code:
b updateBar(.5); //Take the percent of the bar you want filled and divide it by 100 to get the percent

To Destroy the bar:
Code:
barName destroyElem();

Here is an example of Health Bar:
Code:
HealthBar() { useBar = createPrimaryProgressBar( -250 ); useBarText = createPrimaryProgressBarText( -250 ); useBarText settext("Health"); useBarText.y = 205; useBar.bar.y = 220; useBar.y = 220; for(;;) { usebar updateBar( self.health/100, 100 ); if(self.health < 50 && self.health < 30 != true) { usebar.color = (0,0,0); usebar.bar.color = (0.9,1,0); useBarText settext("^3Injuried"); usebar.alpha = 0.5; } else if(self.health < 30) { usebar.color = (0,0,0); usebar.bar.color = (1,0,0); useBarText settext("^1Critical"); usebar.alpha = 1; } else if(self.health > 50) { usebar.color = (0,0,0); usebar.bar.color = (0,1,0); useBarText settext("^2Normal"); usebar.alpha = 0.5; } wait 0.05; } }

Here's another example, but it is an ammo bar (credit to 4fun)



RE: Progress Bar Tutorial - Eekhoorn - 12-27-2010

great tuturial keep it up


RE: Progress Bar Tutorial - krschy - 01-05-2011

Not Work, all code dont declare.

What i must include?
d3d9.h?


RE: Progress Bar Tutorial - alistair3149 - 01-05-2011

(01-05-2011, 15:11)krschy Wrote: Not Work, all code dont declare.

What i must include?
d3d9.h?
It should work...4Fun and me provedWink
What's ur code? I may fix it


RE: Progress Bar Tutorial - d0h! - 01-05-2011

(01-05-2011, 15:11)krschy Wrote: Not Work, all code dont declare.

What i must include?
d3d9.h?

dont try to compile it..it is a gsc modding snippet


RE: Progress Bar Tutorial - 4FunPlayin - 01-07-2011

(01-05-2011, 15:11)krschy Wrote: Not Work, all code dont declare.

What i must include?
d3d9.h?

lol


RE: Progress Bar Tutorial - Nekochan - 02-15-2011

thx! nice tut