Started by
Noxvern
on
Topic category: Help with MCreator software
Hello guys!
I want to create a mob that always attacks the player, except if it has the effect of a potion, I have tried a thousand times and I can't quite get it. If you can add screenshots or a detailed explanation of the procedures, I would be very grateful
For this you'll want to create a procedure under "on entity tick" INSTEAD of putting the attack target in the AI building zone. Create an if statement to first check if a player exists within its attack radius (this is important, since if you check if a nearby player has the effect and there is no player, it will crash!). Then within that if block, add another if block checking if the nearest player, within the same radius you set above, has the desired potion. Add a "not" to the the front, then inside, make it set the nearest player to its attack target. Alternatively, you can make that if statement into an if/else statement and have it clear its attack target if you want it to stop attacking the player if they consume the potion in front of the entity.
I tried this thing, but I think Im missing something https://imgur.com/a/xqqqB6T