Having issues with making mob AI

Started by Lambda System on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Having issues with making mob AI

Getting to the point here;

I'm trying to make my mob AI notice the player and have it wait 5 seconds (and stop moving) once it spots a player, almost like it's inspecting or identifing them. After waiting for said 5 seconds, it plays an animation (which lasts for 4 seconds) and once the animation is done, it'll start chasing/attacking the player until all nearby players are dead, or they escape
This could be a case of me drinking stupid juice and the answer to solve all my problems is literally screaming at my face, or I just simply can't do it for- whatever reason. 

For once it's not a case of the game crashing, just, me not figuring out how to do the simple (unless it isn't simple but who am I to judge?)

I've been at this for like, 2-3 weeks and I figured I should just stop letting myself suffer and just ask for help. So here I am, asking for help....help ;;]

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi, maybe I have a solution,…
Sat, 06/10/2023 - 22:46

Hi, maybe I have a solution, I just need to know if you are using GeckoLib or not

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah I am using GeckoLib :]
Sat, 06/10/2023 - 22:52

Yeah I am using GeckoLib :]

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi again, here is everything…
Sun, 06/11/2023 - 00:30

Hi again, here is everything you need to do what you wanted.
 

1) You must have these 3 procedures:

  1. ChasingEntityOnSpawnSet
  2. ChasingEntityWaitCheck
  3. PlayerSpottedByChasingEntity

(You can replace "ChasingEntity" with the name of your entity)

(All these procedures can also work for other types of targets besides players, just set the entity you want to hunt in the AI ​​procedure and the Event/Target entity subtype in the procedure "PlayerSpottedByChasingEntity")

  1. ChasingEntityOnSpawnSet:

  2. ChasingEntityWaitCheck:

  3. PlayerSpottedByChasingEntity:

 

2) Set up the entity's AI procedure exactly like this:

  1. Put in sequence this blocks:

  2. Set the conditions equally for the second / third / fourth block:

 

3) Finished!!! I hope I was clear in the explanation and helpful.

 

P.S. There is another version of the "PlayerSpottedByChasingEntity" procedure:


This version adds a constant check whether the prey is alive or not. So if for some reason it dies first the procedure ends prematurely and the hunting entity can target something else. 

Sorry for the bad quality of the image, the procedure is really big and it can't fit the screen : (

I think I have said everything and haven't forgotten anything : ]

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
(I advise you to open the…
Sun, 06/11/2023 - 00:33

(I advise you to open the images in a new window so you can see them better)

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
h  o  l   y thank you so…
Sun, 06/11/2023 - 00:45

h  o  l   y

thank you so much!! your a saint for this omfg

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Glad to help, wish you a…
Sun, 06/11/2023 - 00:53

Glad to help, wish you a good development of your mod!