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 World's spawn location

Discussion in 'Skript' started by salnwar, Dec 24, 2018.

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

    salnwar Member

    Joined:
    Dec 24, 2018
    Messages:
    11
    Likes Received:
    0
    Hello, I've search everywhere on the internet and I don't found how can i get the location of a specific world.

    (if I don't find a solution with armor stand, I would try when a player join the world to generate my schematic)

    My code:
    Code (Skript):
    1. #creating world
    2.  
    3. #teleport entity to my spawn in world "world"
    4. spawn armor stand at {spawnloc}
    5.  
    6. #keep armor stand into a variable
    7. set {_a} to last spawned entity
    8.  
    9. #this is a test to check if tp is working and it's working
    10. #loop all players:
    11. #     teleport loop-player to spawn of "%{_id}%"
    12.  
    13. #teleport the armor stand to spawn location of the world (using Skellett)
    14. teleport {_a} to spawn of "%{_world}%"
    15.  
    16. #define the world's spawn
    17. set {%{_id}%::spawnlocation} to {_a}'s location
    18.      
    19. broadcast "%{%{_id}%::spawnlocation}%"
    20.  
    21. #now i paste my schematic at last spawned entity (armor stand)
    22. sharpsk fawe paste schematic "spawn" at {%{_id}%::spawnlocation}
    23.  
    24. #now I kill the armor stand
    25. kill {_a}
    And I don't have any error in the server's console.

    Thanks for you helping.

    UPDATE:
    It's doesn't work because the chunk have to be loaded.. Now I search how I can do to pre-loaded chunk.

     
    #1 salnwar, Dec 24, 2018
    Last edited: Dec 24, 2018
  2. Best Answer:
    Post #16 by salnwar, Dec 25, 2018
  3. Runakai

    Runakai Well-Known Member

    Joined:
    Apr 27, 2018
    Messages:
    435
    Likes Received:
    25
    • Like Like x 1
  4. TPGamesNL

    Supporter

    Joined:
    Jan 20, 2018
    Messages:
    1,414
    Likes Received:
    89
    Medals:
  5. salnwar

    salnwar Member

    Joined:
    Dec 24, 2018
    Messages:
    11
    Likes Received:
    0
    How I can loop chunks in specific world ?
     
  6. Runakai

    Runakai Well-Known Member

    Joined:
    Apr 27, 2018
    Messages:
    435
    Likes Received:
    25
    Maybe this will work
    Code (Skript):
    1.  
    2.         set {_chunk} to chunk at location of {spawnloc}
    3.         load chunk {_chunk}
     
    • Like Like x 1
  7. salnwar

    salnwar Member

    Joined:
    Dec 24, 2018
    Messages:
    11
    Likes Received:
    0
    Thank you, but I don't know how to get the spawn location of the created world.. I only know how teleport a player on the world's spawn location.
     
  8. Runakai

    Runakai Well-Known Member

    Joined:
    Apr 27, 2018
    Messages:
    435
    Likes Received:
    25
    If you spawn a entity in that created world just set a variable to the location of the entity maybe that will get you the spawn location
     
  9. salnwar

    salnwar Member

    Joined:
    Dec 24, 2018
    Messages:
    11
    Likes Received:
    0
    I have already do that but when i get the entity's location it's not the location in the new world but the location of the main world... This is my problem
     
  10. TPGamesNL

    Supporter

    Joined:
    Jan 20, 2018
    Messages:
    1,414
    Likes Received:
    89
    Medals:
  11. salnwar

    salnwar Member

    Joined:
    Dec 24, 2018
    Messages:
    11
    Likes Received:
    0
    It didn't work, the schematic is not pasted

    Code (Skript):
    1. spawn armor stand at {spawnloc}
    2. set {_a} to last spawned entity
    3. teleport {_a} to spawn of "%{_id}%"
    4. set {%{_id}%::spawnlocation} to {_a}'s location
    5.  
    6. set {_chunk} to chunk at location of {_a}
    7. load chunk {_chunk}
    8.  
    9. sharpsk fawe paste schematic "structure" at {%{_id}%::spawnlocation}
    10. kill {_a}
    EDIT:

    And the
    Code (Skript):
    1. {_a}'s location
    still the same as
    Code (Skript):
    1. {spawnloc}
    --- Double Post Merged, Dec 24, 2018, Original Post Date: Dec 24, 2018 ---
    And now I have this error

    Code (Java):
    1. [18:59:37] [Craft Scheduler Thread - 64/WARN]: [FastAsyncWorldEdit] Plugin FastAsyncWorldEdit v18.12.19-d131fa6-1241-22.0.3 generated an exception while executing task 267java.lang.NullPointerException: null
    2. at me.sharpjaws.sharpSK.hooks.FAWE.EffFAWEPasteSchematic$1.run(EffFAWEPasteSchematic.java:71) ~[?:?]
    3. at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:63) ~[patched_1.12.2.jar:git-Paper-1594]
    4. at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) ~[patched_1.12.2.jar:git-Paper-1594]
    5. at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.12.2.jar:git-Paper-1594]
    6. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_192]
    7. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_192]
    8. at java.lang.Thread.run(Thread.java:813) [?:1.8.0_192]
     
  12. TPGamesNL

    Supporter

    Joined:
    Jan 20, 2018
    Messages:
    1,414
    Likes Received:
    89
    Medals:
    Are you sure the schematic exists?
     
  13. Runakai

    Runakai Well-Known Member

    Joined:
    Apr 27, 2018
    Messages:
    435
    Likes Received:
    25
    Maybe try using this..
    Code (Skript):
    1.  
    2.             set {_world} to {spawnloc}'s world
    3.             set {_x} to x-coordinate of {spawnloc}
    4.             set {_y} to y-coordinate of {spawnloc}
    5.             set {_z} to z-coordinate of {spawnloc}
    6.             set {_loc} to the location at {_x}, {_y}, {_z} of the world {_world}
     
  14. Snow-Pyon

    Moderator Resource Staff

    Joined:
    Jan 25, 2017
    Messages:
    1,234
    Likes Received:
    172
    Medals:
  15. salnwar

    salnwar Member

    Joined:
    Dec 24, 2018
    Messages:
    11
    Likes Received:
    0
    Thanks to you for answer me but, it's doesn't work. If you don't have understand my request: I would like paste a schematic into a world (not the default) and I don't know how I can paste my schematic directly in the spawn location of a specific world. I have try with a entity (armor stand), teleport him to the targeted world spawn and get entity's location to paste my schematic but it didn't work, the entity doesn't been teleported.

    I ask you if you have others solutions for this.
     
  16. Snow-Pyon

    Moderator Resource Staff

    Joined:
    Jan 25, 2017
    Messages:
    1,234
    Likes Received:
    172
    Medals:
    That is as simple as:
    Code (Skript):
    1. sharpsk fawe paste schematic "structure" at spawn of "myworld" # of course, change "structure" to the actual schem name and "myworld" to the world name
     
  17. salnwar

    salnwar Member

    Joined:
    Dec 24, 2018
    Messages:
    11
    Likes Received:
    0
    I decided to using SkStuff's expression to paste my schematic, It's working better. Thanks you to have helping me. I turn the thread to "solved".

    This is my code (for anyone would like to do the same thing):
    Code (Skript):
    1. set {_world} to {_id} parsed as world #{_id} is my string
    2. set {_session} to new edit session in {_world} with limit -1
    3. paste schem "plugins/WorldEdit/schematics/hg_spawn" at spawn of {_world} using {_session}
     
Thread Status:
Not open for further replies.
Loading...