Solved Loop all entities/blocks in a cone

  • 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
I'm trying to revamp the attack system in Minecraft by giving it a float. I want it so that every time a player left clicks, it sends out a cone-loop in front of the player, checking for entities and/or blocks. By blocks, specifically, I mean flower pots:emoji_wink:.

What I'm looking for is something like this: (How can this be done? If it's even possible?)
yBUNDhn.png
 
It is possible, you should start with this:
code_language.skript:
Loop all blocks in the direction of the player:
    If loop-block is a flower pot:
And than add a deflection to the right and left (idk exactly what this would be in the skript language)
 
It is possible, you should start with this:
code_language.skript:
Loop all blocks in the direction of the player:
    If loop-block is a flower pot:
And than add a deflection to the right and left (idk exactly what this would be in the skript language)

Yeah, the 'deflection' is what I asked for. I wouldn't ask if I knew what I was doing, at least to some extent.
 
I'd imagine, You'd use a while loop of some sort? And you'd set a variable to the block infront and loop round that black and then increase it everytime? I guess not to sure.

I wrote this pretty quick and with not much thought but i guess this is the general idea?

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%"
 
I'd imagine, You'd use a while loop of some sort? And you'd set a variable to the block infront and loop round that black and then increase it everytime? I guess not to sure.

I wrote this pretty quick and with not much thought but i guess this is the general idea?

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%"

Holy moly! That's genius! I haven't tested it, but I'm 97.5% sure this'll be exactly what I'm looking for.
 
I'd imagine, You'd use a while loop of some sort? And you'd set a variable to the block infront and loop round that black and then increase it everytime? I guess not to sure.

I wrote this pretty quick and with not much thought but i guess this is the general idea?

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%"
I also thought about something like that but you will come across the problem that it loop around the block so in a circle not in a horizontal line what will cause "Flower pot found at: %location of block at loop-block%" being broadcasted multiple times.
 
I also thought about something like that but you will come across the problem that it loop around the block so in a circle not in a horizontal line what will cause "Flower pot found at: %location of block at loop-block%" being broadcasted multiple times.

Thanks for the reply, but you're a bit late. I know how to make a failsafe :emoji_wink:
 
Status
Not open for further replies.