Check if player has a tamed animal

Started by Memeslayer06 on Sat, 08/29/2020 - 01:00

Topic category: Advanced modding

Last seen on 03:41, 27. Sep 2020
Joined Aug 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Check if player has a tamed animal
Sat, 08/29/2020 - 01:00

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?

Last seen on 04:32, 24. Oct 2020
Joined Jun 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.