(Skill) Relative TeleportTo

Discussion in 'Suggestions' started by Gunging, Mar 13, 2019.

  1. Gunging

    Gunging New Member

    Joined:
    Mar 13, 2019
    Messages:
    8
    Likes Received:
    0
    The absolute version of this, the skill TeleportTo, already exists. It takes in a set of x, y, and z value; But that puts the target in the world co-ordinates x y z, but how about that x y z being relative to the caster of the skill? And better yet, an option to make it relative to the rotation of the caster (replace "x, y, z" for "horizontal offset, vertical offset, forward offset").

    Example:
    So suppose we teleport the target +0 units in the X, +3 units in the Y, and -3 units in the Z relative to the position of the skill-casting MythicMob:

    [Image ilustrating the concept that apparently is 'spamm or inappropiate content']
    MythicMob with a reference of X(red), Y(green), and Z(blue) axes.
    And better yet, an option to make it also relative to the rotation of the caster:
    [Image ilustrating the concept that apparently is 'spamm or inappropiate content']
    The Relative Axes have rotated with the MythicMob, making the Z axis 'forward offset,' the Y axis 'vertical offset,' and the X axis 'horizontal offset.'
    Note: It is fine to make it relative only to the caster of the skill, because if someone wanted to make it relative to the target of it, they could just use sudoskill.

    Side Note, Irrelevant to the actual topic:
    Whoever made the spam-blocking system didn't really know what he was doing. Take it from someone who puts color on text.
     
    #1
    Last edited: Mar 13, 2019
  2. Nexto

    Nexto Member

    Joined:
    Dec 3, 2017
    Messages:
    74
    Likes Received:
    8
    Vanilla minecraft already provides this option,

    - command{c="minecraft:tp <mob.uuid> ~ ~-0.4 ~"} @self

    dont see a real need of adding this mechanic.
     
    #2
  3. Gunging

    Gunging New Member

    Joined:
    Mar 13, 2019
    Messages:
    8
    Likes Received:
    0
    How would you make it relative to the rotation of the mythic mob?

    That is, forward and horizontal offsets. That's actually my trobule right now.

    Also, the command you provide teleports whoever the command is targetting to a position relative to themselves, it doesn't teleport the target to a position relative to the caster of the skill.

    The way I kinda do it right now, is this:
    Code:
    Skills:
    - command{c="minecraft:tp <target.uuid> <mob.l.x> <mob.l.y> <mob.l.z>"} @Target #Teleports target to the position of the caster of the skill.
    - command{c="minecraft:tp <target.uuid> ~ ~3 ~-3"} @Target #Teleports target to a relative position instantly afterwards
    And that '-3' for the relative Z only works as "Forward" when the mythic mob is facing exactly North, else its kinda sideways or even behind (obviously).

    Its also not about using Throw with a very high velocity or something because only the direction of throw is relative to the caster, while the position the target ends up at depends on where the target was before being thrown.

    For what I want, the target could initially be on the moon but I want him exactly 3 blocks forward and three blocks up from the caster of the skill.
     
    #3
    Last edited: Mar 13, 2019
  4. Gunging

    Gunging New Member

    Joined:
    Mar 13, 2019
    Messages:
    8
    Likes Received:
    0
    Thank you everyone who (did not) help! I figured it out, though it does not support horizontal offset:

    Code:
    WhateverSkill:
      Skills:
      - command{c="scoreboard players set <mob.uuid> forwardOffset 7"}    #Set your forward offset
      - command{c="scoreboard players set <mob.uuid> verticalOffset 3"}    #Set your vertical offset
      - skill{s=RelativeTeleportTarget}    #Effectuate Teleportation
    RelativeTeleportTarget:
      Skills:
      # Calculates Necessary Values
      - skill{s=Calculation_DeltaX}
      - skill{s=Calculation_DeltaZ}
      - skill{s=Calculation_Distance10k}
      # Z
      - command{c="scoreboard players operation <mob.uuid> rottpz = <mob.uuid> zposition"}      #Stores the Delta Z
      - command{c="scoreboard players set <mob.uuid> multiplival 10000"}                        #Multiples times 10000
      - command{c="scoreboard players operation <mob.uuid> rottpz *= <mob.uuid> multiplival"}   #Multiples times 10000
      - command{c="scoreboard players operation <mob.uuid> rottpz *= <mob.uuid> forwardOffset"} #Multiplies it by the Forward Offset
      - command{c="scoreboard players operation <mob.uuid> rottpz /= <mob.uuid> distance"}      #Divides it by the distance
      - command{c="scoreboard players set <mob.uuid> additionval <mob.l.z>"}                    #Adds this mobs's Z position
      - command{c="scoreboard players operation <mob.uuid> rottpz += <mob.uuid> additionval"}   #Adds this mobs's Z position
      # X
      - command{c="scoreboard players operation <mob.uuid> rottpx = <mob.uuid> xposition"}      #Stores the Delta X
      - command{c="scoreboard players set <mob.uuid> multiplival 10000"}                        #Multiples times 10000
      - command{c="scoreboard players operation <mob.uuid> rottpx *= <mob.uuid> multiplival"}   #Multiples times 10000
      - command{c="scoreboard players operation <mob.uuid> rottpx *= <mob.uuid> forwardOffset"} #Multiplies it by the Forward Offset
      - command{c="scoreboard players operation <mob.uuid> rottpx /= <mob.uuid> distance"}      #Divides it by the distance
      - command{c="scoreboard players set <mob.uuid> additionval <mob.l.x>"}                    #Adds this mobs's X position
      - command{c="scoreboard players operation <mob.uuid> rottpx += <mob.uuid> additionval"}   #Adds this mobs's X position
      # Y
      - command{c="scoreboard players operation <mob.uuid> rottpy = <mob.uuid> verticalOffset"} #Stores the Delta Y
      - command{c="scoreboard players set <mob.uuid> additionval <mob.l.y>"}                    #Adds this mobs's Y position
      - command{c="scoreboard players operation <mob.uuid> rottpy += <mob.uuid> additionval"}   #Adds this mobs's Y position
      # Applies
      - command{c="minecraft:tp <target.uuid> <mob.score.rottpx> <mob.score.rottpy> <mob.score.rottpz>"} @Target  #Effectuates Teleportation
    Calculation_Distance10k:
      Skills:
      - command{c="scoreboard players operation <mob.uuid> squaredx = <mob.uuid> xposition"}    #Stores the Delta X
      - command{c="scoreboard players operation <mob.uuid> squaredx *= <mob.uuid> squaredx"}    #Squares it
      - command{c="scoreboard players operation <mob.uuid> squaredz = <mob.uuid> zposition"}    #Stores the Delta Z
      - command{c="scoreboard players operation <mob.uuid> squaredz *= <mob.uuid> squaredz"}    #Squares it
      - command{c="scoreboard players operation <mob.uuid> distance = <mob.uuid> squaredx"}     #Stores the Square of Delta X
      - command{c="scoreboard players operation <mob.uuid> distance += <mob.uuid> squaredz"}    #Adds the Square of Delta Z
      - command{c="scoreboard players set <mob.uuid> multiplival 100000"}                       #Multiples times 10000
      - command{c="scoreboard players operation <mob.uuid> distance *= <mob.uuid> multiplival"} #Multiples times 10000
      - command{c="scoreboard players set <mob.uuid> newtonsy 10000"}                           #Starts Newton's Square Root Approximation Method
      - command{c="scoreboard players operation <mob.uuid> newtonsx = <mob.uuid> distance"}     #Stores the Sum of those Squares
      - command{c="scoreboard players operation <mob.uuid> newtonsydiv = <mob.uuid> newtonsy"}  #Obtains the division y by divinding by 1000
      - command{c="scoreboard players set <mob.uuid> divisionval 1000"}                          #Divides by 1000
      - command{c="scoreboard players operation <mob.uuid> newtonsydiv /= <mob.uuid> divisionval"}#Divides by 1000
      - command{c="scoreboard players operation <mob.uuid> newtonsx /= <mob.uuid> newtonsydiv"} #Divides the X by the division Y
      - command{c="scoreboard players operation <mob.uuid> newtonsy += <mob.uuid> newtonsx"}    #Adds that to the Y
      - command{c="scoreboard players set <mob.uuid> divisionval 2"}                            #Divides by 2
      - command{c="scoreboard players operation <mob.uuid> newtonsy /= <mob.uuid> divisionval"} #Divides by 2
      - command{c="scoreboard players operation <mob.uuid> newtonsx = <mob.uuid> distance"}     #Stores the Sum of those Squares
      - command{c="scoreboard players operation <mob.uuid> newtonsydiv = <mob.uuid> newtonsy"}  #Obtains the division y by divinding by 1000
      - command{c="scoreboard players set <mob.uuid> divisionval 1000"}                          #Divides by 1000
      - command{c="scoreboard players operation <mob.uuid> newtonsydiv /= <mob.uuid> divisionval"}#Divides by 1000
      - command{c="scoreboard players operation <mob.uuid> newtonsx /= <mob.uuid> newtonsydiv"} #Divides the X by the division Y
      - command{c="scoreboard players operation <mob.uuid> newtonsy += <mob.uuid> newtonsx"}    #Adds that to the Y
      - command{c="scoreboard players set <mob.uuid> divisionval 2"}                            #Divides by 2
      - command{c="scoreboard players operation <mob.uuid> newtonsy /= <mob.uuid> divisionval"} #Divides by 2
      - command{c="scoreboard players operation <mob.uuid> newtonsx = <mob.uuid> distance"}     #Stores the Sum of those Squares
      - command{c="scoreboard players operation <mob.uuid> newtonsydiv = <mob.uuid> newtonsy"}  #Obtains the division y by divinding by 1000
      - command{c="scoreboard players set <mob.uuid> divisionval 1000"}                          #Divides by 1000
      - command{c="scoreboard players operation <mob.uuid> newtonsydiv /= <mob.uuid> divisionval"}#Divides by 1000
      - command{c="scoreboard players operation <mob.uuid> newtonsx /= <mob.uuid> newtonsydiv"} #Divides the X by the division Y
      - command{c="scoreboard players operation <mob.uuid> newtonsy += <mob.uuid> newtonsx"}    #Adds that to the Y
      - command{c="scoreboard players set <mob.uuid> divisionval 2"}                            #Divides by 2
      - command{c="scoreboard players operation <mob.uuid> newtonsy /= <mob.uuid> divisionval"} #Divides by 2
      - command{c="scoreboard players operation <mob.uuid> newtonsx = <mob.uuid> distance"}     #Stores the Sum of those Squares
      - command{c="scoreboard players operation <mob.uuid> newtonsydiv = <mob.uuid> newtonsy"}  #Obtains the division y by divinding by 1000
      - command{c="scoreboard players set <mob.uuid> divisionval 1000"}                          #Divides by 1000
      - command{c="scoreboard players operation <mob.uuid> newtonsydiv /= <mob.uuid> divisionval"}#Divides by 1000
      - command{c="scoreboard players operation <mob.uuid> newtonsx /= <mob.uuid> newtonsydiv"} #Divides the X by the division Y
      - command{c="scoreboard players operation <mob.uuid> newtonsy += <mob.uuid> newtonsx"}    #Adds that to the Y
      - command{c="scoreboard players set <mob.uuid> divisionval 2"}                            #Divides by 2
      - command{c="scoreboard players operation <mob.uuid> newtonsy /= <mob.uuid> divisionval"} #Divides by 2
      - command{c="scoreboard players operation <mob.uuid> newtonsx = <mob.uuid> distance"}     #Stores the Sum of those Squares
      - command{c="scoreboard players operation <mob.uuid> newtonsydiv = <mob.uuid> newtonsy"}  #Obtains the division y by divinding by 1000
      - command{c="scoreboard players set <mob.uuid> divisionval 1000"}                          #Divides by 1000
      - command{c="scoreboard players operation <mob.uuid> newtonsydiv /= <mob.uuid> divisionval"}#Divides by 1000
      - command{c="scoreboard players operation <mob.uuid> newtonsx /= <mob.uuid> newtonsydiv"} #Divides the X by the division Y
      - command{c="scoreboard players operation <mob.uuid> newtonsy += <mob.uuid> newtonsx"}    #Adds that to the Y
      - command{c="scoreboard players set <mob.uuid> divisionval 2"}                            #Divides by 2
      - command{c="scoreboard players operation <mob.uuid> newtonsy /= <mob.uuid> divisionval"} #Divides by 2
      - command{c="scoreboard players operation <mob.uuid> distance = <mob.uuid> newtonsy"}     #Stores that Distance
    Calculation_DeltaX:
      Skills:
      - command{c="scoreboard players set <mob.uuid> xposition <mob.l.x>"} @Self                            #Stores self position X
      - command{c="scoreboard players set <target.uuid> xposition <target.l.x>"} @Target                    #Stores target position X
      - command{c="scoreboard players operation <target.uuid> xposition -= <mob.uuid> xposition"} @Target   #Obtains DeltaX (Target - Self)
      - command{c="scoreboard players operation <mob.uuid> xposition = <target.uuid> xposition"} @Target    #Adopts the DeltaX
      - command{c="scoreboard players reset <target.uuid> xposition"} @Target                               #Removes the target from scoreboard
    Calculation_DeltaZ:
      Skills:
      - command{c="scoreboard players set <mob.uuid> zposition <mob.l.z>"} @Self                            #Stores self position Z
      - command{c="scoreboard players set <target.uuid> zposition <target.l.z>"} @Target                    #Stores target position Z
      - command{c="scoreboard players operation <target.uuid> zposition -= <mob.uuid> zposition"} @Target   #Obtains DeltaZ (Target - Self)
      - command{c="scoreboard players operation <mob.uuid> zposition = <target.uuid> zposition"} @Target    #Adopts the DeltaZ
      - command{c="scoreboard players reset <target.uuid> zposition"} @Target                               #Removes the target from scoreboard
     
    #4
  5. Gunging

    Gunging New Member

    Joined:
    Mar 13, 2019
    Messages:
    8
    Likes Received:
    0
    And I wrote all of that myself btw.

    Forgot to mention you need to have these scoreboards (of type dummy) in existance:

    forwardOffset
    verticalOffset
    xposition
    zposition
    squaredz
    squaredx
    distance
    newtonsy
    newtonsx
    newtonsydiv
    rottpz
    rottpy
    rottpx
    multiplival
    divisionval
    additionval
    substracval

    And they said math class was completely useless
     
    #5
  6. Jpegmc

    Jpegmc New Member

    Joined:
    May 3, 2019
    Messages:
    5
    Likes Received:
    1
    Probably because not everyone likes console spam..
     
    #6
  7. Nexto

    Nexto Member

    Joined:
    Dec 3, 2017
    Messages:
    74
    Likes Received:
    8
    you can disable it with a simple gamerule...
     
    #7
  8. Jpegmc

    Jpegmc New Member

    Joined:
    May 3, 2019
    Messages:
    5
    Likes Received:
    1
    I said CONSOLE spam, not chat.
     
    #8
  9. Nexto

    Nexto Member

    Joined:
    Dec 3, 2017
    Messages:
    74
    Likes Received:
    8
    you can still disable CONSOLE spam with a command, heck, its as easy as changing true to false is the yml file
     
    #9

Share This Page