How do I check if a block..

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

HonestlyPanda

Member
May 19, 2021
38
0
6
23
Hey, I'm trying to make a block-throwing skript... Only problem is, you can place it in the air... How would I constantly check if the block under {_loc} is not air??? Heres my code:
Code:
on right click:
    {block.%player%} is true
    player's tool is a block
    set {_return} to player's tool
    remove 1 of {_return} from player
    make player swing their main hand
    summon armor stand at player
    set {_block} to last spawned armor stand
    add "{Invisible:1b}" to nbt of {_block}
    add "{Small:1b}" to nbt of {_block}
    set {_block}'s helmet to {_return}
    set {_block}'s yaw to player's yaw
    push {_block} up at speed 0.2
    push {_block} forward at speed 1
    wait 1 seconds
    set {_loc} to {_block}'s location
    kill {_block}   
    set the block at {_loc} to {_return}
    
command /bthrow:
    trigger:
        if {block.%player%} is not set:
            set {block.%player%} to true
            send "&aBlock Throw: ON"
        else if {block.%player%} is false:
            set {block.%player%} to true
            send "&aBlock Throw: ON"
        else if {block.%player%} is true:
            set {block.%player%} to false
            send "&cBlock Throw: OFF"
            
on place:
    {block.%player%} is true
    cancel event
[doublepost=1649788409,1649705612][/doublepost]anyone...?
 
Hey, I'm trying to make a block-throwing skript... Only problem is, you can place it in the air... How would I constantly check if the block under {_loc} is not air??? Heres my code:
Code:
on right click:
    {block.%player%} is true
    player's tool is a block
    set {_return} to player's tool
    remove 1 of {_return} from player
    make player swing their main hand
    summon armor stand at player
    set {_block} to last spawned armor stand
    add "{Invisible:1b}" to nbt of {_block}
    add "{Small:1b}" to nbt of {_block}
    set {_block}'s helmet to {_return}
    set {_block}'s yaw to player's yaw
    push {_block} up at speed 0.2
    push {_block} forward at speed 1
    wait 1 seconds
    set {_loc} to {_block}'s location
    kill {_block}  
    set the block at {_loc} to {_return}
   
command /bthrow:
    trigger:
        if {block.%player%} is not set:
            set {block.%player%} to true
            send "&aBlock Throw: ON"
        else if {block.%player%} is false:
            set {block.%player%} to true
            send "&aBlock Throw: ON"
        else if {block.%player%} is true:
            set {block.%player%} to false
            send "&cBlock Throw: OFF"
           
on place:
    {block.%player%} is true
    cancel event
[doublepost=1649788409,1649705612][/doublepost]anyone...?
Using a while loop and make sure to use a delay or the server will crash
 
ohhhhh so like i would do
Code:
while condition:
    block under {_block} is not air
    wait a tick
    #do block placing stuff
or something else im new(ish) to skript sry
 
ohhhhh so like i would do
Code:
while condition:
    block under {_block} is not air
    wait a tick
    #do block placing stuff
or something else im new(ish) to skript sry
yes a condition for example can be while {something} is true
 
code doesnt work...
Code:
on right click:
    {block.%player%} is true
    player's tool is a block
    set {_return} to player's tool
    remove 1 of {_return} from player
    make player swing their main hand
    summon armor stand at player
    set {_block} to last spawned armor stand
    add "{Invisible:1b}" to nbt of {_block}
    add "{Small:1b}" to nbt of {_block}
    set {_block}'s helmet to {_return}
    set {_block}'s yaw to player's yaw
    push {_block} up at speed 0.2
    push {_block} forward at speed 1
    while condition:
        block under {_block} is not air
        wait a tick
        set block at {_block} to {_return}
it says "cant understand this condition/effect"
 
code doesnt work...
Code:
on right click:
    {block.%player%} is true
    player's tool is a block
    set {_return} to player's tool
    remove 1 of {_return} from player
    make player swing their main hand
    summon armor stand at player
    set {_block} to last spawned armor stand
    add "{Invisible:1b}" to nbt of {_block}
    add "{Small:1b}" to nbt of {_block}
    set {_block}'s helmet to {_return}
    set {_block}'s yaw to player's yaw
    push {_block} up at speed 0.2
    push {_block} forward at speed 1
    while condition:
        block under {_block} is not air
        wait a tick
        set block at {_block} to {_return}
it says "cant understand this condition/effect"
Code:
        while block under {_block} is not air:
            wait a tick
            set block at {_block} to {_return}
 
Status
Not open for further replies.