entity attacking condition

Started by Bananas on

Topic category: Help with modding (Java Edition)

Last seen on 12:14, 12. Apr 2024
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
entity attacking condition

Hi.

So, this is probably pretty basic knowledge, but I want to make an entity attack you when you are holding a sword. I heard it's possible by "return" procedure blocks, but could someone tell me, how exactly should the procedure look? I mean, I can check if the player is holding sword (the player is event/target entity in this case, right?), but I can't find the right "return" and "true/false" blocks arrangemet. I've tried everything I could think of.

Thanks.

Last seen on 15:20, 19. Apr 2024
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I would suggest your making…
Wed, 10/20/2021 - 11:24

I would suggest your making 2 entities.

One aggressive vs player and one not

Naturally spawn the not aggressive one, when player is holding sword then despawn pacific one and spawn aggressive

Same when player removes sword from hand

I made something similar in my mod and it works fine, I don't see any other possibility in "conditions" since PLAYER is not recognize as event is entity and source no one

Last seen on 12:14, 12. Apr 2024
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Imean I am doing that right…
Thu, 10/21/2021 - 07:06

Imean I am doing that right now, I just thought there should be a simplier way, as even the attacking AI block has the "coindition" part.

Last seen on 21:28, 15. Nov 2021
Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi @Bananas i have the same…
Tue, 10/26/2021 - 20:27

Hi @Bananas i have the same problem and there has to be an easier way. If i get a solution i tell u

Last seen on 15:20, 19. Apr 2024
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have searched for over 1…
Wed, 10/27/2021 - 05:14

I have searched for over 1 year and at the moment i have found no better solution than this

Last seen on 12:21, 7. Dec 2021
Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You need to make a new…
Thu, 10/28/2021 - 05:26

You need to make a new procedure (you can call it what ever) and make a code similar to this:

Event Trigger
IF: Item in main-hand of Event/target entity (you can find this is entity data) = (Whatever you want the item to be)
DO: Return true (blue return is what I used, dont know if its possible with others)
(outside of IF/DO group) Return False

This only works for modded entities. I dont know how to do it for vanilla. I would put an image but I dont know how yet. Hopefully this works

Last seen on 15:20, 19. Apr 2024
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Which is the trigger you use…
Thu, 10/28/2021 - 06:05

Which is the trigger you use ? Since this won't work with conditions for sure as source entity is not dependency and event is attacking mob