Very Strange Request

Started by kios3A on

Topic category: Advanced modding

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Very Strange Request

I want to make a mob that when it spawn selects an item from a special loot table and if the player is holding that item, they will become aggressive and attack them for that item. I have the detecting part and the loot table part I'm just having trouble with the "randomly choose an item" part. Can anyone help me?

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It seems I also need help…
Sun, 01/21/2024 - 07:19

It seems I also need help with getting them to attack you when you hold the item

Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Instead of using loot tables…
Sun, 01/21/2024 - 19:05

Instead of using loot tables, try using procedures. When the entity spawns in, set a variable to a random number from 1 to however many items you want it to chose from. Then, have an if statement checking if that varible is 1, another checking if it is 2, and so on. You can use this to set an item, for example, if it is 1, it sets a varible to a wool block. Then, another procedure checks if the player is holding the block in that varible, (for this example, wool) and if they are, check for your entity nearby. If it finds it, despawn it, and spawn in a new entity at the same place, that tries to kill the player. Let me know if you need more help or images on how to do this.