loop all players:
broadcast "%{beacon::%loop-player's uuid%}%"
if {beacon::%loop-player's uuid%} contains location of event-block:
broadcast "%{beacon::%loop-player's uuid%}%"
broadcast "{@prefix} &8›&f The beacon of &3%loop-player%&f was broken by &3%event-player%!"
loop all blocks in radius 20 around {beacon::%loop-player's uuid%}:
if loop-block is a cracked stone bricks:
set {_d} to string tag "custom;OwnerD" of nbt compound of loop-block
if {_d} is uuid of loop-player:
set loop-block to air
delete {beacon::%loop-player's uuid%}
#not working when offline
1 messages · Page 1 of 1 (latest)
so what im trying to do is
if players beacon gets broken while he is offline it should break normally but it doesn't
even tho it broadcasts the variable
your code doesn't work because its looping all online players
you should probably do it with a block list instead of looping all players
you can add the beacon to a list (set its index to the player's uuid) and loop that list (loop-value is the player's beacon, uuid is the player and it'll always work when they are offline)
so it will only work when they are offline??
can i get an example??
there's one in your other post
no, for looping offline players
loop all offline players?
https://tryitands.ee
(but also read the last message in the post for a better alternative)
i tried looping all offline players but it didnt work
like just to try i removed the loop all player and tried it and didnt work

btw what does he mean with a “list”
also thats not what your supposed to be doing
a list is a group of objects
i know
in this
list variable
how can i add the beacon to a list does he mean a variable or something
what i have understood here is making a list variable like this
{list::beacon::%player’s uuid%}
this is already a list, {beacon::*}
does he mean loop {beacon::%player’s uuid%::*}
here
you have the right idea, but the * is one less
.
ohh
so {beacon::*}
loop {beacon::*}
so by doing this i hope it works
thanks let me try
i have a question
okay wait
do i loop all players or not?
@orchid knoll (sorry for the ping)
just loop the list?
okay how do i get the player thats beacon broken and the player who broke it
do i just do %player% and %event-player%
a list is not an event
it would be loop-value

okay
loop {beacon::*}:
broadcast "%{beacon::%loop-value's uuid%}%"
if {beacon::%loop-value's uuid%} contains location of event-block:
broadcast "%{beacon::%loop-value's uuid%}%"
broadcast "{@prefix} &8›&f The beacon of &3%loop-value%&f was broken by &3%event-player%!"
loop all blocks in radius 20 around {beacon::%loop-value's uuid%}:
if loop-block is a cracked stone bricks:
set {_d} to string tag "custom;OwnerD" of nbt compound of loop-block
if {_d} is uuid of loop-value-1:
set loop-block to air
if loop-block is a stone bricks:
delete {beacon::%loop-value's uuid%}
...and what's the issue with this code
the loop-value is not the player
the index is the player's uuid
the value is whatever you set the variable to
oh right
i mean
when u place a beacon its set to beacon::%player's uuid%
so do i use just loop-value
like
{beacon::%loop-value%}
set {list::index} to "value"
index = the index
"value" = the value for {list::index}
set {beacon::%loop-value%} to uuid of player
aha
okay
so i will set the list::index to loop-value which is {beacon::*}
wait whats the loop value of it let me broadcast
Ohhh
i get itt
the loop value is the location of it
@harsh orchid im sorry for the ping so i broadcasted the loop-value it showed this and from what im seeing, its all of the locations of beacons in the server?
i dont get it setting the location of the beacon to the loop-value which is all of the locations
what you need is a list of beacons in the server, and the index of the list is the loop-player's uuid (so you can easily loop the list and get the player's beacon)
because it is broadcasting all the locations of the beacons, it looks fine (although i would set the value to the block itself and not the location of the block)
try broadcasting the indices of the list and see if it shows your uuid (if it does, then you probably did it correctly)
so for the index it gave me the uuid of player's and for value of it, it gave me location of event block
yay good job! your almost done
now you can loop the list, get the uuid of the player, and do whatever you want to their beacon (even if they are offline)
ah so i would do
set {_b} to loop-index?
or if i want the location of it
ohhh
i get it
loop {beacon::*}:
set {_p} to loop-index
if {beacon::%{_p}%} contains location of event-block:
broadcast "{@prefix} &8›&f The beacon of &3%{_p}%&f was broken by &3%event-player%!"
loop all blocks in radius 20 around {beacon::%{_p}%}:
i did this
is that okay?
it works!
yay good job
you can use loop-value instead of {beacon::%{_p}%} inside your loop btw