Solved Distance between blocks

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Aralwen

Active Member
May 26, 2017
164
14
18
25
Hello,
I am trying to make an approximate distance. For example, that display : you are between 100 and 150 blocks

code_language.skript:
command /define:
    trigger:
        set {zone} to player's location
       
command /info:
    trigger:
        send "You are between ... blocks of the zone"

Thank's :emoji_slight_smile:
 
Please try harder to explain what you're trying to achieve because you posted so far certainly makes no sense :emoji_grinning:
 
Please try harder to explain what you're trying to achieve because you posted so far certainly makes no sense :emoji_grinning:
I want to make a /define command that defines a place on the map, then another command /info that says : "
You are at X blocks from the position". It calculates the X and Z to give an approximation :

  • Between 0 and 300 blocks
  • Between 601 and 1500 blocks
  • More than 1500 blocks
 
  • Like
Reactions: jaylawl
code_language.skript:
command /info:
    trigger:
        send "You are %distance between player and {zone}% blocks away from the zone"
If you only want an estimate you could do something like:
code_language.skript:
options:
    modifier : 300
command /info:
    trigger:
        set {_distance} to (floor(distance between player and {zone} / {@modifier}) * {@modifier})
        send "You are ~%{_distance}% - %{_distance} + {@modifier}% blocks away from zone"
 
code_language.skript:
command /info:
    trigger:
        send "You are %distance between player and {zone}% blocks away from the zone"
If you only want an estimate you could do something like:
code_language.skript:
options:
    modifier : 300
command /info:
    trigger:
        set {_distance} to (floor(distance between player and {zone} / {@modifier}) * {@modifier})
        send "You are ~%{_distance}% - %{_distance} + {@modifier}% blocks away from zone"

Thank you very much ! It works perfectly

Solved
 
Status
Not open for further replies.