#Setting Block to a location variable

1 messages · Page 1 of 1 (latest)

hollow ocean
#

How do I set block at a variable location? Here's my skript:

    trigger:
        loop all blocks in radius 200 around player:
            if loop-block is a snow block:
                set {spleefregeneration} to location of loop-blocks
                set block at {spleefregeneration} to snow block```

This skript doesnt seem to place the blocks and it's my first time trying stuff like this out.
wide blaze
#

Make it a list

#

Add event location to the list

hollow ocean
#

k

wide blaze
#

And add the locations to block

hollow ocean
wide blaze
#

Loop it

#

loop {spleefregeneration::}:
set block at loop-value to snow block
clear {spleefregeneration::
}

hollow ocean
wide blaze
#

Show error

hollow ocean
wide blaze
#

Show me the whole code rq

hollow ocean
#
    trigger:
        loop all blocks in radius 200 around player:
            if loop-block is a snow block:
                wait 5 seconds
                set {spleefregeneration::*} to location of loop-blocks
                loop {spleefregeneration::*}:
                    set block at loop-value-2 to snow block
wide blaze
#

Change set to add

#

Wait

hollow ocean
#

Then the previous coordinates will still be there.

wide blaze
#

Clear the list

#

Or use {_example::*}

#

_ in front of it

#

Add location of loop-block to {spleefregeneration::*}

#
    trigger:
        loop all blocks in radius 200 around player:
            if loop-block is a snow block:
                add location of loop-block to {spleefregeneration::*}
             loop {spleefregeneration::*}:
                 set block at loop-value-2 to snow block
             clear spleefregeneration::*}
#

Also u are looping for snow blocks, and setting them to snow blocks?

wide blaze
hollow ocean
#

It doesn't quite work, I think the error may be around "Loop all blocks in radius 200 around player" I think I could have executed that one better.

wide blaze
#

I edited the message

#

Now it should work

hollow ocean
hollow ocean
#

Does anyone know any quicker way to do this, because it keeps lagging when it loops every block. Is there a way to at least reduce lag?

tribal fjord
#

I mean your looping in a 200 block area around the player

#

Of course it will lag

#

I’m not entire surely how you could really fix this, maybe waiting a little but what is your like main goal bc there might be a better way

drifting wagon
#

ur adding then looping then clearing?

#

tf is the point of using a list then?

drifting wagon
#

means it's not running on the main cpu core so tps wont drop as much

wide blaze
#

I just edited his skript

#

Im not gonna make a brand new skript for him

hollow ocean
drifting wagon
#

ch@tgp1t ahh helper

#

from knoz guy

wide blaze
#

Avg discord cosmetic buyer

#

Fatass

drifting wagon
#

not discord just nitro

drifting wagon
hollow ocean
drifting wagon
drifting wagon
#

one for adding the location list

#

and one for placing the snow blocks

drifting wagon
wide blaze
#

Still yapping holy

#

Okay u go spoonfeed for everyone then

#

Mr godskripter

drifting wagon
#

u not helping is better than giving shit code

#

thats prob how u code for ur server ngl

wide blaze
#

Lmao it was 1 am and i was on phone

drifting wagon
#

did u find it

wide blaze
#

Idh time to make him anything thats the best i couldve done

drifting wagon
#

but did u find it

wraith warren
#

you should use a filter and set it directly in a list for better performance:

set {yourlist::*} to blocks in radius %number% of %location% where [input is %your block type here%]

then you can simply set the blocks at the list:

set blocks at {yourlist::*} to %your blocktype here%
ancient basin
hollow ocean
#

because I think it only adds their names

wraith warren
#

tested myself and it works fine
the block type includes all block data, including its location and blocktype
the blockdata type will only include the block type (it’s name)
you could optimize it to only store the block location, but it really wouldn’t make much of a difference (iirc you could just change it to location of blocks instead of just blocks but i can’t verify)

hollow ocean
#

It reloaded properly, but it didnt set the blocks

eternal estuary
wraith warren
hollow ocean
#
    permission: op
    trigger:
        set {spleefregeneration::*} to blocks in radius 50 of player where [input is "snow block"]
        set blocks at {spleefregeneration::*} to oak planks```
This is the skript and it doesn't seem to be working.
#

Are you on a different version or something?

wraith warren
#

don't stringify snow block
it should be a blockdata type

- "snow block"
+ snow block