I Want To Make A Monster That Cant See You If You Don't Move

Started by Sans The Skeleton on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I Want To Make A Monster That Cant See You If You Don't Move
Wed, 03/23/2022 - 06:33 (edited)

I Cant Figure Out How To Make An AI That Cant See You If You Stand Still And If It Sees You Move It Attacks You, Please Help.

Edited by Sans The Skeleton on Wed, 03/23/2022 - 06:33
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So pretty much, you're gonna…
Fri, 03/25/2022 - 06:47

So pretty much, you're gonna need a variable called "player moving". This is gonna be a logic, global variable, and its default will be false.

Now, for the procedure. This is an "on player update tick" it'll do this procedure:

 

If (X velocity of event/target entity > 0) or (Y velocity of event/target entity > 0) or (Z velocity of event/target entity > 0) then

Set player moving to true

else

Set player moving to false

 

And now, for the AI. You just program the usual AI, all the way to attack player, blah blah blah. But you're gonna add a condition. That condition is gonna just be:

 

return (Player moving variable)

 

So then, the mob will attack if the player moving variable is true, and won't if the player moving variable is false.

 

Note: This thing only works in singleplayer, I'll try and comment here once I know how to do it in multiplayer.

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It only moves when i sprint
Sat, 09/28/2024 - 20:04

It only moves when i sprint

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
 i tried fixing it, but now…
Sat, 09/28/2024 - 20:28

 i tried fixing it, but now it only does it when i jump

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Return if [not[vx vy vz] = …
Tue, 10/01/2024 - 12:34

Return if [not[vx vy vz] = [0]] 

Use AND instead of OR