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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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

Loop blocks in front of the player?

Discussion in 'Skript' started by Hyao, Jul 28, 2017.

Thread Status:
Not open for further replies.
  1. Hyao

    Hyao Active Member

    Joined:
    Apr 1, 2017
    Messages:
    73
    Likes Received:
    4
    Using Bensku's fork for mc 1.12 and unsure which addons this uses, but downloaded them all from "resources" yesterday.

    My problem is simple, really,
    Code (Text):
    1. loop all blocks in front of the player:
    Doesn't work.
    Code (Text):
    1. loop all blocks in direction of the player:
    doesn't work either. Does anyone know why this might be? Am I doing something wrong in the syntax? It returns the error "Can't understand this loop: (code)".

    Thanks in advance,
    Hyao
     
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    216
    You probably wouldn't want to do that anyways or else wouldn't it loop indefinitely?

    You could get the block x meters in front of the player than loop the blocks from the player's loc to the block's loc
     
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    216
    there's a limit
     
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    216
    can you also loop players in front of player in radius 8 of front not around? and subtract 100 from {life.%loop-player%} ??
     
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    216
    Not quite what I'm looking for.
     
  6. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    216
    That what I am looking ;V how can I do that sorry for muy bad english men
     
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    216
  8. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    216
    Code (Skript):
    1. on leftclick:
    2.     set {_Block} to 0
    3.     Set {_Cone} to 0
    4.     loop 6 times:
    5.         add 1 to {_Block}
    6.         add 2 to {_Cone}
    7.         set {_GetBlock} to block {_Block} blocks infront of player
    8.         loop all blocks in radius {_Cone} around {_GetBlock}:
    9.             if loop-block is flower pot:
    10.                 broadcast "Flower pot found at: %location of block at loop-block%"
    Now can I set {_block} to players in front and how?
     
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    216
    Code (Text):
    1. on leftclick:
    2.     set {_Block} to 0
    3.     Set {_Cone} to 0
    4.     loop 6 times:
    5.         add 1 to {_Block}
    6.         add 2 to {_Cone}
    7.         set {_GetBlock} to block {_Block} blocks infront of player
    8.         loop all players in radius {_Cone} around {_GetBlock}:
    9.             #something something damage
     
    • Winner Winner x 1
  10. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    216
    There's a limit in the config, it's like 100 or something by default
    --- Double Post Merged, Aug 12, 2017, Original Post Date: Aug 12, 2017 ---
    Code (Skript):
    1. blocks in front of player
     
Thread Status:
Not open for further replies.

Share This Page

Loading...