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 community!
Now, what are you waiting for? Join the community now!
You can always check out skUnity Downloads for downloads and any other information about Skript!
command /setspawn <integer>:
trigger:
set {spawnpoint::%arg-1%} to player's location
command /spawn:
trigger:
loop {spawnpoint::*}:
chance of 25%:
#do smth
I mean random spawn locations. Like without /spawn when u die u just respawn random in one of those random 4 locationsCode:command /setspawn <integer>: trigger: set {spawnpoint::%arg-1%} to player's location command /spawn: trigger: loop {spawnpoint::*}: chance of 25%: #do smth
on respawn:
set {_location} to a random integer between 1 and 4
teleport player to {spawnpoint::%{_location}%}
Also how do I set the 4 locations to spawn ? Like how do I set the coords of the 4 spawn locationsCode:on respawn: set {_location} to a random integer between 1 and 4 teleport player to {spawnpoint::%{_location}%}
command /setspawn:
trigger:
add event-player's location to {spawnpoint::*}
command /unsetspawn:
trigger:
loop indexes of {spawnpoint::*}:
if distance between event-player's location and {spawnpoint::%loop-value%} < 2:
remove {spawnpoint::%loop-value%} from {spawnpoint::*}
command /unsetallspawn:
trigger:
clear {spawnpoint::*}
on respawn:
teleport event-player to a random location out of {spawnpoint::*}
But I need something that when someone dies, he will have to press on something in a gui, then respawn in one of the 4 coordinates that I set.probably a better way of doing it would be to use:
that way you can set as many spawns as you want, and remove them if needed. or even reset them all with unsetallspawnCode:command /setspawn: trigger: add event-player's location to {spawnpoint::*} command /unsetspawn: trigger: loop indexes of {spawnpoint::*}: if distance between event-player's location and {spawnpoint::%loop-value%} < 2: remove {spawnpoint::%loop-value%} from {spawnpoint::*} command /unsetallspawn: trigger: clear {spawnpoint::*} on respawn: teleport event-player to a random location out of {spawnpoint::*}
might want to add some permissions so that not every player can set and unset your spawns.
Yes but how do I set the coords where to respawn ?U already asked for a respawn gui in another thread.
probably a better way of doing it would be to use:
that way you can set as many spawns as you want, and remove them if needed. or even reset them all with unsetallspawnCode:command /setspawn: trigger: add event-player's location to {spawnpoint::*} command /unsetspawn: trigger: loop indexes of {spawnpoint::*}: if distance between event-player's location and {spawnpoint::%loop-value%} < 2: remove {spawnpoint::%loop-value%} from {spawnpoint::*} command /unsetallspawn: trigger: clear {spawnpoint::*} on respawn: teleport event-player to a random location out of {spawnpoint::*}
might want to add some permissions so that not every player can set and unset your spawns.
Yes but how do I set the coords where to respawn
Wait I am stupid. Very stupid. I just realisedhave you read the script?
with my script you can just use /setspawn to add it,
/unsetspawn to remove all spawnpoints within 2 blocks, and /unsetallspawn to remove all spawnpoints.
with his code you had to do /setspawn <1-4> to set the spawn with index number 1-4 (you would have to take both his code snippets)
almost pressed the agree button on your comment.Wait I am stupid. Very stupid. I just realised
There is still a problem. I am not respawning to any of them. I did /setspawn 1,2,3,4 in different locations.almost pressed the agree button on your comment.
this post should be marked as solved.
Also is there any way to add the respawn into a gui ? Like when u respawn u see a button in the gui to press and respawn to one of the random locations. I need that with the sleeping bag. To count in that respawn gui when u have placed a sleeping bag and also a button for the respawn in one of those random locationsThere is still a problem. I am not respawning to any of them. I did /setspawn 1,2,3,4 in different locations.
Yes, it works. I couldn't see the gui of the sleeping bag because of another respawn gui. Thank you so much for the sleeping bag. But there is a problem. I am not respawning random even that I set the /setspawn 1,2,3,4maybe use my code and try that?
Please upload your entire code
command /setspawn:
trigger:
add event-player's location to {spawnpoint::*}
command /unsetspawn:
trigger:
loop indexes of {spawnpoint::*}:
if distance between event-player's location and {spawnpoint::%loop-value%} < 2:
remove {spawnpoint::%loop-value%} from {spawnpoint::*}
command /unsetallspawn:
trigger:
clear {spawnpoint::*}
on respawn:
teleport event-player to a random location out of {spawnpoint::*}
command /setspawn:
trigger:
add location of player to {spawnpoint::*}
command /unsetspawn:
trigger:
loop indexes of {spawnpoint::*}:
if distance between player's location and {spawnpoint::%loop-value%} < 2:
remove {spawnpoint::%loop-value%} from {spawnpoint::*}
command /unsetallspawn:
trigger:
clear {spawnpoint::*}
on respawn:
teleport player to a random location out of {spawnpoint::*}
on respawn:
wait 0.5 seconds
teleport player to a random location out of {spawnpoint::*}