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

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Interactive Kinetic Intelligence 1.0

Discussion in 'Other' started by Avaplays, Apr 23, 2018.

  1. Avaplays

    Avaplays Member

    Joined:
    Jan 29, 2017
    Messages:
    23
    Likes Received:
    2
    A virtual kinetic intelligence armor stand;
    Version: 1.0
    • Walk
    • No walk trough blocks
    • Can go up- downstair

    Code (Skript):
    1. every 10 ticks:
    2.     loop all armor stands:
    3.         if loop-entity's name contains "IKI":
    4.             set {IKI::ID::%loop-entity's name%} to "%loop-entity's name%"
    5.             replace all "IKI\" with "" in {IKI::ID::%loop-entity's name%}
    6.             add "1" and "2" to {_d::%{IKI::ID::%loop-entity's name%}%::*}
    7.             set {_d::%{IKI::ID::%loop-entity's name%}%} to a random element out of {_d::%{IKI::ID::%loop-entity's name%}%::*}
    8.             set {_l::%{IKI::ID::%loop-entity's name%}%} to location of loop-entity
    9.             if block in front of loop-entity's head is air:
    10.                 add "x" and "z" to {_di::%{IKI::ID::%loop-entity's name%}%::*}
    11.                 set {_di::%{IKI::ID::%loop-entity's name%}%} to a random element out of {_di::%{IKI::ID::%loop-entity's name%}%::*}
    12.                 if {_di::%{IKI::ID::%loop-entity's name%}%} is "x":
    13.                     set {_l::%{IKI::ID::%loop-entity's name%}%} to location of loop-entity
    14.                     if {_d::%{IKI::ID::%loop-entity's name%}%} is "1":
    15.                         add "{Rotation:[90f,90f]}" to nbt of loop-entity
    16.                         add -1 to x-coordinate of {_l::%{IKI::ID::%loop-entity's name%}%}
    17.                     else:
    18.                         add "{Rotation:[-90f,-90f]}" to nbt of loop-entity
    19.                         add 1 to x-coordinate of {_l::%{IKI::ID::%loop-entity's name%}%}
    20.                     if block at {_l::%{IKI::ID::%loop-entity's name%}%} is air:
    21.                         teleport loop-entity to {_l::%{IKI::ID::%loop-entity's name%}%}
    22.                     else:
    23.                         set {_l2::%{IKI::ID::%loop-entity's name%}%} to location of block above {_l::%{IKI::ID::%loop-entity's name%}%}
    24.                         if block at {_l2::%{IKI::ID::%loop-entity's name%}%} is air:
    25.                             set {_l3::%{IKI::ID::%loop-entity's name%}%} to location of block above {_l2::%{IKI::ID::%loop-entity's name%}%}
    26.                             if block at {_l3::%{IKI::ID::%loop-entity's name%}%} is air:
    27.                                 teleport loop-entity to {_l2::%{IKI::ID::%loop-entity's name%}%}
    28.                 else if {_di::%{IKI::ID::%loop-entity's name%}%} is "z":
    29.                     set {_lz::%{IKI::ID::%loop-entity's name%}%} to location of loop-entity
    30.                     if {_dz::%{IKI::ID::%loop-entity's name%}%} is "1":
    31.                         add "{Rotation:[0f,0f]}" to nbt of loop-entity
    32.                         add -1 to z-coordinate of {_lz::%{IKI::ID::%loop-entity's name%}%}
    33.                     else:
    34.                         add "{Rotation:[360f,360f]}" to nbt of loop-entity
    35.                         add 1 to z-coordinate of {_lz::%{IKI::ID::%loop-entity's name%}%}
    36.                     if block at {_lz::%{IKI::ID::%loop-entity's name%}%} is air:
    37.                         teleport loop-entity to {_lz::%{IKI::ID::%loop-entity's name%}%}
    38.                     else:
    39.                         set {_lz2::%{IKI::ID::%loop-entity's name%}%} to location of block above {_lz::%{IKI::ID::%loop-entity's name%}%}
    40.                         if block at {_lz2::%{IKI::ID::%loop-entity's name%}%} is air:
    41.                             set {_lz3::%{IKI::ID::%loop-entity's name%}%} to location of block above {_lz2::%{IKI::ID::%loop-entity's name%}%}
    42.                             if block at {_lz3::%{IKI::ID::%loop-entity's name%}%} is air:
    43.                                 teleport loop-entity to {_lz2::%{IKI::ID::%loop-entity's name%}%}
    44.                
    45. on right click:
    46.     if target block is not air:
    47.         if distance between target block and player is less than 5:
    48.             if player's tool is armor stand:
    49.                 if name of player's tool is "§bKinetic Intelligence":
    50.                     if lore of player's tool contains "1":
    51.                         cancel event
    52.                         set {_location} to location of event-block
    53.                         spawn armor stand at location 1 above {_location}
    54.                         set {_skull} to "%player's name%" parsed as offline player
    55.                         add "{Invisible:0,Invulnerable:0,ShowArms:1,Small:0,NoBasePlate:1,NoGravity:0,ArmorItems:[{},{},{},{}],Pose:{Head:[0f,0f,0f]}}" to nbt of last spawned armor stand
    56.                         set last spawned armor stand's helmet to {_skull}'s skull
    57.                         set last spawned armor stand's tool to diamond pickaxe
    58.                         set last spawned armor stand's chestplate to diamond chestplate
    59.                         set last spawned armor stand's leggings to diamond leggings
    60.                         set last spawned armor stand's boots to diamond boots
    61.                         set {_KIID} to "%random integer between 10 and 99%\%random integer between 100 and 999%\%random integer between 10 and 99%\%random integer between 0 and 9%"
    62.                         set last spawned armor stand's name to "IKI\%{_KIID}%"
    63.                         send "§bInteractive Kinetic Intelligence §7placed."
    64.                     else:
    65.                         cancel event
    66.                         set {_location} to location of event-block
    67.                         spawn armor stand at location 1 above {_location}
    68.                         set {_skull} to "%player's name%" parsed as offline player
    69.                         add "{Invisible:0,Invulnerable:0,ShowArms:1,Small:0,NoBasePlate:1,NoGravity:0,ArmorItems:[{},{},{},{}],Pose:{Head:[0f,0f,0f]}}" to nbt of last spawned armor stand
    70.                         set last spawned armor stand's helmet to {_skull}'s skull
    71.                         set last spawned armor stand's tool to diamond pickaxe
    72.                         set last spawned armor stand's chestplate to diamond chestplate
    73.                         set last spawned armor stand's leggings to diamond leggings
    74.                         set last spawned armor stand's boots to diamond boots
    75.                         set {_KIID} to "%random integer between 10 and 99%\%random integer between 100 and 999%\%random integer between 10 and 99%\%random integer between 0 and 9%"
    76.                         set last spawned armor stand's name to "KI\%{_KIID}%"
    77.                         send "§bKinetic Intelligence §7placed."
    78.            
    79. command kinetic [<text>] [<text>]:
    80.     permission: kinetic.*
    81.     trigger:
    82.         if arg-1 is set:
    83.             if arg-1 is "info":
    84.                 loop all armor stands:
    85.                     if loop-entity's name contains "KI\":
    86.                         send "%loop-entity's name%: %direction of loop-entity%"
    87.                         send "%loop-entity's name%: %facing of loop-entity%"
    88.                         send "%loop-entity's name%: %loop-entity's location%"
    89.                         send "%loop-entity's name%: %loop-entity's target block%"
    90.                         send "%loop-entity's name%: %block in front of loop-entity%"
    91.                         send "%loop-entity's name%: %block facing of loop-entity%"
    92.             else if arg-1 is "rotate":
    93.                 if arg-2 is "0", "-30", "30", "-60", "60", "-90", "90", "180" or "360":
    94.                     loop all armor stands:
    95.                         if loop-entity's name contains "KI\":
    96.                             add "{Rotation:[%arg-2%f,%arg-2%f]}" to nbt of loop-entity
    97.             else if arg-1 is "walkx":
    98.                 loop all armor stands:
    99.                     if loop-entity's name contains "KI\":
    100.                         add "1" and "2" to {_d::*}
    101.                         set {_d} to a random element out of {_d::*}
    102.                         set {_b} to a random integer between 10 and 100
    103.                         loop {_b} times:
    104.                             set {_l} to location of loop-entity
    105.                             if block in front of loop-entity's head is air:
    106.                                 wait 3 ticks
    107.                                 add "{Rotation:[-90f,-90f]}" to nbt of loop-entity
    108.                                 add "t" and "f" to {_x::*}
    109.                                 set {_x} to a random element out of {_x::*}
    110.                                 if {_x} is "t":
    111.                                     set {_l} to location of loop-entity
    112.                                     if {_d} is "1":
    113.                                         add "{Rotation:[90f,90f]}" to nbt of loop-entity
    114.                                         add -1 to x-coordinate of {_l}
    115.                                     else:
    116.                                         add "{Rotation:[-90f,-90f]}" to nbt of loop-entity
    117.                                         add 1 to x-coordinate of {_l}
    118.                                     if block at {_l} is air:
    119.                                         teleport loop-entity to {_l}
    120.                                     else:
    121.                                         set {_l2} to location of block above {_l}
    122.                                         if block at {_l2} is air:
    123.                                             set {_l3} to location of block above {_l2}
    124.                                             if block at {_l3} is air:
    125.                                                 teleport loop-entity to {_l2}
    126.             else if arg-1 is "walkz":
    127.                 loop all armor stands:
    128.                     if loop-entity's name contains "KI\":
    129.                         add "1" and "2" to {_d::*}
    130.                         set {_d} to a random element out of {_d::*}
    131.                         set {_b} to a random integer between 10 and 100
    132.                         loop {_b} times:
    133.                             set {_l} to location of loop-entity
    134.                             if block in front of loop-entity's head is air:
    135.                                 wait 3 ticks
    136.                                 add "{Rotation:[180f,180f]}" to nbt of loop-entity
    137.                                 add "t" and "f" to {_z::*}
    138.                                 set {_z} to a random element out of {_z::*}
    139.                                 if {_z} is "t":
    140.                                     if {_d} is "1":
    141.                                         add "{Rotation:[360f,360f]}" to nbt of loop-entity
    142.                                         add -1 to z-coordinate of {_l}
    143.                                     else:
    144.                                         add "{Rotation:[180f,180f]}" to nbt of loop-entity
    145.                                         add 1 to z-coordinate of {_l}
    146.                                     if block at {_l} is air:
    147.                                         teleport loop-entity to {_l}
    148.                                     else:
    149.                                         set {_l2} to location of block above {_l}
    150.                                         if block at {_l2} is air:
    151.                                             set {_l3} to location of block above {_l2}
    152.                                             if block at {_l3} is air:
    153.                                                 teleport loop-entity to {_l2}
    154.         else:
    155.             open chest with 1 row named "Kinetic" to player
    156.             wait a tick
    157.             set slot 0 of current inventory of player to armor stand with hidden enchantment named "§bKinetic Intelligence" with lore "§7Version: §b0"
    158.             set slot 1 of current inventory of player to armor stand with hidden enchantment named "§bKinetic Intelligence" with lore "§7Version: §b1"
     

Share This Page

Loading...