#(Daxz) Detect when a player looks at an npc
34 messages · Page 1 of 1 (latest)
(Daxz) Detect when a player looks at an npc
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.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>
!t locationtag.ray_trace
Traces a line from this location towards the direction it's facing, returning the location of the first hit block or (optionally) entity.
This tag has also been referred to as 'cursor_on' or 'precise_cursor_on' in the past.
For ray tracing entities, see !tag LocationTag.ray_trace_target.
Using 'return=normal' instead replaces the old 'precise_impact_normal' tag.
Optionally specify:
range: (defaults to 200) a maximum distance (in blocks) to trace before giving up.
return: (defaults to prec...
world
LocationTag
# Destroys whatever solid block the player is looking at.
- define target <player.eye_location.ray_trace[return=block]||null>
- if <[target]> != null:
- modifyblock <[target]> air
# Spawns a heart wherever the player is looking, no more than 5 blocks away.
- playeffect effect:heart offset:0 at:<player.eye_location.ray_trace[range=5;entities=*;ignore=<player>;fluids=true;nonsolids=true;default=air]>
and more... Check the website for more examples
Traces a line from this location towards the direction it's facing, returning the first hit entity (if any).
This is similar to !tag LocationTag.precise_target and !tag PlayerTag.target, except offering more options for how the ray trace is performed.
For ray tracing locations, see !tag LocationTag.ray_trace.
Optionally specify:
range: (defaults to 200) a maximum distance (in blocks) to trace before giving up.
blocks: (defaults to true) specify "false" to ignore all blocks, ...
world
EntityTag
# Removes the entity a player is looking at.
- define target <player.eye_location.ray_trace_target[ignore=<player>]||null>
- if <[target]> != null:
- remove <[target]>
# Returns any player within the view of an NPC.
- define target <npc.eye_location.ray_trace_target[entities=player;raysize=2]||null>
# Highlights an entity through any number or types of blocks.
- define target <player.eye_location.ray_trace_target[ignore=<player>;blocks=false]||null>
- if <[target]> != null:
- adjust <[target]> glowing:true
This is the one
thank
!t entity.can_see
Returns whether the entity can see the specified other entity (has an uninterrupted line-of-sight).
location
ElementTag(Boolean)
@novel path ^
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@novel path
Oh that works too
any solution that passes through glass?
Does that tag not account for transparent blocks?
Doesn't seem like, no
Best way I can think of is to ray trace, and if you hit a block check if it's see-through, and start another ray trace after it if so
But uh, could you explain what exactly are you trying to do/make?
!xy
Your question seems to be an XY Problem - you're asking about your attempted solution rather than your original problem.
Read in detail about the XY Problem here: http://xyproblem.info/
For an example of an XY Problem we've seen in Denizen, the question "how do I make an event for when a flag expires" has no answer, but the same question asked with full background detail will be something more like "I have this script: [LINK HERE], which sets a 3 minute cooldown flag on a player for when they use an ability. I want the player to be notified when the cooldown completes - how do I do this?" which we can then answer quite effectively (in this example, all that was needed was a simple wait command, no events or flag-listening or anything).
Or if it's already resolved then
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@novel path