• Hey! Register here to create your account, engage with the community, and talk about what is new!

make mob always know the location of the nearest player

NineOfGaming

Active member
Overlord
Joined
Jul 12, 2021
Messages
51
Reaction score
5
is i possible to make a mob (for example a zombie) always know the location of the nearest player and go towards them and attack no matter how far away they are?
 
Solution
is i possible to make a mob (for example a zombie) always know the location of the nearest player and go towards them and attack no matter how far away they are?
Sorry for late reply, I see you didn't mark any of these as a solution so here are 2 templates;
You have to put these Templates in Loops (with a wait maybe like 5? for LagSlayer) (do NOT put them directly in a Repeat, instead call them using Call Function (the Call Function block has to be inside a repeat) because if you do place them, the closing bracket of the Repeat disappears and/or it might not fit)

If You Have 1 Zombie...

luapus

New member
Joined
Jul 17, 2021
Messages
3
Reaction score
0
I haven't tried but I think you can use the select object block and choose to select all players. Then place another select object block and choose filter by distance from the location of the zombie. And then use something from the AI option in entity action to make the zombie agro on the selected player (I have no idea what is even in the entity action block since I barely use it, all I know is that there is something about AI). I hope this helps :)
 

ARMcPro

Forum adept
Overlord
Joined
Oct 20, 2020
Messages
1,226
Reaction score
347
is i possible to make a mob (for example a zombie) always know the location of the nearest player and go towards them and attack no matter how far away they are?
Sorry for late reply, I see you didn't mark any of these as a solution so here are 2 templates;
You have to put these Templates in Loops (with a wait maybe like 5? for LagSlayer) (do NOT put them directly in a Repeat, instead call them using Call Function (the Call Function block has to be inside a repeat) because if you do place them, the closing bracket of the Repeat disappears and/or it might not fit)

If You Have 1 Zombie:

If You Have Multiple Zombies:
 
Solution

NineOfGaming

Active member
Overlord
Joined
Jul 12, 2021
Messages
51
Reaction score
5
Sorry for late reply, I see you didn't mark any of these as a solution so here are 2 templates;
You have to put these Templates in Loops (with a wait maybe like 5? for LagSlayer) (do NOT put them directly in a Repeat, instead call them using Call Function (the Call Function block has to be inside a repeat) because if you do place them, the closing bracket of the Repeat disappears and/or it might not fit)

If You Have 1 Zombie:

If You Have Multiple Zombies:
thanks this realy helped the other ones where a bit confusing to me, also the one for only one zombie is missing the set var target to %selected but its an easy fix thanks again
 

ARMcPro

Forum adept
Overlord
Joined
Oct 20, 2020
Messages
1,226
Reaction score
347
thanks this realy helped the other ones where a bit confusing to me, also the one for only one zombie is missing the set var target to %selected but its an easy fix thanks again
oh yeah sorry about that, I copied the broken template, but it's fixable by a set variable after the Filter Distance, you place a variable called `target` and is LOCAL, and you also put a text called `%selected` in the 2nd slot and it should be fixed (ik you already done it but for people that need help)
 
Top Bottom