Thread Rating:
  • 4 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial Progress Bar Tutorial
#1
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)
[Image: wyipjqo9qon7rc2v1lo.jpg]
Reply

#2
great tuturial keep it up
--
Reply

#3
Not Work, all code dont declare.

What i must include?
d3d9.h?
Reply

#4
(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
[Image: wyipjqo9qon7rc2v1lo.jpg]
Reply

#5
(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
Reply

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

What i must include?
d3d9.h?

lol
[Image: 1fxsnb.jpg]
Reply

#7
thx! nice tut
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  TUTORIAL CHEAT ENGINE for mw3 [HARD] Tony. 5 4,708 10-24-2013, 15:22
Last Post: Tomsen1410
Question Tutorial addon! [HARD] Tony. 2 2,904 04-30-2013, 13:55
Last Post: [HARD] Tony.
  [TUTORIAL] Various Statements KrypTiK 2 2,958 01-07-2013, 21:00
Last Post: kokole
  Help Game Programming Tutorial Ich1994 8 4,857 01-01-2013, 21:21
Last Post: Ich1994
  [TUTORIAL] C# Introduction KrypTiK 4 3,378 12-30-2012, 10:06
Last Post: KrypTiK
  [TUTORIAL] Basic Syntax KrypTiK 0 2,020 12-29-2012, 20:33
Last Post: KrypTiK
  [TUTORIAL] Handling Errors in VB.NET KrypTiK 0 1,936 12-29-2012, 20:28
Last Post: KrypTiK
  [TUTORIAL] Getting to know your way around the IDE KrypTiK 0 1,960 12-29-2012, 20:23
Last Post: KrypTiK
  [TUTORIAL] Introduction Into VB.NET KrypTiK 0 1,847 12-29-2012, 20:15
Last Post: KrypTiK
  Help C# Tutorial on how to reset a string DidUknowiPwn 7 5,058 10-11-2012, 15:04
Last Post: DidUknowiPwn

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.