Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.10] how to call a specific health of an entity.


Recommended Posts

Seriously? How can your IDE even let you do something stupid like this???

 

 if(this.gethealth = 1000<0) 

 

Here is whats happening:

 

Mini Java Guy Inside Your Computer: Okay! I'm gonna do an if statement now!

Mini Java Girl Inside Your Computer: Sweet! I haven't done one of those in a while. Ill help you out.

Mini Java Guy Inside Your Computer: Gonna get this entity's health....

Mini Java Girl Inside Your Computer: Okay, I'll set it to false...

Mini Java Guy Inside Your Computer: Wait... you can't SET a variable by using a GETTER METHOD.

Mini Java Guy Inside Your Computer: *Highlights this statement with a red squiggly line*

Mini Java Guy Inside Your Computer: if(this.gethealth = 1000<0){

Mini Java Boss Inside Your Computer: You're both fired!

Console:

java.lang.Error: Unresolved compilation problem: The left-hand side of an assignment must be a variable

 

 

You are trying to set the health. You need

 if (this.getHealth() <= 1000){ 

 

EDIT: Woops, totally scrolled past SuperJedi224's post.

Link to comment
Share on other sites

I meant what super jedi said

try this.getHealth()<=1000, is that what you meant?

 

I failed and my eclipse was acting up, PLUS did you even read my thread! I said I wanted to GET the health when my entity reached 1000 health or lower. please work on reading, and my ide didn't let me do it, when I said that it that it DIDN'T Seem to work I meant that It WASNT WORKING. There for I was asking why it WASN'T working, having said that Superjedi(great name btw) has indeed corrected my error and solved the problem.

 

do you look at the thread for less than 2 seconds or something?

 

Btw this is post in reply specifically to TheRealMinecrafter, which you already know.

 

PS. why do you think that  if (this.getHealth() <= 1000){  sets the health, it gets it..

Im serious don't look at it!!

Link to comment
Share on other sites

I said I wanted to GET the health when my entity reached 1000 health or lower.

 

This part makes no sense. You're asking to not look at entity health unless entity health is less than 1000. But in order to determine that, we need to look at it.

 

Unless you mean, you want something to happen when entity health is 1000 or lower.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I meant what super jedi said

try this.getHealth()<=1000, is that what you meant?

 

If you meant that, then you should have put that in your original post. How do you expect people to magically guess what you are doing?

 

PS. why do you think that  if (this.getHealth() <= 1000){  sets the health, it gets it..

 

Like I said above, you originally had

if(this.gethealth = 1000<0){ 

which Java is interpreting as trying to set the left side to the right side, so in this case, this.getHealth to false. You really need to read over what you write before you post it, because you make no sense whatsoever.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.