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!

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

Solved I need help in random spawns

Discussion in 'Requests' started by christianmv84, Dec 21, 2017.

  1. christianmv84

    christianmv84 Active Member

    Jul 20, 2017
    Likes Received:
    Well I will explain a little what I want to do:

    I want to do a skript of uhcmetup, and I want that when entering, because each person appears in a different place, that is to say each person spawne in the map of 100x100 but in a different place, never that 2 players spawnen in a same place thanks!

  2. Best Answer:
    Post #3 by Selvati, Dec 23, 2017
  3. FUZIK

    FUZIK Active Member

    Jan 26, 2017
    Likes Received:
    Code (Skript):
    1. function getUhcmetupLocation(locations:Locations,radius:Integer=27,best_players_count:Integer=100) :: Location:
    2.     loop {_locations::*}:
    3.         if amount of (all players in radius {_radius} around loop-value) = 0:
    4.             return loop-value
    5.         else if amount of (all players in radius {_radius} around loop-value) < {_best_players_count}:
    6.             set {_return} to loop-value
    7.             set {_best_players_count} to amount of (all players in radius {_radius} around loop-value)
    8.     #if {_return} isn't set:
    9.       #  return {_locations::1}
    10.     return {_return}
  4. Selvati

    Selvati Active Member

    Jun 26, 2017
    Likes Received:
    I found this code online from a Spigot skript post that's free to download, you could change some things and repurpose it to your wishes.

    Code (Skript):
    1. options:
    2.     min.x: -250
    3.     max.x: 250
    4.     min.z: -250
    5.     max.z: 250
    6.     avoid: air or water block or lava block or stone block or sandstone block or mossy cobblestone block or dirt block
    7.     perm: cmd.wild
    8.     cooldown: 10 seconds #Change to whatever you like such as "1 minute" "2 hours" "1 day" "30 seconds"
    11. Command /wild:
    12.     permission: {@perm}
    13.     trigger:
    14.         set {_waited} to difference between {wild.%player%.lastused} and now
    15.         if {_waited} is less than {@cooldown}:
    16.             message "&c(!) &4You must wait %difference between {@cooldown} and {_waited}% before using this command again."
    17.             stop
    19.         send "&c(!) &eTeleporting to the wild. &e&l{Expect Some &4&lMinor &e&lLag}" to player
    20.         wait 1 tick
    21.         send "&c(!) &eTeleporting in 3 Seconds."
    22.         wait 1 second
    23.         send "&c(!) &eTeleporting in 2 Seconds."
    24.         wait 1 second
    25.         send "&c(!) &eTeleporting in 1 Second."
    26.         wait 2 second
    27.         apply resistance 100 to player for 6 seconds
    28.         wait 1 tick
    29.         set {_loc::old} to player's location
    30.         while player's location is {_loc::old}:
    31.             set {_loc::new} to location at random number between {@min.x} and {@max.x}, 0, random number between {@min.z} and {@max.z}
    32.             loop blocks above {_loc::new}:
    33.                 if loop-block and block above loop-block are air:
    34.                     if block under loop-block is not {@avoid}:
    35.                         set {_loc::new} to location of loop-block
    36.                         teleport player to {_loc::new}
    37.                         stop loop
    38.                         wait 10 ticks
    39.         set {wild.%player%.lastused} to now
    You could make the uhc core skript I assume you're using to automatically make all players execute the /wild command on the start of the game or build it into the 'on game start' code area, best of luck,

Share This Page