Jump to content

Recommended Posts

Posted

I have mod with a level and an xp field set up. These need to be saved when the player leaves the world otherwise they just revert back to their defaults of 1 and 0.

Posted

And if you want to keep it persistent over death, look into EntityPlayer.PERSISTANT_TAG (or something similar), EntityJoinWorldEvent and LivingDeathEvent.

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Posted

Okay I have set this up and I believe it to be correct, but I am not sure what to do from now. I want the xp to increase everytime the mob attacks, any ideas?

Posted

Use the event LivingAttackEvent.

 

Then, check to see if event.entity an instance of the mob you want. If it is, add experience to the mob. Or add the XP to the player if that's what you are trying to do.

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Posted

Use spoilers around your code.  Notice the "Sp" button right above.

 

In your error log, it will tell you what line of your code is offending.  Tell us that so we don't have to read the entire thing and guess.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

Is this what you meant...

 

Here is the line the error occurs at on its own:

 

this.xp = properties.getInteger("xp");

 

Here is the crash:

 

 

  Reveal hidden contents

 

 

Here is the whole class:

 

 

  Reveal hidden contents

 

Posted

Okay, got that error fixed. Now I have added...

 

 

  Reveal hidden contents

 

 

...to my properties class but it isn't being called.

Posted

Never mind I put it in the wrong class :P I will play around with this for a bit and will come back if I hit another problem I can't solve. Thank you all for your help :)

Posted

Okay I have set up the class and I believe it works, but I am wondering how I would use my getXP() method inside my EntityBlockling class's interact() method that I have.

 

 

  Reveal hidden contents

 

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.