Jump to content

Recommended Posts

Posted

I want to make like a sword that steals power from what you kill.

 

Example:

You kill an entity you gain 1 stack.

You can have a max of 1000 stacks (100 bonus damage)

 

I probably have to use IExtendedEntityProperties and/or NBT.

So any ideas where I should start, and any suggestions?

 

Thanks.

 

-I have basic Java knowledge, and Minecraft modding knowledge-

Posted

I would use NBT tags to store the kill count, then use the addInformation method to display how many kills the weapon has on the tooltip.

 

Additionally, you could store who crafted it in the NBT compound and only apply the kill count bonus for that player.

Posted

As diesieben7 said, every item will have a NBTTagCompound assigned to it. You can read and write values using a sort of name/value pair system (bad explaination on my part, I haven't really used them much). So you could set the kill count using tagComp.getInt("killCount") to get the current one, incrementing it, then using tagComp.setInt("killCount", newValue) to add the new count. You will need more than those two functions, but that's pretty much the basics of reading and writing to a tag compound.

Posted

-- I know how to use NBT, now (that's out of the way) --

 

I don't know how to apply let's say a new integer named "kills" and store it to something.

I don't know how to get that "something" because I want it for each individual player as well.

Maybe I'm over thinking this, if anyone can help me solve this, it will be great c:

Posted

The item's NBT is stored for that instance of the item, if you want it to be a stat that will stay even if the player looses their sword and makes a new one, you'll need an extendedplayer. There are a few tutorials on how to do that, they basically store an NBT to the player that will persist through relog, and if you want it to, player death

Creator of Metroid Cubed! Power Suits, Beams, Hypermode and more!

width=174 height=100http://i.imgur.com/ghgWmA3.jpg[/img]

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.