AI attack conditions

Started by woodcreatures on

Topic category: Help with Minecraft modding (Java Edition)

Active 8 months ago
Joined Mar 2021
Points:
1034

User statistics:

  • Modifications: 3
  • Forum topics: 37
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 451
AI attack conditions
Sun, 12/15/2024 - 10:21 (edited)

Need help please, I've been stucked here since two weeks now.

I need to make an attack conditions in my entity AI which says my entity only attacks creatures under a specific tag

I see that only way is using "get entity event target rate is targeting for attack" btu this is a NULL block. Any way I try or it crashes the game or it does nothing.

I have tried many different return values, many different ways but nothing to do

Anyone can please show me the correct procedure ?

Edited by woodcreatures on Sun, 12/15/2024 - 10:21
Active 11 months ago
Joined Apr 2020
Points:
658

User statistics:

  • Modifications: 0
  • Forum topics: 3
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 3
Try using the "For each…
Sat, 12/14/2024 - 19:07

Try using the "For each entity as entity iterator" block.

Make a new "target" local entity variable and a "distance" local number variable.

Set the number to the range of your custom entity in blocks.

Go through all entities in your custom entities' range, and do the following:
Check if the current entity iterator has the tag.
If it does, check if it's distance to the custom entity is shorter than the "distance" variable.

If both conditions apply, after the "For each entity block" finishes, you will have to set your custom entities' target to the "target" local variable.

Tell me if it worked!

Active 8 months ago
Joined Mar 2021
Points:
1034

User statistics:

  • Modifications: 3
  • Forum topics: 37
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 451
not clear how to do that,…
Sun, 12/15/2024 - 09:10

not clear how to do that, some parts are obscure

Please send screenshot if you can

Active 8 months ago
Joined Mar 2021
Points:
1034

User statistics:

  • Modifications: 3
  • Forum topics: 37
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 451
I know that page perfectly …
Sun, 12/15/2024 - 13:47

I know that page perfectly 

AI attack conditions return value only works with entity subtype

If you use any other block (like tags or anything else) it does not work