Check if player has a tamed animal

Started by Memeslayer06 on

Topic category: Advanced modding

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Check if player has a tamed animal

i would like to make an animal mod where you can tame most creatures, but can only have 1 pet. is there a way to check if the player has a pet already? if so, can i make it so attempting to tame after hitting the cap will make the creature attack the player?

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could use a global…
Sat, 08/29/2020 - 02:56

You could use a global player_persistent variable that you set to "true" if the player gets/has a pet, and you set back to false if they no longer do. Using that, you can only allow a player to tame another animal if that variable is false, and make them attack (using conditions) if they already have a pet and try to tame another.