PDA

View Full Version : How I can make a Loadbar?



Loveboy
22nd September 2013, 17:38
Hello Guys, i need help, i wanted to ask how to make a loadbar (with seconds and how long it should be)

as example: the loadbar ends in 5 secounds

Can someone help me?

Thanks

kung foo man
22nd September 2013, 18:37
Like looking like a health bar, with custom width/color/time?

Ni3ls
23rd September 2013, 07:17
Loadbar to load the map? or a progressbar to plant/defuse something?

Tally
23rd September 2013, 08:01
Hello Guys, i need help, i wanted to ask how to make a loadbar (with seconds and how long it should be)

as example: the loadbar ends in 5 secounds

Can someone help me?

Thanks

Look in maps\mp\gametypes\hq.gsc. There are lots of examples of how to do a loadbar.

And a loadbar is by definition how long it takes to finish. It seems pretty dumb to also have numbers. A loadbar is a graphical representation of numbers. It tells you how much time is left before its done. That would be like saying, "I want Windows desktop icons, but I also want numbers to tell me the position of the desktop icon". Just stupid.

DOH!

randall
23rd September 2013, 12:41
I found it unnecessery, but i wrote the script (based on sd):


// .......
if(!isdefined(other.progressbar))
{
other.progressbar = newClientHudElem(other);
other.progressbar.x = int(level.barsize / (-2.0));

if(level.splitscreen)
other.progressbar.y = 70;
else
other.progressbar.y = 104;

other.progressbar.alignX = "left";
other.progressbar.alignY = "middle";
other.progressbar.horzAlign = "center_safearea";
other.progressbar.vertAlign = "center_safearea";
}
other.progressbar setShader("white", 0, 8);
other.progressbar scaleOverTime(level.planttime, level.barsize, 8);

// I added these lines ---->
if(!isdefined(other.progresstime))
{
other.progresstime = newClientHudElem(other);
other.progresstime.x = int(level.barsize / (-2.0));
other.progresstime.y = 80;
other.progresstime.alignX = "left";
other.progresstime.alignY = "middle";
other.progresstime.horzAlign = "center_safearea";
other.progresstime.vertAlign = "center_safearea";
}
other.progresstime setTenthsTimer(level.planttime);
// <----

other playsound("MP_bomb_plant");
other linkTo(self);
other disableWeapon();

self.progresstime = 0;
while(isAlive(other) && other useButtonPressed() && (self.progresstime < level.planttime))
{
self.progresstime += 0.05;
wait 0.05;
}
// .......

And do not forget destroy the hud!

BlancO
23rd September 2013, 15:10
Enjoy this -> Progress bar (http://killtube.org/showthread.php?1578-CoD2-Standalone-Progress-bar).