I got a player who has a health but i cant see it so i made a gui texture and made a health bar anyone got a script So dat i can see da health bar going down
Pls Put instructions also
Tnx in advance
I got a player who has a health but i cant see it so i made a gui texture and made a health bar anyone got a script So dat i can see da health bar going down
Pls Put instructions also
Tnx in advance
fps tutorial has a health bar script you can use, and it also comes with a health bear similar to yours. you can sue that.
Thak YOu!
no wait wait wait my player already has health all i need is a script dat will make the healthbar(gui) as same as the players health
Can u post it here?
jsut download the fps tutorial, or just import the healthbar gui script.
var healthGUI : GUITexture;
function UpdateGUI () {
// Update health gui
// The health gui is rendered using a overlay texture which is scaled down based on health
// - Calculate fraction of how much health we have left (0…1)
var healthFraction = Mathf.Clamp01(hitPoints / maximumHitPoints);
// - Adjust maximum pixel inset based on it
healthGUI.pixelInset.xMax = healthGUI.pixelInset.xMin + healthGUIWidth * healthFraction;
wher do i attach it is it javascript
Sorry for being nooby
look in your FPSplayer script, its already there, go on your character and attach the fps player script and drag your healthbar in the variable
oh ok Thank You! for ur help
no worry’s.
hey i think thers something wrong with ur scriptman :o
jp_foxrocks - you must be more specific when asking for help.
What did you do with the script Benopaluz provided?
What is the error you are getting?
What line in the script is it generating the error?
People will help you if you provide the details, but we’re not mind readers.
oh ok Lets see
i copy paste beno paluz script into unitron (javascript)
NewBehaviourScript.js(12,10): BCE0044: expecting (, found ‘Update’.
Assets/Evac city tut/Scripts/NewBehaviourScript.js(12,1): BCE0044: expecting }, found ‘’.(the other one w no update)
A.line12
B.line 12
You’d better post the script you created.
Sounds like it’s way off.
var healthGUI : GUITexture;
function UpdateGUI () {
// Update health gui
// The health gui is rendered using a overlay texture which is scaled down based on health
// - Calculate fraction of how much health we have left (0…1)
var healthFraction = Mathf.Clamp01(hitPoints / maximumHitPoints);
// - Adjust maximum pixel inset based on it
healthGUI.pixelInset.xMax = healthGUI.pixelInset.xMin + healthGUIWidth * healthFraction;
I
I
its the same the one w the function update here and the one without function update
Post the WHOLE script. And use the
tags.
You showed errors that implied what you pasted into the NewBehaviourScript.js were either in the wrong place or were missing elements.
? what u mean tags im so nooby
Sorry - the tags I entered were removed automatically. I mean use the CODE tags which you can find under the Go Advanced button (below right) and are entered via the “#” icon. IPaste your code, highlight it all then press the “#” icon and it will create something like…
this would be code
I appreciate your are new at this and judging by your other posts seem to be making reasonable progress, but I think you would be better suited in taking a step back and learning…
var healthGUI : GUITexture;
function UpdateGUI () {
// Update health gui
// The health gui is rendered using a overlay texture which is scaled down based on health
// - Calculate fraction of how much health we have left (0...1)
var healthFraction = Mathf.Clamp01(hitPoints / maximumHitPoints);
// - Adjust maximum pixel inset based on it
healthGUI.pixelInset.xMax = healthGUI.pixelInset.xMin + healthGUIWidth * healthFraction;
Here