Jump to content

Recommended Posts

Posted

I'm running into a bug with an event of mine where when a player has a certain item in their inventory it'll cause whatever mob they hit to set on fire. I set the setfire method to 3 ticks, but keeps on going infinitely until the mob is dead. If throw the item out of my inventory after I hit the mob, then it'll last the intended amount of time. I tried multiple ways on fixing the issue and trying different methods of getting this to work, but to no avail. Any help would be much appreciated.

 

Here's how I currently have it: https://pastebin.com/SHT97LJd

 

I'm also having thoughts that multiple players will be able to cause mobs to be set on fire if only one player as the item in their inventory on a server, but that has yet to be tested, and is another bug for another day

Posted (edited)
2 hours ago, diesieben07 said:

Please learn what static means, you cannot use it that way

I did not notice that was there! Probably made it's way back from undoing code so many times lol

 

2 hours ago, diesieben07 said:

No idea why you are using two events here instead of just checking the held item in the attack event.

Good point, for some reason thought it would fix the issue lol

 

2 hours ago, diesieben07 said:

Your hasItem field will be shared across the whole server between all players

What should I be looking for to get that to not be shared across players, but only to the one who has the item in their inventory? I haven't really thought about that being an issue until I made the post, and I'm focused on fixing that rather than the fire issue now

 

 

Edited by Babelincoln1809
Posted
6 hours ago, diesieben07 said:

If you really would need that, you need to use a capability attached to the player. However here you do not need that.

Alright, I rewrote the entire event, and fixed the infinite fire event and I believe it also fixes the multiple players issue as well. Although, I can't really test that at the moment.

 

Here's the code: https://pastebin.com/CTj6jbtY

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.