#(aviside) How to detect if a player is facing an entity's back?
43 messages · Page 1 of 1 (latest)
(aviside) How to detect if a player is facing an entity's back?
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
check the facing direction of both entities and see if they face said direction is close enough together
!t entity.location.yaw
Did you mean to search for entitytag.location?
!t location.yaw
Returns the normalized yaw of the object at the location.
identity
ElementTag(Decimal)
Okay, I'm not sure what to do with the two values
what tags do I need to determine the position from those values?
I tried subbing one from the other and checking if it was a low number but it gives inconsistent results
you will need to keep in mind that yaw goes from 0-360, so you would need to be careful are the border area when 360 becomes 0 again
but otherwise you just check if player1 yaw is about equal to player2 yaw (like within + or - 2 degrees? up to you how much wiggle room you want)
Yeah I'm trying to check if it's close enough but idk how to do it
the difference tag isn't giving me the numbers I expected
what is it giving you?
numbers 8 - 12 when I compare the difference for their yaws
like sometimes it's 53 and 348 and it says the difference is 10
!debug
If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!
Content of Server Log Paste #124106: Denizen Debug Logs From... pasted 2024/06/26 19:30:37 UTC-07:00, Paste length: 16099 characters across 149 lines, Content: Java Version: 21.0.3Up-time: 3h 2m
and the script
Content of Denizen Script Paste #124107: Unnamed Denizen Script Paste... pasted 2024/06/26 19:31:17 UTC-07:00, Paste length: 384 characters across 8 lines, Content: Backstabs: type: world
Returns the element minus a number.
math
ElementTag(Decimal)
yeah I tried that but I got inconsistent results
!t element.abs
Returns the absolute value of the element.
For example: <element[-5].abs> returns 5.
math
ElementTag(Decimal)
you can use this to flip anything negative to positive
oh okay cool
Thread closed as resolved.
Im having issues with this, how do I deal with 360 becoming 0?
Thread was manually reopened by @hollow dagger.
idk how to deal with the lower values and high values too
yeah it'll work for the right angles lol but not when the yaw wraps around for another entity
Thread is now a Help/Support thread. A helper will check your thread when available.