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!


    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.

Optimizing Arena Save/Load

Discussion in 'Skript' started by JustAnDev100, May 4, 2020.

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

    JustAnDev100 Member

    Apr 4, 2020
    Likes Received:
    Hello, So I'm trying to make a skript that will save an arena and load it. I need some help though. The first like a minute or two it works fine with 19.98 - 20 tps which is average for my server after a certain amount of time the TPS goes down a lot I mean like to 10TPS I don't want to use addons (At least try to don't use them) And I want it to load (Relatively) Big arena's

    Code (Text):
    1. function saveArena(arena: text):
    2.     set {_speed} to 0
    3.     delete {revertlist.%{_arena}%::*}
    4.     set {_height} to {minh.ww.%{_arena}%}
    5.     loop ({maxh.ww.%{_arena}%} - {minh.ww.%{_arena}%}) times:
    6.         loop all blocks within block at {ww.pos1.%{_arena}%} and block at {ww.pos2.%{_arena}%}:
    7.             y-coord of loop-block is {_height}:
    8.                 add type of loop-block to {revertlist.%{_arena}%::*}
    9.                 add 1 to {_speed}
    10.                 set loop-block to red stained glass
    11.                 if {_speed} is higher than 75:
    12.                     set {_speed} to 0
    13.                     wait 5 tick          
    14.         add 1 to {_height}
    15.         wait 5 seconds
    16.     revertArena("%{_arena}%")
    17. function revertArena(arena: text):
    18.     set {_bla} to 0
    19.     set {_height} to {minh.ww.%{_arena}%}
    20.     loop ({maxh.ww.%{_arena}%} - {minh.ww.%{_arena}%}) times:
    21.         loop all blocks within block at {ww.pos1.%{_arena}%} and block at {ww.pos2.%{_arena}%}:
    22.             y-coord of loop-block is {_height}:
    23.                 add 1 to {_bla}
    24.                 set loop-block to {revertlist.%{_arena}%::%{_bla}%}
    25.                 if {revertlist.%{_arena}%::%{_bla}%} is chest:
    26.                     set slot 0 of loop-block to wooden sword
    27.         add 1 to {_height}
    If i remove the delay's the server would just crash. I already thought about the placements of block im doing in the saveArena part but i dont know how to show the progress in a different way if the block placement is causing the issuse can someone tell me how to display the progress?

    Thanks alot!
    If you can optimize the code / Make it less laggy (Prevent qrazy TPS drops) i will be very happy!

    EDIT: The {ww.pos1.%{_arena}%} are locations also there is a little thingy build in that will fill chest with items when loading arena again
    I want to use this script for Resetting a map.
Thread Status:
Not open for further replies.

Share This Page