How to spawn a player at a certain location? not teleporting

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

Tinkot

Active Member
Feb 10, 2018
57
1
0
27
Is it possible to spawn a player at a certain location with the `on join` event?

i am currently teleporting them but it would be better if i can spawn them instead of teleporting.

code_language.skript:
         on join:
            teleport player to {hubspawn.%{spawnselector}%}
            if {spawnselector} is 9:
                set {spawnselector} to 1
            else:
                add 1 to {spawnselector}
 
they spawn and then get teleported. its glitchy and feels unnecessarily. teleporting them with the on quit event won't be an option since they need to spawn in a specific location depending on other events.
[doublepost=1525978906,1525978588][/doublepost]well i actually can use on quit but i'm just wondering if its possible. when a player logs in i see this
code_language.skript:
logged in with entity id 970749 at ([spawn]673.5, 109.0, 894.5)
We can't just change this location somehow?
 
cool idea. But it can't be set to a location for some reason. I dont know what latter means, empty is the world-name
Schermafbeelding_2018_05_10_om_21_38_32.png
 
so i tried this:
code_language.skript:
command /setspawn:
    trigger:
        set {spawn} to location of player

on join:
    set the spawn point of "world" to {spawn}
The problem is, the player spawns where they logged out

I then added in "teleport player to spawn" .... which Im starting to think is the only viable option.
I noticed when i logged in, i was at the spawn point. I didn't visually SEE any other place or the actual teleportation event, i was JUST THERE.
 
oh yes i can try that. if this is before the world is send over to the player than it would work perfectly
[doublepost=1526081142,1526080845][/doublepost]Tested it and its not teleporting them at all using on connect. The strange thing is that i can still give them items using this event. I tried it with 1 tick delay and that worked but its still the same. other players can still see the teleportation going on
[doublepost=1526246573][/doublepost]okay i just found out how it works. you need teleport the players using the on quit event. its the only method i can think of. So i made this little manager that teleports the player to a random spot out of 9 spots when they quit. and when my minigames teleport them it will act like normal. Maybe there is another method that deletes all playerdata (entity id and logout location) so the server thinks the players logs in for the first time. that could work but it wil probably mess with some other plugins. however, this works now


code_language.skript:
on script load:
    set {spawnselector} to 1

on quit:
    teleport player to {hubspawn.%random integer between 1 and 9%}

on join:
    clear player's inventory
    set slot 0 of the player to a clock named "&a&lGameMode Selector"
    set slot 1 of the player to a slimeball named "&c&lSpectate Players"
    execute console command "/ScoreBoard on %player%"
#spawn command. Executed by games (not players)
command /tpspawn [<offlineplayer>]:
    trigger:
        if arg is online:
            clear arg's inventory
            set slot 0 of the arg-1 to a clock named "&a&lGameMode Selector"
            set slot 1 of the arg-1 to a slimeball named "&c&lSpectate Players"
            teleport arg-1 to {hubspawn.%{spawnselector}%}
            execute console command "/ScoreBoard on %arg-1%"
            if {spawnselector} is 9:
                set {spawnselector} to 1
            else:
                add 1 to {spawnselector}
 
Status
Not open for further replies.