Loop blocks in front of the player?

  • 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.

Hyao

Active Member
Apr 1, 2017
73
4
8
33
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:
loop all blocks in front of the player:

Doesn't work.
Code:
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
 
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
 
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
can you also loop players in front of player in radius 8 of front not around? and subtract 100 from {life.%loop-player%} ??
 
Oh like a cone?

If yes, check out this amazing solution by Jordan:
https://forums.skunity.com/threads/loop-all-entities-blocks-in-a-cone.2919/#post-7636
code_language.skript:
on leftclick:
    set {_Block} to 0
    Set {_Cone} to 0
    loop 6 times:
        add 1 to {_Block}
        add 2 to {_Cone}
        set {_GetBlock} to block {_Block} blocks infront of player
        loop all blocks in radius {_Cone} around {_GetBlock}:
            if loop-block is flower pot:
                broadcast "Flower pot found at: %location of block at loop-block%"
Now can I set {_block} to players in front and how?
 
code_language.skript:
on leftclick:
    set {_Block} to 0
    Set {_Cone} to 0
    loop 6 times:
        add 1 to {_Block}
        add 2 to {_Cone}
        set {_GetBlock} to block {_Block} blocks infront of player
        loop all blocks in radius {_Cone} around {_GetBlock}:
            if loop-block is flower pot:
                broadcast "Flower pot found at: %location of block at loop-block%"
Now can I set {_block} to players in front and how?
Code:
on leftclick:
    set {_Block} to 0
    Set {_Cone} to 0
    loop 6 times:
        add 1 to {_Block}
        add 2 to {_Cone}
        set {_GetBlock} to block {_Block} blocks infront of player
        loop all players in radius {_Cone} around {_GetBlock}:
            #something something damage
 
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
There's a limit in the config, it's like 100 or something by default
[doublepost=1502573429,1502573394][/doublepost]
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:
loop all blocks in front of the player:

Doesn't work.
Code:
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
code_language.skript:
blocks in front of player
 
Status
Not open for further replies.