how do i select a random location?

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

claytyne

Member
May 12, 2020
26
0
1
23
what am i doing wrong here? it doesnt work and sends me <none> every 2 seconds...

Code:
command /ghostsspawnpoint:
    permission: ghostsspawnpoint.c
    trigger:
        add player's location to {_ghostloc::*}
        send "&aAdded!" to player

every 2 seconds:
    if {ggamestarted} is true:
        reset {_gspawn}
        set {_gspawn} to random element out of {_ghostloc::*}
        send "%{_gspawn}%" to all players
        stop
 
1. You are using local variables. That means the variables get deleted after the current event/command.
_ marks a variable as local.
2. You don't need to reset {_gspawn} since it already is nothing.

Code:
command /ghostspawnpoint:
    permission: ghostsspawnpoint.c
    trigger:
        add player's location to {ghostloc::*}
        send "&aAdded!" to player

every 2 seconds:
    if {ggamestarted} is true:
        set {_gspawn} to random element out of {ghostloc::*}
        send "%{_gspawn}%" to all players
        stop
 
1. You are using local variables. That means the variables get deleted after the current event/command.
_ marks a variable as local.
2. You don't need to reset {_gspawn} since it already is nothing.

Code:
command /ghostspawnpoint:
    permission: ghostsspawnpoint.c
    trigger:
        add player's location to {ghostloc::*}
        send "&aAdded!" to player

every 2 seconds:
    if {ggamestarted} is true:
        set {_gspawn} to random element out of {ghostloc::*}
        send "%{_gspawn}%" to all players
        stop
Thanks it works now!
 
Status
Not open for further replies.