Solved Getting last set 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!

Laserlp

New Member
Aug 4, 2024
7
0
1
15
Hey! I wanted to ask how I can get a block in an expression, that just was set. Sounds weird but if you see the code it should be understandable:

set block below block below player to north facing magenta glazed terracotta
set {Chance.%Last set block%} to arg-2
What comes here? /\
 
#Update
I tried using this:

Set Code
set {MGT} to south facing magenta glazed terracotta
set block below block below player to {MGT}
set {Chance.%{MGT}%} to arg-2

Retrieving part:
loop all blocks in radius 6.5 around player:
if loop-block is magenta glazed terracotta:
set {random.%loop-block%} to random integer between 0 and 100
if {random.%loop-block%} is less than or equal to {Chance.%loop-block%}:
#Event

...
but it still doesn't work because the variable isn't saved in the block. It's saved in the variable and I can't use that.
 
I'm assuming you want the position data saved as well? You could do something like

code_language.skript:
set block below block below player to south facing magenta glazed terracotta
set {_MGT} to block below player
set {Chance.%{_MGT}%} to arg-2

off the top of my head. Its not pretty but for a quick fix it should work.
 
omg, thank you so much! I just couldn't find this on the internet! Marking this as solved...