Solved Saving Who Placed What Beacon

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

cserickson

New Member
Sep 30, 2020
5
0
1
17
I am trying to save who placed what beacon for a game. When the beacon is broken the team only has one more life similar to bedwars. I'm a beginner and am sourcing most of my stuff off of the docs but I could not find anything that is like this. I was trying stuff with saving it to variables but I'm not sure how to store the block location and the player that placed it. It also has to be a list variable storing multiple beacons and the players who placed them.
 
on place:
if event-block is a beacon:
set {game.beacon::%event-player%::%location of event-block%} to event-block
 
on place:
if event-block is a beacon:
set {game.beacon::%event-player%::%location of event-block%} to event-block
I see but how could I add multiple different beacons to this one variable and then remove one when it is broken. Sorry for asking so many questions I learned a bit of script about a year ago but forgot just about all of it.

would this work?
Code:
on place:
  if event-block is a beacon:
    add {game.beacon::%event-player%::%location of event-block%} to event-block

on mine:
  if event-block is a beacon:
    remove {game.beacon::%event-player%::%location of event-block%} to event-block
 
I see but how could I add multiple different beacons to this one variable and then remove one when it is broken. Sorry for asking so many questions I learned a bit of script about a year ago but forgot just about all of it.

try this:

Code:
on place:
  if event-block is a beacon:
    add event-block to {game.beacon::%event-player%::%location of event-block%}

on mine:
  if event-block is a beacon:
    remove event-block from {game.beacon::%event-player%::%location of event-block%}
 
try this:

Code:
on place:
  if event-block is a beacon:
    add event-block to {game.beacon::%event-player%::%location of event-block%}

on mine:
  if event-block is a beacon:
    remove event-block from {game.beacon::%event-player%::%location of event-block%}
Thank you! is there any way that I can get the player who placed the beacon so I can send something in chat saying that that player's beacon has been broken?
 
can be:
if event-block is a beacon:
if {game.beacon::%event-player%::*} contains location of event-block:
broadcast "%event-player%, your beacon at %location of event-block% has been broken"
remove event-block from {game.beacon::%event-player%::%location of event-block%}

I have not tested, test and tell me if work.

Wait 1 minute, because I have found the solution for my server code, and I will test the code that I send to you and post the working code here.
[doublepost=1601486353,1601484636][/doublepost]
Code:
on place:
    if event-block is a beacon:
        add location of event-block to {game.beacon::%event-player%::*}
 
on mine:
    if event-block is a beacon:
        loop all players:
            if {game.beacon::%loop-player%::*} contains location of event-block:
                broadcast "The beacon of %loop-player% has been broken by %event-player%"
                remove location of event-block from {game.beacon::%loop-player%::*}

Tested and working, sorry about the first code that I type.
[doublepost=1601486410][/doublepost]Anything else ?
 
can be:
if event-block is a beacon:
if {game.beacon::%event-player%::*} contains location of event-block:
broadcast "%event-player%, your beacon at %location of event-block% has been broken"
remove event-block from {game.beacon::%event-player%::%location of event-block%}

I have not tested, test and tell me if work.
can be:
if event-block is a beacon:
if {game.beacon::%event-player%::*} contains location of event-block:
broadcast "%event-player%, your beacon at %location of event-block% has been broken"
remove event-block from {game.beacon::%event-player%::%location of event-block%}

I have not tested, test and tell me if work.

Wait 1 minute, because I have found the solution for my server code, and I will test the code that I send to you and post the working code here.
Ok, I have tested this code and it does not seem to work but I don't get any errors when reloading.
can be:
if event-block is a beacon:
if {game.beacon::%event-player%::*} contains location of event-block:
broadcast "%event-player%, your beacon at %location of event-block% has been broken"
remove event-block from {game.beacon::%event-player%::%location of event-block%}

I have not tested, test and tell me if work.

Wait 1 minute, because I have found the solution for my server code, and I will test the code that I send to you and post the working code here.
[doublepost=1601486353,1601484636][/doublepost]
Code:
on place:
    if event-block is a beacon:
        add location of event-block to {game.beacon::%event-player%::*}
 
on mine:
    if event-block is a beacon:
        loop all players:
            if {game.beacon::%loop-player%::*} contains location of event-block:
                broadcast "The beacon of %loop-player% has been broken by %event-player%"
                remove location of event-block from {game.beacon::%loop-player%::*}

Tested and working, sorry about the first code that I type.
[doublepost=1601486410][/doublepost]Anything else ?
Thank you so much I think that is all I need help with right now.
 
Code:
on place:
    if event-block is a beacon:
        add location of event-block to {game.beacon::%event-player%::*}
 
on mine:
    if event-block is a beacon:
        loop all players:
            if {game.beacon::%loop-player%::*} contains location of event-block:
                broadcast "The beacon of %loop-player% has been broken by %event-player%"
                remove location of event-block from {game.beacon::%loop-player%::*}

Do you mean that you have tested this code, and it's not working ?
 
Code:
on place:
    if event-block is a beacon:
        add location of event-block to {game.beacon::%event-player%::*}
 
on mine:
    if event-block is a beacon:
        loop all players:
            if {game.beacon::%loop-player%::*} contains location of event-block:
                broadcast "The beacon of %loop-player% has been broken by %event-player%"
                remove location of event-block from {game.beacon::%loop-player%::*}

Do you mean that you have tested this code, and it's not working ?
No no it is working great Thank you!
 
Status
Not open for further replies.