I am making a sneaking mechanic for a map I'm making and I need to alert a guard ( @e[tag=guard] ) to attack the player when the player gets in view of the guard.
I am not sure if I can use the new relative thingies to the mobs view ( ^ ^ ^ ) to detect if the player is in front of the mob but still within an area or if I have to use a different method. If nothing really works I don't mind but I really want some way of alerting the guard to attack the player (if it is in range)
The red area is what the guard can see and the blue is the guard.
I am making a sneaking mechanic for a map I'm making and I need to alert a guard ( @e[tag=guard] ) to attack the player when the player gets in view of the guard.
I am not sure if I can use the new relative thingies to the mobs view ( ^ ^ ^ ) to detect if the player is in front of the mob but still within an area or if I have to use a different method. If nothing really works I don't mind but I really want some way of alerting the guard to attack the player (if it is in range)
The red area is what the guard can see and the blue is the guard.
Just asking before doing anything.
1) Are guards spawning randomly, or are they assigned to a fixed spot?
2) When the player dies/ runs away, will the searching resume?
3) Where are they? Inside a little hole? A corridor? Or a wide area?
4) Can they not see backwards? Cuz I assume they can hear.
2) If the player runs away and the guard can't find the player ; or the guard is 15 blocks away from its guarding position I was going to make the guard path find back to its location it was guarding.
3) I'm going to have them placed around the map in different locations. Some of them may be in hallways and some in the open by main entrances.
4) This is the thing, mobs can see behind them too and I want to try limit this so that the guard can only see in front of him.
Giving the guard a follow range of 0, slowness 255 and making him face a certain direction may work, if the player goes into a zone that I mark out I could make the guard chase the player by removing the slowness, setting the follow range to a higher number and letting the guard move his head freely.
Although it might be nice if there was an easier way of doing things.
2) If the player runs away and the guard can't find the player ; or the guard is 15 blocks away from its guarding position I was going to make the guard path find back to its location it was guarding.
3) I'm going to have them placed around the map in different locations. Some of them may be in hallways and some in the open by main entrances.
4) This is the thing, mobs can see behind them too and I want to try limit this so that the guard can only see in front of him.
Giving the guard a follow range of 0, slowness 255 and making him face a certain direction may work, if the player goes into a zone that I mark out I could make the guard chase the player by removing the slowness, setting the follow range to a higher number and letting the guard move his head freely.
Although it might be nice if there was an easier way of doing things.
I was actually think if you add another invisible entity at the guard's guarding spot.
The invisible entity can be a zombie underground, riding the guard, or armor stand (using the /execute anchored).
I assume the guards can only look at 4 directions while guarding (North West South East).
You can detect if the entity's x_rotation and distance is within range.
I am making a sneaking mechanic for a map I'm making and I need to alert a guard ( @e[tag=guard] ) to attack the player when the player gets in view of the guard.
I am not sure if I can use the new relative thingies to the mobs view ( ^ ^ ^ ) to detect if the player is in front of the mob but still within an area or if I have to use a different method. If nothing really works I don't mind but I really want some way of alerting the guard to attack the player (if it is in range)
The red area is what the guard can see and the blue is the guard.
Just asking before doing anything.
1) Are guards spawning randomly, or are they assigned to a fixed spot?
2) When the player dies/ runs away, will the searching resume?
3) Where are they? Inside a little hole? A corridor? Or a wide area?
4) Can they not see backwards? Cuz I assume they can hear.
Thanks for responding!
1) They are going to be assigned a fixed spot
2) If the player runs away and the guard can't find the player ; or the guard is 15 blocks away from its guarding position I was going to make the guard path find back to its location it was guarding.
3) I'm going to have them placed around the map in different locations. Some of them may be in hallways and some in the open by main entrances.
4) This is the thing, mobs can see behind them too and I want to try limit this so that the guard can only see in front of him.
Giving the guard a follow range of 0, slowness 255 and making him face a certain direction may work, if the player goes into a zone that I mark out I could make the guard chase the player by removing the slowness, setting the follow range to a higher number and letting the guard move his head freely.
Although it might be nice if there was an easier way of doing things.
I was actually think if you add another invisible entity at the guard's guarding spot.
The invisible entity can be a zombie underground, riding the guard, or armor stand (using the /execute anchored).
I assume the guards can only look at 4 directions while guarding (North West South East).
You can detect if the entity's x_rotation and distance is within range.
Alright, I'll give it a go