If you want a Healthbar, which has a background, and inside a bar that shrinkes (as in gothic), you can use this part of a script. Textures you have to do by youreself, but that's not so difficult!
Great Tutorial ! Never tried C# before, but its going well, I've seen some other of your tutorials and they're easy to follow. Just a question... What is the script named "SuperSecret" for?
This is great stuff. I recieved errors but only because i did somthing wrong. I have 0 expirence at any thing when it comes to game develoment, codeing ect ect. I have been playing around with unity for a few weeks now. I have the basics down pat . I am continuing to learn more of the advanced features but the codeing is where its all at in my opinion. Would some one tell me the best place to start learning C#? I just think it would take forever to learn to write code from watching these vids
I wrote the script as you did, exactly and recieved many errors, mostly that curHealth was not specified or supported, known with unity. whatever, something like that, along with others. Is the script you wrote not supported in the new 3.4.2 pro version?
I have problem. I compilated and writed script as you but i can't see HealthBar :C I checked many times my code and it's identic as you. Please master help me!
Quick Question is there anyway to make the healthbar appear above the targeted monster and if there is multiple only show on the targeted one? if there is would you mind showing me how?
error CS1061: Type `UnityEngine.Rect' does not contain a definition for `curHealth' and no extension method `curHealth' of type `UnityEngine.Rect' could be found (are you missing a using directive or an assembly reference?)
Help I am new to scripting
Also another Error Is
error CS1501: No overload for method `box' takes `1' arguments
Hey i have an error where i have two gui boxes for my player, i do not have two scripts attatched or anything so i dont know what to do or what is wrong, can you help?
what is this Assets/Scripts/PlayerHealth.cs(19,82): error CS1061: Type `UnityEngine.Rect' does not contain a definition for `curHealth' and no extension method `curHealth' of type `UnityEngine.Rect' could be found (are you missing a using directive or an assembly reference?)
and this? Assets/Scripts/PlayerHealth.cs(19,13): error CS1501: No overload for method `Box' takes `1' arguments
In the Hierarchy window, select the first person controller (In this vid it's called Player), and the properties of it will appear on the right, simply scroll down to the "Player Health (Script) section, if it doesn't show you already, and you can adjust the health settings there. :)
That's all you have to remember if you want to change the settings of something, make sure it's selected in the Hierarchy window :) Hope that helped. :D
Assets/Scripts/PlayerHealth.cs(21,64): error CS0029: Cannot implicitly convert type `string' to `int'
Assets/Scripts/PlayerHealth.cs(21,21): error CS1502: The best overloaded method match for `UnityEngine.GUI.Box(UnityEngine.Rect, string)' has some invalid arguments
Assets/Scripts/PlayerHealth.cs(21,21): error CS1503: Argument `#2' cannot convert `object' expression to type `string'
@Drathine I replaced += with == (I'm not sure which one to use, because somehow my laptop shows your video bit blurry. Now all the errors are gone, but I got new one:
Assets/Scripts/PlayerHealth.cs(25,33): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
@Drathine the == operator will only make two things equal to eachother. Very important when you have loops that require a lot of else statements. +- operator will increment the number. If your telling the meter to initially start at 100 you will want to decrement down from 100
@MultipleSolutionsENT This is wrong. The == compares two things to see if they are equal. It does not make them equal. +- will just error. If you want to increment someone, then use ++ or -- for decrement. If you want to add someone to an existing value, then use +=, and -= to subtract from it.
Assets/Script/PlayerHealth.cs(26,33): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
please help i don't know whats wrong, i've checked and double checked everything
copied all the code and i havent actually got any script errors but now when i run the game it sets my max health straight to 1 seems to be only when i added the code for if you go below 1
Assets/Standard Assets/Scripts/PlayerHealth.cs(28,38): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
i did the same thing of you but my script got an error saying : error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement. I dont know how to fix it someone help please?
hi my name is colll78 and me and my friend franko98 are making a MMO-RPG and we would love you to check out our channel just check out our progress also if you are an expierenced coder or modeler we would love you to comment and we will contact you advertise for our channel and please rate and subscribe
I really appreciate your tutorials. I was reluctant to use them at first, because most of them are in C#, but i think i should teach myself that language. THANK YOU!!!!!!!
thanks a ton for these tutorials! I went through tornado twins and now that I got a basic understanding of UnityScript I wanted to learn C#, but so many youtubers would stop their tutorials after just the third or fourth video :( so thanks a ton! also for making them easy to follow lol.
Assets/Scripts/playerhealth.cs(26,33): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
Hey nice work! But i did the first Part and it worked. But when i did Part 2 It didnt work it says Assets/PlayerHealth.cs(21,42): error CS0103: The name `healthBarLength' does not exist in the current context
i found one of the errors! i didnt name it right!! yes! iv spent literally like 3 hours tryna solve this! btw thank u ppl for ur pateince (mispell) burgzerg thank you.
The class defined in script file named 'playerhealth' does not match the file name!
Assets/Scripts/playerhealth.cs(10,12): error CS1519: Unexpected symbol `void' in class, struct, or interface member declaration
Assets/Scripts/playerhealth.cs(24,17): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
sorry if this is getting annoying.. im kind of new and know nothing.. im tryna fix errors and occasionally i do but still..
Mannnnnnnnn I have a ver big problem, maybe it sounds a joke but its not. In this tutorial, in finish, you copy the Script File called PlayerHealth and rename it to EnemyHealth, HOW YOU COPY ITTTT :(
Shouldn't the last if statement in the adjustCurrentHealth method be if(curHealth < 1) curHealth = 1;? because curHealth is the denominator and not maxHealth. For example if curHealth reaches 0, maxHealth/curHealth is 100/0 which would give us an error.
i keep getting all complier errors have to be fixed before you can enter play mode, i keep retyping it over and over, and then scanning it over and over to find what i did wrong, and i cant find anything wrong.
Hi, i don't know why my scripts get an error in the following part curHealth ++ adj;
it says "Only assignment, call, increment, decrement, and new object expressions can be used as a statement C:\Users\Zelda-Maniack\videogame\game1\OrbS\Assets\Scripts\PlayerHealth.cs 31 22 OrbS"
and also " ; expected" all in the same line in the "adj" var... I checked and I'm 100% sure that i didn't forgot any ;
@BurgZergArcade oh i fixed it but there is 1 more problem when i change maxhealth the health bar changes but when you do it the healthbar changes if you do cur health(sry for very very very very poor english)
why does this happen ? Assets/EnemyAttack.cs(39,28): error CS1061: Type `PlayerHealth' does not contain a definition for `AddJustCurrentHealth' and no extension method `AddJustCurrentHealth' of type `PlayerHealth' could be found (are you missing a using directive or an assembly reference?)
heres my code public void AddjustCurrentHealth(int adj){ curhealth += adj;
@5seaton4 The line looks fine. The error message would seem to indicate that you might have an extra } right before it. Check to make sure that your {} are properly paired up.
Hey, tiny bug fix. Currently, curHealth CAN go below zero very briefly, because the test to make sure curHealth isn't below zero happens, then the test to make sure it's not above maxHealth, then the test to make sure maxHealth isn't below 1. The order of the tests is important.
@legendarylugi Ah, good catch. To be honest, we can get rid of the part that checks the maxHealth as there is no way to currently lower maxHealth, or you can just move the maxHealth check first.
@BurgZergArcade yup. I was trying to make another post saying "put the maxHealth check first and it will work" but youtube wouldn't let me submit it for some reason.
your tutorials are awesome and easy to understand... how can i change the color of the health bar and make it regenerate... (Thumbs up) looking forward for your next tutorial...
@BurgZergArcade looking forward to it.. oh can you make a tutorial on when i press the w key in the keyboard the character will run and play the animation run made in blender and when i stop pressing it the character will play the idle animation...
@DragneelSlayer We will be looking at those topics when we get to animations. If you want to work ahead, thane a look at the animation system in unity.
I have a model you can use if you want :), its already rigged and has a walk, idle and basic slash animation, would actually be nice if i saw it being used in your vids to help other people out on setting up animations in unity too. It's a .blend file, if you want it just pm me and i can link ya a download for it :)
@xBryanTechx TornadoTwins and I have different demographics. He caters more to the introduction to game development, where I tend to be more of the intermediate level.
I think both of us have a niche on tutorials for Unity3d :)
@BurgZergArcade idk i understand yours more when it comes to scripting i like the pace you work at and you have certainly helped me and dont stop :D cause i have a great idea for this game in unity
@xBryanTechx Well I am glad you find them useful. We will be looking at using interfaces later on to implement multiple inheritance in C#. This will be the way we are going to control how our character moves, as well as the mobs.
The basic way that it works is, you have a method in your character class and your mob class called MoveForward(), but both do the exact same thing, but differently. For instance, your character moves with the keyboard, but your mob moves with some sort of AI.
@xBryanTechx I can model fine, but my texture creation has room for improvement. Pretty much anything more detailed then a gingerbread man is out of my skill level for now... lol
@BurgZergArcade lol texturing is my greatest strength but i am gonna practice modeling humanoid stuff but um yea im gonna quit spammin your vid with these useless comments please pm me
@dzafo88 We will be revisiting the HUD (healthbars, as well as other on screen displays) in later tutorials. The first few tutorials in this series was to get people use to the basics on using C#. Now that we are heading in to Object Oriented Programming (OOP), we will start to look at how we can separate the health bar from the evil cubie and have it display only what we have targeted, when we have something targeted.
@dzafo88 Thanks and glad you like them. Sure some models would save me some time creating them myself. All that I ask is that they are available to everyone that is following along with this tutorial series to use for educational purposes.
i cant put the script on my evil cube, there is no errors, it just wont let me
spunkflunk 3 hours ago in playlist Unity3d Tutorial - Hack & Slash RPG Part 1-200
Is C Sharp better than JavaScript?
Mardun38 1 week ago
This has been flagged as spam show
If you want a Healthbar, which has a background, and inside a bar that shrinkes (as in gothic), you can use this part of a script. Textures you have to do by youreself, but that's not so difficult!
void OnGUI() { GUI.Box(new Rect(10, 10, Screen.width / 2, 20), "", BarBackgroundStyle); GUI.Box(new Rect(10, 10, healthBarLength, 20), "", PlayerHealthStyle); GUI.Box(new Rect(10,10, Screen.width / 2, 20), curHealth + "/" + maxHealth, InfoStyle); }
pepperonipizzaman22 1 week ago in playlist BurgZergArcade tutorials unity
Comment removed
pepperonipizzaman22 1 week ago in playlist BurgZergArcade tutorials unity
Great Tutorial ! Never tried C# before, but its going well, I've seen some other of your tutorials and they're easy to follow. Just a question... What is the script named "SuperSecret" for?
TheFleming98 2 weeks ago
Why is it that we have to typecast maxHealth in AdjustCurrentHealth ?
DarkeningVoid 3 weeks ago
This is great stuff. I recieved errors but only because i did somthing wrong. I have 0 expirence at any thing when it comes to game develoment, codeing ect ect. I have been playing around with unity for a few weeks now. I have the basics down pat . I am continuing to learn more of the advanced features but the codeing is where its all at in my opinion. Would some one tell me the best place to start learning C#? I just think it would take forever to learn to write code from watching these vids
Xcontractorman 4 weeks ago
If you finish this game, I am going to join as soon as possible and become the 'Pro' of the game.
DaKiLlEr46 1 month ago
I wrote the script as you did, exactly and recieved many errors, mostly that curHealth was not specified or supported, known with unity. whatever, something like that, along with others. Is the script you wrote not supported in the new 3.4.2 pro version?
bonomo 1 month ago
why dont you save us all and upload scripts somewhere like mediafire??
i just keep getting error messages like: parsing error or unexpected symbol...
DaBeatZ404 1 month ago in playlist Unity3d Tutorial - Hack & Slash RPG Part 1-200
Your computers HealthBar was nearly at 0 width too! :)
AnimateSpecial 1 month ago
// Use this for initialization void Start () { HealthBarLength = Screen.width / 2; }
It says me: Unexpected Symbol "Void" in class.... bla bla bla....
boriswc97 1 month ago
@boriswc97 check the line above it.
BurgZergArcade 1 month ago
I have problem. I compilated and writed script as you but i can't see HealthBar :C I checked many times my code and it's identic as you. Please master help me!
kamkaskan1 1 month ago
I have exactly the same as the script.
but when i try to change values after you did after 8:35, no other values change..
the script stays:
max Health: 100
Cur Health 100
Heath Bar Lenght: 0 after I save the scrpit
TricksterNiou 1 month ago
help error
Assets/Scripts/PlayerHealth.cs(36,31): error CS1525: Unexpected symbol `healthBarLength'
dpoulterster 2 months ago
Quick Question is there anyway to make the healthbar appear above the targeted monster and if there is multiple only show on the targeted one? if there is would you mind showing me how?
RockinJordans 2 months ago
I know this is a stupid question , but i am new to this, and i can't seem to copy it , lol
goneeh 2 months ago
error CS1061: Type `UnityEngine.Rect' does not contain a definition for `curHealth' and no extension method `curHealth' of type `UnityEngine.Rect' could be found (are you missing a using directive or an assembly reference?)
Help I am new to scripting
Also another Error Is
error CS1501: No overload for method `box' takes `1' arguments
i cant figure it out
Keromation78 2 months ago
Hey i have an error where i have two gui boxes for my player, i do not have two scripts attatched or anything so i dont know what to do or what is wrong, can you help?
AwesomeDude347 2 months ago
@AwesomeDude347 I have no idea what you did wrong.
BurgZergArcade 2 months ago 4
say I want to make the enemy health bar invisible, how do I do htat?
Sarkhamy 2 months ago in playlist More videos from BurgZergArcade
quick question. mine keeps saying that there is an unexpected symbol "if"
ASDrocksvlog 2 months ago in playlist More videos from BurgZergArcade
@ASDrocksvlog sounds like you have a typo.
BurgZergArcade 2 months ago
what is this Assets/Scripts/PlayerHealth.cs(19,82): error CS1061: Type `UnityEngine.Rect' does not contain a definition for `curHealth' and no extension method `curHealth' of type `UnityEngine.Rect' could be found (are you missing a using directive or an assembly reference?)
and this? Assets/Scripts/PlayerHealth.cs(19,13): error CS1501: No overload for method `Box' takes `1' arguments
levidread99 2 months ago
its "curHealth += adj"
"==" will give you an error.
II also had the same problem.couldnt really notice it
hope this helped...
(:
shawn3inthehood 3 months ago
do i put this script in any of the folders in the hierarchy tab if so which one(s)
vfxmoviefreak 4 months ago in playlist Unity3d Tutorial - Hack & Slash RPG Part 1-200
I don't Understand how to show this thing in "Inspector" from 4:38 (change hp property ) How I can do it ?
MrPreslav 4 months ago
@MrPreslav
In the Hierarchy window, select the first person controller (In this vid it's called Player), and the properties of it will appear on the right, simply scroll down to the "Player Health (Script) section, if it doesn't show you already, and you can adjust the health settings there. :)
That's all you have to remember if you want to change the settings of something, make sure it's selected in the Hierarchy window :) Hope that helped. :D
Bwarkable 4 months ago
but... i doesnt show me the health bar...:( now..
TheMihaibogdan 4 months ago
3 Errors:
Assets/Scripts/PlayerHealth.cs(21,64): error CS0029: Cannot implicitly convert type `string' to `int'
Assets/Scripts/PlayerHealth.cs(21,21): error CS1502: The best overloaded method match for `UnityEngine.GUI.Box(UnityEngine.Rect, string)' has some invalid arguments
Assets/Scripts/PlayerHealth.cs(21,21): error CS1503: Argument `#2' cannot convert `object' expression to type `string'
How can I fix it?
Drathine 4 months ago
@Drathine I replaced += with == (I'm not sure which one to use, because somehow my laptop shows your video bit blurry. Now all the errors are gone, but I got new one:
Assets/Scripts/PlayerHealth.cs(25,33): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
Drathine 4 months ago
@Drathine the == operator will only make two things equal to eachother. Very important when you have loops that require a lot of else statements. +- operator will increment the number. If your telling the meter to initially start at 100 you will want to decrement down from 100
MultipleSolutionsENT 4 months ago in playlist Unity3d Tutorial - Hack & Slash RPG Part 1-200
@MultipleSolutionsENT This is wrong. The == compares two things to see if they are equal. It does not make them equal. +- will just error. If you want to increment someone, then use ++ or -- for decrement. If you want to add someone to an existing value, then use +=, and -= to subtract from it.
BurgZergArcade 4 months ago
Assets/Script/PlayerHealth.cs(26,33): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
please help i don't know whats wrong, i've checked and double checked everything
IrishPolak7 4 months ago 2
@IrishPolak7 You still have a typo in the code.
BurgZergArcade 4 months ago
Can you help me?
It shows the bar, but when I get hit, it doesnt get smaller, or it stays on maxheath
XtreamVideo 4 months ago
copied all the code and i havent actually got any script errors but now when i run the game it sets my max health straight to 1 seems to be only when i added the code for if you go below 1
speedierone 4 months ago
@speedierone Well check if you accidentally didn't use the "greater than" symbol.
LCxCZ 4 months ago
@speedierone You have some operators backwards
MultipleSolutionsENT 4 months ago in playlist Unity3d Tutorial - Hack & Slash RPG Part 1-200
Assets/Standard Assets/Scripts/PlayerHealth.cs(28,38): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
What did i do wrong?
kwynn7 5 months ago
@kwynn7 Check your scripts. You have a typo somewhere.
BurgZergArcade 5 months ago
@BurgZergArcade What is a typo?
boriswc97 2 months ago
@boriswc97 when you type something wrong, it is referred to as a typo - typographical error.
BurgZergArcade 2 months ago
@boriswc97 typo = you write something wrong (like "liek", or "waht is wrong with my text?")
prowokator 2 months ago
You sound like Tom Hanks!
MercedesRenovatio 5 months ago
fantastic logic! great tut :)
maxmythic 5 months ago
i did the same thing of you but my script got an error saying : error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement. I dont know how to fix it someone help please?
bobleclown3 5 months ago
@bobleclown3 That's the same message I've been getting. I cant find any "grammatical mistakes" in the code. help...
xD00D0 5 months ago
This has been flagged as spam show
To get the health bar to show up you must drag the scrip onto the player object.
if it does not appear, you probably wrote "onGUI" instead of "OnGUI".
you liked to be helped? Help others, thumbs up. =)
sadraico123 5 months ago
This has been flagged as spam show
hi my name is colll78 and me and my friend franko98 are making a MMO-RPG and we would love you to check out our channel just check out our progress also if you are an expierenced coder or modeler we would love you to comment and we will contact you advertise for our channel and please rate and subscribe
colll78 6 months ago
my health bar dosnt get smaller :L
DCDTproductions 6 months ago
I really appreciate your tutorials. I was reluctant to use them at first, because most of them are in C#, but i think i should teach myself that language. THANK YOU!!!!!!!
Guitarstratdude 6 months ago
I've added the script to player... there's no errors why isn't it showing up??
TheStationable 6 months ago
Comment removed
TheStationable 6 months ago
Comment removed
TheStationable 6 months ago
thanks a ton for these tutorials! I went through tornado twins and now that I got a basic understanding of UnityScript I wanted to learn C#, but so many youtubers would stop their tutorials after just the third or fourth video :( so thanks a ton! also for making them easy to follow lol.
Akinon93 6 months ago
hey im getting this and i cant figure it out
Assets/Scripts/playerhealth.cs(26,33): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
gnwcates 6 months ago
Super tutorial man took me abit of time to get the script right but after that it works Perfect :)
ThreeDForYou 6 months ago
plz help
bossrdt 7 months ago
This is what dont understand... how can the erro be at line 30 when the script only has 21 o.O??
bossrdt 7 months ago
This has been flagged as spam show
need help. the script is giving the error :
"Assets/Scripts/Enemy AI/EnemyAI.cs(30,1): error CS8025: Parsing error"
"Log in File: Assets/Scripts/Enemy AI/EnemyAI.cs at line: 30"
bossrdt 7 months ago
Comment removed
bossrdt 7 months ago
Comment removed
bossrdt 7 months ago
To people getting compiler warnings: Check if you have the semicolon ; on the end of the previous line.
hvorego 7 months ago
how do you make those wierd looking brackets (sorry biginner) on the window's?
40paschal 7 months ago
Hey nice work! But i did the first Part and it worked. But when i did Part 2 It didnt work it says Assets/PlayerHealth.cs(21,42): error CS0103: The name `healthBarLength' does not exist in the current context
What should i do ? PLZ ANSWER
spelaringenroll1997 7 months ago
i still got a division by zero error
MrViPJoe 7 months ago
@NiicKMW2 no its not its surposed to be
healthBarLength = (Screen.width / 2) * (curHealth / (float)maxHealth);
MrViPJoe 7 months ago
I always mistaken - for = since the screen is so small.
Drillfire414 8 months ago
@Drillfire414 Make it bigger.
BurgZergArcade 8 months ago 2
your computers health is low : P
Thanks for the tutorials! Helps out a lot
BBryandownes 8 months ago 2
@BBryandownes He doesn't get out much. Low constitution.
BurgZergArcade 8 months ago 2
nevermind got it
scrbluegaming 8 months ago
@scrbluegaming :)
BurgZergArcade 8 months ago
Assets/Scripts/PlayerHealth.cs(30,1): error CS8025: Parsing error
scrbluegaming 8 months ago
@scrbluegaming You have a typo, take a look at the line where the error occurs and also the lines above it.
BurgZergArcade 8 months ago
WHY DOES I GET THIS ERROR?!?
Assets/Scripts/PlayerHealth.cs(10,13): error CS1519: Unexpected symbol `void' in class, struct, or interface member declaration
MrWeridoGuy 9 months ago
Nevermind I just forgot to set ; after healthBarLength
MrWeridoGuy 9 months ago
What dose float mean?
mms1911 9 months ago
please peepz, test your codes, this works fine for me, and i am using a notepad. for coding. :3
Tathagat8 9 months ago
@Tathagat8 lol, i agree :P
mms1911 9 months ago
i found one of the errors! i didnt name it right!! yes! iv spent literally like 3 hours tryna solve this! btw thank u ppl for ur pateince (mispell) burgzerg thank you.
Cryostrike 9 months ago
C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/GUI/ListViewShared.cs:175)
UnityEditor.ListViewShared+ListViewElementsEnumerator.MoveNext () (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/GUI/ListViewShared.cs:368)
UnityEditor.ConsoleWindow.OnGUI () (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/ConsoleWindow.cs:422)
Cryostrike 9 months ago
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.ListViewShared.HasMouseDown (UnityEditor.InternalListViewState ilvState, Rect r, Int32 button) (at C:/BuildAgent/work/6bc5f79e0a4296d6/Editor/Mono/GUI/ListViewShared.cs:180)
UnityEditor.ListViewShared.HasMouseDown (UnityEditor.InternalListViewState ilvState, Rect r) (at
Cryostrike 9 months ago
ok i followed more close and fixed a few errors however 2 keep popping up..
The class defined in script file named 'playerhealth' does not match the file name!
and i will set another comment for the next one..
Cryostrike 9 months ago
The class defined in script file named 'playerhealth' does not match the file name!
Assets/Scripts/playerhealth.cs(10,12): error CS1519: Unexpected symbol `void' in class, struct, or interface member declaration
Assets/Scripts/playerhealth.cs(24,17): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
sorry if this is getting annoying.. im kind of new and know nothing.. im tryna fix errors and occasionally i do but still..
Cryostrike 9 months ago
AN AD LASTED FOR 5 MINS AND I COULDNT SKIP D:
docdo1 9 months ago
thank you xD. Great Tutorial
dellsaber1991 9 months ago
I need Some help. When i play when i decrease my health even the largest or tiniest bit it still shows the 100/100 can you please help me, anyone?
TripleEffects 10 months ago
Can you type down the script for me its getting errors....
DronaStorm 10 months ago
it shows both health bars in the same place how can i change this
100ariss 10 months ago
Mannnnnnnnn I have a ver big problem, maybe it sounds a joke but its not. In this tutorial, in finish, you copy the Script File called PlayerHealth and rename it to EnemyHealth, HOW YOU COPY ITTTT :(
RaYTraceur 10 months ago
@RaYTraceur
Okay I have already discovered it by my own way, but anyway for newbies is important...
To copy the file you need to press Ctrl + D
RaYTraceur 10 months ago
Shouldn't the last if statement in the adjustCurrentHealth method be if(curHealth < 1) curHealth = 1;? because curHealth is the denominator and not maxHealth. For example if curHealth reaches 0, maxHealth/curHealth is 100/0 which would give us an error.
fmcneillii 10 months ago
this is just crazy in monodevelop it finds no errors but in unity it says: Unexpected symbol `void' in class, struct, or interface member declaration
chrilledk8 11 months ago 4
@chrilledk8 are you sure u made c sharp or java script ?
Diabolist10 8 months ago
@chrilledk8 so? have u find the solution?
TheMihaibogdan 4 months ago
@TheMihaibogdan hmmm....kinda havent been in unity for a while and......cant even remember i watched this srry ^^
chrilledk8 4 months ago
My Health Bar isn't displaying HELP!!!
CarnageBunny 11 months ago
@CarnageBunny make sure the function is called OnGUI and not something like OnGui.
BurgZergArcade 11 months ago
@CarnageBunny You may need to drag the script and attach it to "player".
fmcneillii 10 months ago
@CarnageBunny Dude i had the same problem so here is the answer to all your trouble:
1) dragging the script to Player (in hierachy) within Unity
2) right-clicking PlayerHealth under scripts and choosing Reimport
( 3) Make sure you spell everything correctly )
Good luck!!
ThriiworksStudios 10 months ago
@CarnageBunny
drag the healthbar code into the player
iwilleaturtacos 9 months ago
@CarnageBunny Same here
MurlockMage 8 months ago
i have also done this with both the EnemyAI one and it still gives me the complier error.
MrPoof15 11 months ago
i keep getting all complier errors have to be fixed before you can enter play mode, i keep retyping it over and over, and then scanning it over and over to find what i did wrong, and i cant find anything wrong.
MrPoof15 11 months ago
I have a problem at "curHealth +- adj;" do you know dow to fix it?
morderca3121 11 months ago
I have a problem at "curHealth +- adj;"
morderca3121 11 months ago
@morderca3121 me too
gnwcates 6 months ago
Hi, i don't know why my scripts get an error in the following part curHealth ++ adj;
it says "Only assignment, call, increment, decrement, and new object expressions can be used as a statement C:\Users\Zelda-Maniack\videogame\game1\OrbS\Assets\Scripts\PlayerHealth.cs 31 22 OrbS"
and also " ; expected" all in the same line in the "adj" var... I checked and I'm 100% sure that i didn't forgot any ;
zstudioft 1 year ago
@zstudioft try curHealth += adj.
BurgZergArcade 1 year ago
ihave nochos
teddy12300 1 year ago
31, 34 unexpected symbol curHealth what do i do curHealth is a variable
basketballdude138 1 year ago
i hate csharp i prefer javascript but if this tutorial will take about 21 hours to finnish its probably worth it
basketballdude138 1 year ago
@basketballdude138 I have never met anyone that has taken the time to learn c# that wanted to go back to javascript.
BurgZergArcade 1 year ago 6
@BurgZergArcade He speaks the truth! Once you switch to C#, you'll never want to go back.
legendarylugi 1 year ago
Your a genius. Thanks!
InfinitiveGD 1 year ago
@NiicKMW2 Check the line above it.
BurgZergArcade 1 year ago
My enemy health script refuses to compile. help?
reaverdeath9999 1 year ago
@reaverdeath9999 It still has errors. Fix them first.
BurgZergArcade 1 year ago
@reaverdeath9999 thanks again!
reaverdeath9999 1 year ago
It says I have a parsing error in this code but i am pretty sure it is right...
void Start ()
reaverdeath9999 1 year ago
@reaverdeath9999 chances are you forgot a ; at the end of the line before it.
BurgZergArcade 1 year ago
@BurgZergArcade ok, thanks!
reaverdeath9999 1 year ago
@BurgZergArcade still doesnt work, even though i added the ;
reaverdeath9999 1 year ago
@BurgZergArcade The healthbar is very long and i tried to change Healthbarlengt but it doesnt work(sry for bad english)
janekvanwolfswinkel 1 year ago
@BurgZergArcade And when i try to change it in the game i cant change the number 53900
janekvanwolfswinkel 1 year ago
@BurgZergArcade oh i fixed it but there is 1 more problem when i change maxhealth the health bar changes but when you do it the healthbar changes if you do cur health(sry for very very very very poor english)
janekvanwolfswinkel 1 year ago
How do you fix that?:
Assets/Scripts/PlayerHealth.cs(25,49): error CS1525: Unexpected symbol `adj', expecting `)', `,', `;', `[', or `='
wompag 1 year ago
why does this happen ? Assets/EnemyAttack.cs(39,28): error CS1061: Type `PlayerHealth' does not contain a definition for `AddJustCurrentHealth' and no extension method `AddJustCurrentHealth' of type `PlayerHealth' could be found (are you missing a using directive or an assembly reference?)
heres my code public void AddjustCurrentHealth(int adj){ curhealth += adj;
kickass465 1 year ago
@kickass465 You have 2 different spellings for AddJustCurrentHealth. Make sure you use the same capitalization.
BurgZergArcade 1 year ago
thankyou sorry for the trouble
5seaton4 1 year ago
ive fixed my parsing errors but now it sais this :
Assets/Scripts/PlayerHealth.cs(29,22): error CS0103: The name `adj' does not exist in the current context
and here is a bit of the code:
public void AddJustCurrentHealth(int odj) { curHealth += adj; healthBarLength = (Screen.width / 2) * (curHealth / (float)maxHealth);}
}
5seaton4 1 year ago
@5seaton4 You have it called odj when you declare it.
BurgZergArcade 1 year ago
how do you fix parsing errors
5seaton4 1 year ago
@5seaton4 parsing errors are generally just typos. perhaps missing a ; at the end of a statement.
BurgZergArcade 1 year ago
can someone tell me wats wrong with this line
public void AddJustCurrentHealth(int odj) {
it sais this error Assets/Scripts/PlayerHealth.cs(23,13): error CS0116: A namespace can only contain types and namespace declarations
5seaton4 1 year ago
@5seaton4 The line looks fine. The error message would seem to indicate that you might have an extra } right before it. Check to make sure that your {} are properly paired up.
BurgZergArcade 1 year ago
@5seaton4
public void AddJustCurrentHealth(int adj) {
MrViPJoe 7 months ago
Hey, tiny bug fix. Currently, curHealth CAN go below zero very briefly, because the test to make sure curHealth isn't below zero happens, then the test to make sure it's not above maxHealth, then the test to make sure maxHealth isn't below 1. The order of the tests is important.
legendarylugi 1 year ago
@legendarylugi Ah, good catch. To be honest, we can get rid of the part that checks the maxHealth as there is no way to currently lower maxHealth, or you can just move the maxHealth check first.
BurgZergArcade 1 year ago
@BurgZergArcade yup. I was trying to make another post saying "put the maxHealth check first and it will work" but youtube wouldn't let me submit it for some reason.
legendarylugi 1 year ago
so is using C# easy to switch to from Javascript? i know little in either but what i know and use most is JS.
Mattchu1995 1 year ago
@Mattchu1995 I find the syntax of both languages very similar. The only real difference is that C# has a bit more structure around its code.
BurgZergArcade 1 year ago
your tutorials are awesome and easy to understand... how can i change the color of the health bar and make it regenerate... (Thumbs up) looking forward for your next tutorial...
DragneelSlayer 1 year ago
@DragneelSlayer we will be covering how to change the appearance in the next tutorial, and regeneration shortly after that.
BurgZergArcade 1 year ago
@BurgZergArcade looking forward to it.. oh can you make a tutorial on when i press the w key in the keyboard the character will run and play the animation run made in blender and when i stop pressing it the character will play the idle animation...
DragneelSlayer 1 year ago
@DragneelSlayer We will be looking at those topics when we get to animations. If you want to work ahead, thane a look at the animation system in unity.
BurgZergArcade 1 year ago
@BurgZergArcade thanks for the tip, i made it though its not that realistic...can't wait for next tutorial...
DragneelSlayer 1 year ago
I have a model you can use if you want :), its already rigged and has a walk, idle and basic slash animation, would actually be nice if i saw it being used in your vids to help other people out on setting up animations in unity too. It's a .blend file, if you want it just pm me and i can link ya a download for it :)
Gamerdad81 1 year ago
dude you have helped me so much please dont stop your way better than tornadotwins
xBryanTechx 1 year ago
@xBryanTechx TornadoTwins and I have different demographics. He caters more to the introduction to game development, where I tend to be more of the intermediate level.
I think both of us have a niche on tutorials for Unity3d :)
BurgZergArcade 1 year ago
@BurgZergArcade idk i understand yours more when it comes to scripting i like the pace you work at and you have certainly helped me and dont stop :D cause i have a great idea for this game in unity
xBryanTechx 1 year ago
@xBryanTechx Well I am glad you find them useful. We will be looking at using interfaces later on to implement multiple inheritance in C#. This will be the way we are going to control how our character moves, as well as the mobs.
The basic way that it works is, you have a method in your character class and your mob class called MoveForward(), but both do the exact same thing, but differently. For instance, your character moves with the keyboard, but your mob moves with some sort of AI.
BurgZergArcade 1 year ago
@BurgZergArcade yea my next goal is to model a character xDDD i dont know how lol im used to map modeling etc.
xBryanTechx 1 year ago
@xBryanTechx I can model fine, but my texture creation has room for improvement. Pretty much anything more detailed then a gingerbread man is out of my skill level for now... lol
BurgZergArcade 1 year ago
@BurgZergArcade lol texturing is my greatest strength but i am gonna practice modeling humanoid stuff but um yea im gonna quit spammin your vid with these useless comments please pm me
xBryanTechx 1 year ago
@dzafo88 We will be revisiting the HUD (healthbars, as well as other on screen displays) in later tutorials. The first few tutorials in this series was to get people use to the basics on using C#. Now that we are heading in to Object Oriented Programming (OOP), we will start to look at how we can separate the health bar from the evil cubie and have it display only what we have targeted, when we have something targeted.
BurgZergArcade 1 year ago
@BurgZergArcade cool, cant wait till then...anyway thx alot again for these great tut series, very easy to follow..im currently on tut 5a :D
btw, im a hobby 3d artist.. i could make us some real enemys like a fire golem or something else, to replace the "eavil cubie" if u like..
dzafo88 1 year ago
@dzafo88 Thanks and glad you like them. Sure some models would save me some time creating them myself. All that I ask is that they are available to everyone that is following along with this tutorial series to use for educational purposes.
BurgZergArcade 1 year ago
@BurgZergArcade Sure, no problem, i ment it to be free..
ill see what i can do, and ill send u a massage when i finish..
if u like them u can add it on your site ( I dont have any) so it can be available for evryone.. anyway we`ll deal wit that later
dzafo88 1 year ago
@dzafo88 Np. Let me know when you are done then.
BurgZergArcade 1 year ago
@dzafo88 Really nice of you, I'm sure this tutorial series will be awesome :D
And great job BurgZergArcade, thanks for sharing this!
Satori89 1 year ago
awesome tut very easy to follow :D cant wait for next video
Dudehell1 1 year ago
@Dudehell1 I am targeting a Friday release for tutorial series. It will be fun to see what everyone ends up creating with this afterwords.
BurgZergArcade 1 year ago
First of all thanks for the amazing work providing us with videos of Unity 3 beta.
Second, awesome work with this tutorial, looking forward to see the rest of the series :)
septien 1 year ago
@septien Thanks. It should be a fun little project to work on.
BurgZergArcade 1 year ago