Game Development Community

Files related to health bar

by Anthony Ratcliffe · in Torque Game Engine · 12/13/2008 (9:59 pm) · 12 replies

I was wondering what files are related to the healthbar from the sdk demo. obviously play.gui but i cant seem to find corresponding data to go with it, or is this because it written into the engine not the scripts? ant

#1
12/14/2008 (6:37 am)
To access GuiHealthBarHudd.cc, you'll need access to the source code; which you don't appear to have.

You can still change the color, frame, background color, rate of blinking, and various other variables.
#2
12/14/2008 (4:00 pm)
If i use a profile like this within play.gui will it auto pick up max damage and apply damage



/code

new GuiShapeNameHud() {
profile = "GuiDefaultProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "653 485";
minExtent = "8 8";
visible = "1";
helpTag = "0";
fillColor = "0.000000 0.000000 0.000000 0.250000";
frameColor = "0.000000 1.000000 0.000000 1.000000";
textColor = "0.000000 1.000000 0.000000 1.000000";
showFill = "0";
showFrame = "0";
verticalOffset = "0.2";
distanceFade = "0.1";
damageFrameColor = "1.000000 0.600000 0.000000 1.000000";
damageFillColor = "0.000000 1.000000 0.000000 1.000000";
damageRect = "30 4";
};
new GuiHealthBarHud() {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "top";
position = "14 315";
extent = "26 138";
minExtent = "8 8";
visible = "1";
helpTag = "0";
showFill = "1";
displayEnergy = "0";
showFrame = "1";
fillColor = "0.000000 0.000000 0.000000 0.500000";
frameColor = "0.000000 1.000000 0.000000 0.000000";
damageFillColor = "0.800000 0.000000 0.000000 1.000000";
pulseRate = "1000";
pulseThreshold = "0.5";
value = "1";
};
/code
#3
12/14/2008 (6:11 pm)
If I understand your question correctly, yes.

The HealthBarHud will display the damage value of the client's control object.
#4
12/14/2008 (7:22 pm)
I used that as my health bar, but when i fall and activate my onimpact it doesnt seem to decrease, the impact is fine he dies its just the bar that doesnt move


new GuiShapeNameHud() {
canSaveDynamicFields = "0";
Enabled = "1";
isContainer = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "width";
VertSizing = "height";
position = "24 173";
Extent = "31 170";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
fillColor = "1 0 0 0.25";
frameColor = "0 1 1 1";
textColor = "0 1 0 1";
showFill = "1";
showFrame = "1";
verticalOffset = "0.2";
distanceFade = "0.1";
};


///////////////////////////////////////////////////////////////////////////


function PlayerDB::onImpact(%this, %obj, %collidedObject, %vec, %veclen, %damage, %flash )
{

%obj.applyDamage(%damage);
%obj.setDamageFlash(%flash);

if (%obj.maxDamage == 0)
{
%obj.playThread(0,"death1");
}
}
#5
12/14/2008 (7:25 pm)
I forgot to add my mouse has stopped working
#6
12/15/2008 (11:52 am)
Scape what i said. i'm using this tut now

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=12064

however nothing is displaying, no errors ect
#7
12/15/2008 (1:30 pm)
Also on a side note can anyone tell me why my light on off script wont work?

function OnOff()
{

if (%this.lightOn = false)
{
%obj.schedule 5000;
%this.lightOn = true;

if (this.lightOn = true)
{
%obj.schedule 5000;
%this.lightOn = false;
}

}
}
#8
12/15/2008 (1:47 pm)
Its because you're not using schedule right. Schedule doesn't work like sleep. Schedule takes in the command and arguments you want to schedule.

I can't really explain it in more detail at the moment, but the documentation should give you a better idea of how its used, and if someone else doesn't explain it better by the time I get home I'll go into more detail.
#9
12/15/2008 (2:19 pm)
Basic usage: schedule(%time, %simgroup, %command)

%time is a value in milliseconds that specifies when it will run %command.
%simgroup will usually be 0
%command is the name of a function that you want to run

other parameters can also be passed into the schedule call after the %command
schedule(%time, %simgroup, %command, %param1, %param2)

Event Scheduling reference
#10
12/15/2008 (2:43 pm)
Function OnOff(%time, %simgroup, %command)

{

if (%this.lightOn = false)
{
OnOff.schedule(5,"lightOn");
%this.lightOn = true;

if (this.lightOn = true)
{
OnOff.schedule(5,"lightOn");
%this.lightOn = false;
}

}
}

ok i figured it out i think, however it doesnt blink as expected

ps just locked my cursur again can anyone remeber the command to free it after making a gui
#11
12/18/2008 (9:26 am)
Jst like a bump on this plz
#12
12/22/2008 (4:13 pm)
This is my whole script made some changes after i saw some basic errors, still not working


datablock fxLightData(lightDB22red) {
LightOn = true;
Radius = 0.25;
Brightness = 1.0;
Colour = "1 0 0";
FlareOn = true;
FlareTP = true;
FlareBitmap = "common/lighting/corona";
FlareColour = "1 0 0";
ConstantSizeOn = false;
ConstantSize = 1.0;
NearSize = 3.0;
FarSize = 0.5;
NearDistance = 10.0;
FarDistance = 30.0;
FadeTime = 0.1;
BlendMode = 0;
AnimColour = false;
AnimBrightness = false;
AnimRadius = false;
AnimOffset = true;
AnimRotation = false;
LinkFlare = true;
LinkFlareSize = false;
MinColour = "0 0 0";
MaxColour = "1 0 0";
MinBrightness = 0.0;
MaxBrightness = 1.0;
MinRadius = 0.1;
MaxRadius = 20.0;
StartOffset = "-5 0 0";
EndOffset = "5 0 0";
MinRotation = 0;
MaxRotation = 350;
SingleColourKeys = true;
RedKeys = "AZA";
GreenKeys = "AZA";
BlueKeys = "AZA";
BrightnessKeys = "AZA";
RadiusKeys = "AZA";
OffsetKeys = "AZA";
RotationKeys = "AZA";
ColourTime = 1.0;
BrightnessTime = 1.0;
RadiusTime = 5.0;
OffsetTime = 5.0;
RotationTime = 5.0;
LerpColour = true;
LerpBrightness = true;
LerpRadius = true;
LerpOffset = true;
LerpRotation = true;
};


function OnOff(%time, %simgroup, %command)
{

if (%this.lightOn == false)
{
OnOff.schedule(5000,"lightOn");
%this.lightOn = true;
}
else
{
OnOff.schedule(5000,"lightOn");
%this.lightOn = false;
}
}