If Player Dies, Kill Pets

Started by alonso_allonsy on Tue, 08/11/2020 - 16:26

Topic category: Advanced modding

Last seen on 15:45, 7. Oct 2020
Joined Aug 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
If Player Dies, Kill Pets
Tue, 08/11/2020 - 16:26

Hello, i am making a mod where when a player spawns a mob spawns with them and follows them around until the player dies, a sort of tamed companion. What  i need help with is making it so that when the player dies so does that mob. It would also be good to know if it could work vice versa, so if the mob dies so does the player. I hope you can help. Thanks

Last seen on 16:56, 9. Sep 2020
Joined Apr 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
you could easily do it when…
Sun, 08/23/2020 - 06:44

you could easily do it when the pet dies if you stored the players name when taming it into the pets nbt then killing the player with that name via a kill command using the create text with block and the stored nbt. then for the other way around just do the another create text block with /kill @e[type=THEMOBSID,NBTTAG = get entity display name] you would have to go into the game and use the /data tag to find how the nbt you put in is actually stored then take that and try to figure out what syntax needs to be in what order than where the name would be where you put a get display name from. it would look something like this https://imgur.com/hAXMfoP make sure if you were to make the command that anything after the player's name was in the second box and make sure to not have any spaces at the end and the start of a text box unless the is supposed to be a space there in the command.

Last seen on 15:45, 7. Oct 2020
Joined Aug 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thank you for this, it will…
Tue, 09/15/2020 - 15:53

Thank you for this, it will help