Paste #105343: Waypoint_bossbar

Date: 2023/01/13 16:13:48 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


# Create a bossbar that points the player towards the waypoint selected
waypoint_bossbar:
    type: task
    debug: true
    definitions: direction
    script:
    - narrate "running bossbar" targets:<player>
    - bossbar auto waypoint players:<player> title:<[direction]> save:waypoint
    - flag <player> waypoint_bossbar.active:<[direction]> expire:10s

waypoint_world:
    type: world
    debug: true
    events:
        on player clicks block:
        - ratelimit player 1t
        - define direction <player.location.direction[green_room.jester.spawn]>
        - run waypoint_bossbar def:<[direction]>
        on player walks flagged:waypoint_bossbar.active:
        - ratelimit player 1s
        #The direction of the waypoint
        - define direction <player.location.direction[green_room.jester.spawn]>
        #Distance between the player and the waypoint
        - define distance <player.location.distance[green_room.jester.spawn].round_down>
        #Location that the player is looking at
        - define dir <player.location.direction>
        - choose <[direction]>:
            - case north:
                - define direction "<green>Go this way <red><green><bold>[<[distance]>]"
                - run waypoint_bossbar def:<[direction]>
            - case northwest:
                - define direction "<green>Go this way <red><green><bold>[<[distance]>]"
                - run waypoint_bossbar def:<[direction]>
            - case northeast:
                - define direction "<green>Go this way <red><green><bold>[<[distance]>]"
                - run waypoint_bossbar def:<[direction]>
            - case south:
                - define direction "<green>Go this way <red><green><bold>[<[distance]>]"
                - run waypoint_bossbar def:<[direction]>
            - case southwest:
                - define direction "<green>Go this way <red><green><bold>[<[distance]>]"
                - run waypoint_bossbar def:<[direction]>
            - case southeast:
                - define direction "<green>Go this way <red><green><bold>[<[distance]>]"
                - run waypoint_bossbar def:<[direction]>
            - case west:
                - define direction "<green>Go this way <red><green><bold>[<[distance]>]"
                - run waypoint_bossbar def:<[direction]>
            - case east:
                - define direction "<green>Go this way <red><green><bold>[<[distance]>]"
                - run waypoint_bossbar def:<[direction]>