Started by
minheragon12345
on
Topic category: User side tutorials
I made a kill count so when I directly killed a mobs the number increased.
But the thing is, obviously if I ignite a tnt and killed mobs or my pet killed mobs, it should be my kill right?
Is it possible to count these kind of kills?
It gets complicated the more things you add to the equation.
how is it determined? by who placed the tnt or maybe the nearest player?
the fact is there can be so many things that effect how or when or who made the tnt blow up.
to my understanding it would be wayyyyy to complex to get the entity that caused the entity to die if not direct there are exceptions but few.
now the pet you say could work if the pet is in relation to you like say the pet was tamed by you or it was born from your tamed pet. i believe that is more tangible than by TNT. Btw i have NO clue how to get who the entity was tamed by sorry.
But to answer your question simply, yes it's possible to try but it's NOT full proof.
wow, thanks XD
If you want to know who’s pet it is, there is a block for this. And for the TNT, you will need to add a procedure that runs when "player right clicks on block", then test if the "blockstate" is TNT, and if the item in main hand of the player is a flint and steel. then, you use a « wait [1] tick then on server side » and in this block, add a text NBT data to the nearest ignited TNT (with 1x1x1 square), its value should be the player’s name. this basically makes the TNT entity itself have the user that ignited it stored, then add another procedure with global trigger : "entity dies" and add an "if, do" block that tests if the damage source is a TNT explosion, if it is, look for the NBT data of the TNT (in that case, use "immediate source entity" and NOT "source entity") and here you got the username of the user who ignited the TNT, and caused the death of the other player/entity. hope this helps ;)