#(falcontheb) What's the best way to make a player tracking compass?

52 messages · Page 1 of 1 (latest)

heady cargo
#

Im making a tournament in a 6kx6k world. as it's large I need to create a compass that points towards the nearest player. how can i do this?

mystic coveBOT
#

(falcontheb) What's the best way to make a player tracking compass?

mystic coveBOT
#

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>

west ridge
#

How do you plan for it to work?

#

On click?

#

Automatically points to the nearest one?

heady cargo
#

idk, whichever way is easiest

heady cargo
#

@west ridge ?

west ridge
#

I'd say the easier one is on click

#

!e player clicks item

somber smeltBOT
# west ridge !e player clicks item
Group

Player

Event Lines

player (<click_type>) clicks (<item>) in <inventory>

Switches

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.

Triggers

when a player clicks in an inventory. Note that you likely will also want to listen to !event player drags in inventory.

Has Player

Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Context

<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.

Determine

ItemTag to set the current item for the event.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

heady cargo
#

ok, and how do I do that? I've found the <location> tag, but how do I make the compass point to it?

west ridge
#

Wrong event

#

Hold on

#

Ah perfect

#

!c compass

somber smeltBOT
# west ridge !c compass
Group

player

Syntax

compass [<location>/reset]

Short Description

Redirects the player's compass to target the given location.

Description

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)

heady cargo
#

ok

#

im gonna try that

west ridge
#

And for the on click you would use

#

!e player right clicks block

somber smeltBOT
west ridge
#

!e player clicks block

somber smeltBOT
# west ridge !e player clicks block
Group

Player

**WARNING**

this event may in some cases double-fire, requiring usage of the 'ratelimit' command (like 'ratelimit <player> 1t') to prevent doubling actions.

Event Lines

player (right|left) clicks <block>

Switches

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.

Triggers

when a player clicks on a block or in the air.

Has Player

Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Context

<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.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

west ridge
#

Use the with: switch to make it fire only when a compass is clicked

heady cargo
#

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

heady cargo
#

@west ridge

west ridge
somber smeltBOT
# west ridge !rule 3
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.

heady cargo
#

sorry

west ridge
#

!paste

somber smeltBOT
heady cargo
#

i've found a workaround for the compass not updating, but it only tracks the person who used it

green falcon
#

!t server.online_pla

somber smeltBOT
green falcon
#

!t <server.online_players>

somber smeltBOT
green falcon
#

!t listtag.lowest

somber smeltBOT
# green falcon !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.

Returns

ObjectTag

Examples
# 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>
green falcon
#

!t locationtag.distance

somber smeltBOT
green falcon
#

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]>```
heady cargo
#

ok thanks