Hey, I need to figure out a way to detect if a player is sneaking at certain coordinates and I thought that using the /testfor command with some coordinates could work.
There is one issue though, I don't know how to make it so it reads the eye position instead of the feet position.
all i see here is stuff that dose not work well, i think dragnoz made something like this but idk. i want to make it so that when you sneak you are invisible!
Minethor, don't know if I'm late, but I saw this thread and I wrote out some commands as a solution: (Done using snapshots. Not sure if it works in 1.7)
First, set this scoreboard with this stat: /scoreboard objectives add Sneak stat.crouchOneCm
Then you can track that player with this: /testfor @p[score_Sneak_min=1]
This next part is for your context of invisibility:
First, you'd hook this second command to a clock: /effect @p[score_Sneak_min=1] 14 * 1.
*(Time you want them invisible for. I'd recommend 1 so that as long as they sneak, they're invisible, but once they unsneak, they reappear.)
Well, with 1.8 out now, there is a way to detect Eye position. Well, sort of... Using Rotation, u can kinda do eye tracking with it. Idk how to do it though.
STOP USING /testfor, it is very very VERY stupid and is completely replaced with everything else, unless for using auto-door, ok?
Please don't use it and don't teach people the wrong thing.
Here's how you do it:
/scoreboard objectives add Crouch stat.crouchOneCm
/effect @a[score_Crouch_min=1] 14 1 And this to reset
/scoreboard players set @a Crouch 0
Rollback Post to RevisionRollBack
Get any of your command blocks problem solved here:
STOP USING /testfor, it is very very VERY stupid and is completely replaced with everything else, unless for using auto-door, ok?
Please don't use it and don't teach people the wrong thing.
Here's how you do it:
/scoreboard objectives add Crouch stat.crouchOneCm
/effect @a[score_Crouch_min=1] 14 1 And this to reset
/scoreboard players set @a Crouch 0
Keep in mind that this would only make you invisible while you're moving in sneak, because it is stat.crouchOneCm and not testing when the player actually presses the sneak button. For my stealth multiplayer minigame, I instead did the opposite and incremented a visLevel objective whenever a player moves, such as statWalk, statSprint, statJump, statSwim, and incremented it differently for the type of block they walked on. If they did not move or sneaked while outside the proximity of torches, they would be invisible.
I'm not sure why everyone is saying to use crouchOneCm it's really obsolete. This one should work for you, but for detecting eye position what do you mean exactly maybe I can help.
I'm not sure why everyone is saying to use crouchOneCm it's really obsolete. This one should work for you, but for detecting eye position what do you mean exactly maybe I can help.
I'm not sure why everyone is saying to use crouchOneCm it's really obsolete. This one should work for you, but for detecting eye position what do you mean exactly maybe I can help.
This sorta works, but sneakTime never goes down, it keeps sneakTime even if you stop sneaking. How would I manage to get it back down if I stopped sneaking?
There is one issue though, I don't know how to make it so it reads the eye position instead of the feet position.
Any help would be much appreciated.
Guess I'll have to figure another way to activate what I want then. Thank you though.
pupypupDwagin give it clickz plz
First, set this scoreboard with this stat: /scoreboard objectives add Sneak stat.crouchOneCm
Then you can track that player with this: /testfor @p[score_Sneak_min=1]
This next part is for your context of invisibility:
First, you'd hook this second command to a clock: /effect @p[score_Sneak_min=1] 14 * 1.
*(Time you want them invisible for. I'd recommend 1 so that as long as they sneak, they're invisible, but once they unsneak, they reappear.)
Well, with 1.8 out now, there is a way to detect Eye position. Well, sort of... Using Rotation, u can kinda do eye tracking with it. Idk how to do it though.
Skillz Boi! XD
Please don't use it and don't teach people the wrong thing.
Here's how you do it:
/scoreboard objectives add Crouch stat.crouchOneCm
/effect @a[score_Crouch_min=1] 14 1 And this to reset
/scoreboard players set @a Crouch 0
Keep in mind that this would only make you invisible while you're moving in sneak, because it is stat.crouchOneCm and not testing when the player actually presses the sneak button. For my stealth multiplayer minigame, I instead did the opposite and incremented a visLevel objective whenever a player moves, such as statWalk, statSprint, statJump, statSwim, and incremented it differently for the type of block they walked on. If they did not move or sneaked while outside the proximity of torches, they would be invisible.
in the snapshots for 1.9 there is a new testfor tag, but i forgot what it was
i think it was something like {Sneaking:0/1}
idk what it really is but anyway hope this helped a bit
I'm not sure why everyone is saying to use crouchOneCm it's really obsolete. This one should work for you, but for detecting eye position what do you mean exactly maybe I can help.
oh yeah... it was a scoreboard thing not a testfor
Im not sure were you got stat.sneakTime because it doesn't appear to be a thing. Am I missing something?
stat.sneakTime was added during the 1.9 snapshots.
Minecraft-things: http://skylinerw.com
More Minecraft-things: https://sourceblock.net
Guides for command-related features (eventually moving to Source Block): https://github.com/skylinerw/guides
I primarily hang out in the /r/MinecraftCommands discord, where there's a lot of people that help with commands: https://discord.gg/QAFXFtZ
Their corresponding subreddit: https://www.reddit.com/r/MinecraftCommands/
oh. ok. I wish they had added that in 1.8.8 or something. Thanks for the info!
This sorta works, but sneakTime never goes down, it keeps sneakTime even if you stop sneaking. How would I manage to get it back down if I stopped sneaking?