Started by
Sans The Skeleton
on
Topic category: Help with Minecraft modding (Java Edition)
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
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.
Ok Thanks For The Help!
It only moves when i sprint
i tried fixing it, but now it only does it when i jump
Return if [not[vx vy vz] = [0]]
Use AND instead of OR