#(falcontheb) What's the best way to make a player tracking compass?
52 messages · Page 1 of 1 (latest)
(falcontheb) What's the best way to make a player tracking compass?
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>
idk, whichever way is easiest
@west ridge ?
Player
player (<click_type>) clicks (<item>) in <inventory>
with:<item> to only process the event if a specified cursor item was used.
in_area:<area> replaces the default 'in:<area>' for this event.
action:<action> to only process the event if a specified action occurred.
slot:<slot> to only process the event if a specified slot or slot_type was clicked. For slot input options, see !language Slot Inputs.
when a player clicks in an inventory. Note that you likely will also want to listen to !event player drags in inventory.
Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.
<context.item> returns the ItemTag the player has clicked on.
<context.inventory> returns the InventoryTag (the 'top' inventory, regardless of which slot was clicked).
<context.clicked_inventory> returns the InventoryTag that was clicked in.
<context.cursor_item> returns the item the Player is clicking with.
<context.click> returns an ElementTag with the name of the click type. Click type list: <@link url...
<context.slot_type> returns an ElementTag with the name of the slot type that was clicked. Slot ty...
<context.slot> returns an ElementTag with the number of the slot that was clicked.
<context.raw_slot> returns an ElementTag with the raw number of the slot that was clicked.
<context.is_shift_click> returns true if 'shift' was used while clicking.
<context.action> returns the inventory_action. See <@link language Inventory Actions>.
... and 1 more.
ItemTag to set the current item for the event.
True - this adds switches in:<area> + location_flagged:<flag name>.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
ok, and how do I do that? I've found the <location> tag, but how do I make the compass point to it?
player
compass [<location>/reset]
Redirects the player's compass to target the given location.
Redirects the compass of the player, who is attached to the script queue.
This is not the compass item, but the command is controlling the pointer the item should direct at.
This means that all item compasses will point the same direction but differently for each player.
To affect an individual compass item, use !mechanism ItemTag.lodestone_location
The y-axis is not used but its fine to be included in the location argument.
Reset argument will turn the direction to default (spawn or bed)
!e player clicks block
Player
this event may in some cases double-fire, requiring usage of the 'ratelimit' command (like 'ratelimit <player> 1t') to prevent doubling actions.
player (right|left) clicks <block>
with:<item> to only process the event if a specified item was held.
using:hand/off_hand/either_hand to only process the event if the specified hand was used to click.
type:<material> to only run if the block clicked matches the material input.
when a player clicks on a block or in the air.
Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.
<context.item> returns the ItemTag the player is clicking with.
<context.location> returns the LocationTag the player is clicking on.
<context.relative> returns a LocationTag of the air block in front of the clicked block.
<context.click_type> returns an ElementTag of the Spigot API click type <@link url https://hub.spi...
<context.hand> returns an ElementTag of the used hand.
True - this adds switches in:<area> + location_flagged:<flag name>.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
Use the with: switch to make it fire only when a compass is clicked
ok
i need someone else in my server to test, or can it locate me even if I hold it?
ok, it should work now. im just gonna get a friend in to see
it tracks the location of the player when you right click with the compass, but when the player moves it doesn't update the compass
@west ridge
!rule 3
Don't ping for help. https://denizenscript.com/discord_rules#rule3
"Pinging" refers to using an @ to alert somebody to your post.
Generally only ping somebody if your message is very specifically directed at them (meaning, only that person has anything to do with the information in your message, and it would be confusing who it was for without the ping).
If you're asking a question, please just make a forum post and ask.
If you have a bug report or a feature request, please just make a forum post about it.
If this is pulled up for you by a helper, your ping was unneeded.
If you're arguing about it, you're wrong.
sorry
!paste
Help us help you by pasting your script to https://paste.denizenscript.com/New/Script and linking it back here.
Content of Denizen Script Paste #113491: Player Tracking Compass... pasted 2023/08/07 02:15:49 UTC-07:00, Paste length: 537 characters across 24 lines, Content: player_compass: type: item
i've found a workaround for the compass not updating, but it only tracks the person who used it
!t server.online_pla
!t <server.online_players>
!t listtag.lowest
Returns the smallest value in a list of decimal numbers.
Optionally specify a tag to run on each list entry that returns the numeric value for that entry.
ObjectTag
# Narrates '1'
- narrate "<list[3|2|1|10].lowest>
# Narrates the name of the player with the least money currently online
- narrate <server.online_players.lowest[money].name>
!t locationtag.distance
Returns the distance between 2 locations.
math
ElementTag(Decimal)
you can use these to find the closest player to the player that's using the compass ^
after player right clicks block with:player_compass:
- define loc <player.location>
#list of all online players except linked
- define players <server.online_players.exclude[<player>]>
#stop if no other players are online
- stop if:<[players].is_empty>
#!t listtag.lowest
#!t locationtag.distance[]
- define closest_target <[players].lowest[location.distance[<[loc]>]].location>
#set compass
- compass <[closest_target]>```
ok thanks