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 modding (Java Edition)

Last seen on 19:35, 6. Apr 2022
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
Last seen on 15:29, 11. Sep 2024
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.

Last seen on 19:35, 6. Apr 2022
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok Thanks For The Help!
Tue, 03/29/2022 - 20:34

Ok Thanks For The Help!

Last seen on 20:03, 28. Sep 2024
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

Last seen on 20:28, 28. Sep 2024
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