1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Saving Who Placed What Beacon

Discussion in 'Skript' started by cserickson, Sep 30, 2020.

Thread Status:
Not open for further replies.
  1. cserickson

    cserickson New Member

    Joined:
    Sep 30, 2020
    Messages:
    5
    Likes Received:
    0
    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.
     
  2. Skoll

    Skoll Active Member

    Joined:
    Sep 2, 2020
    Messages:
    60
    Likes Received:
    5
    on place:
    if event-block is a beacon:
    set {game.beacon::%event-player%::%location of event-block%} to event-block
     
  3. cserickson

    cserickson New Member

    Joined:
    Sep 30, 2020
    Messages:
    5
    Likes Received:
    0
    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 (Text):
    1. on place:
    2.   if event-block is a beacon:
    3.     add {game.beacon::%event-player%::%location of event-block%} to event-block
    4.  
    5. on mine:
    6.   if event-block is a beacon:
    7.     remove {game.beacon::%event-player%::%location of event-block%} to event-block
     
  4. Skoll

    Skoll Active Member

    Joined:
    Sep 2, 2020
    Messages:
    60
    Likes Received:
    5
    try this:

    Code (Text):
    1. on place:
    2.   if event-block is a beacon:
    3.     add event-block to {game.beacon::%event-player%::%location of event-block%}
    4.  
    5. on mine:
    6.   if event-block is a beacon:
    7.     remove event-block from {game.beacon::%event-player%::%location of event-block%}
     
  5. cserickson

    cserickson New Member

    Joined:
    Sep 30, 2020
    Messages:
    5
    Likes Received:
    0
    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?
     
  6. Skoll

    Skoll Active Member

    Joined:
    Sep 2, 2020
    Messages:
    60
    Likes Received:
    5
    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.
    --- Double Post Merged, Sep 30, 2020, Original Post Date: Sep 30, 2020 ---
    Code (Text):
    1. on place:
    2.     if event-block is a beacon:
    3.         add location of event-block to {game.beacon::%event-player%::*}
    4.  
    5. on mine:
    6.     if event-block is a beacon:
    7.         loop all players:
    8.             if {game.beacon::%loop-player%::*} contains location of event-block:
    9.                 broadcast "The beacon of %loop-player% has been broken by %event-player%"
    10.                 remove location of event-block from {game.beacon::%loop-player%::*}
    Tested and working, sorry about the first code that I type.
    --- Double Post Merged, Sep 30, 2020 ---
    Anything else ?
     
  7. cserickson

    cserickson New Member

    Joined:
    Sep 30, 2020
    Messages:
    5
    Likes Received:
    0
    Ok, I have tested this code and it does not seem to work but I don't get any errors when reloading.
    Thank you so much I think that is all I need help with right now.
     
  8. Skoll

    Skoll Active Member

    Joined:
    Sep 2, 2020
    Messages:
    60
    Likes Received:
    5
    Code (Text):
    1. on place:
    2.     if event-block is a beacon:
    3.         add location of event-block to {game.beacon::%event-player%::*}
    4.  
    5. on mine:
    6.     if event-block is a beacon:
    7.         loop all players:
    8.             if {game.beacon::%loop-player%::*} contains location of event-block:
    9.                 broadcast "The beacon of %loop-player% has been broken by %event-player%"
    10.                 remove location of event-block from {game.beacon::%loop-player%::*}
    Do you mean that you have tested this code, and it's not working ?
     
  9. cserickson

    cserickson New Member

    Joined:
    Sep 30, 2020
    Messages:
    5
    Likes Received:
    0
    No no it is working great Thank you!
     
  10. Skoll

    Skoll Active Member

    Joined:
    Sep 2, 2020
    Messages:
    60
    Likes Received:
    5
    Ah, ok, you're welcome.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...