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.

Custom mob spawning in chunk

Discussion in 'Skript' started by McAcrylic, Jul 7, 2018.

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

    McAcrylic Active Member

    Joined:
    Oct 21, 2017
    Messages:
    59
    Likes Received:
    0
    As the name suggests, I am looking for a system to custom mobs in a chunk. However, I have tried various methods, mostly resulting in server crashes, or straight up inefficient. I have looked through the forums for help, but nothing that matches my needs. This isn't a full request but I am asking how it should be done, better still, include the code.
     
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    I guess it depends on what you are trying to accomplish.
    For example you could do

    Code (Skript):
    1. on chunk load:
    2.     loop blocks within event-chunk:
    3.         if loop-block is grass:
    4.             add location of loop-block to {_spawning::*}
    5.     set {_spawn} to random element of {_spawning::*}
    6.     spawn zombie at location 1 above {_spawn}
    This may not be the most efficient way to do it, but It works.
    You could change the conditions for how you want mobs to spawn.
    For example, after dark... a chance.... which mobs, etc
     
  3. McAcrylic

    McAcrylic Active Member

    Joined:
    Oct 21, 2017
    Messages:
    59
    Likes Received:
    0
    Thanks for your help, I have not tested it, and I would assume what you have done would not crash the server.
     
    • Funny Funny x 1
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    I tested it with spawning giants (so i could see them as i flew around the world) and I had a lot of giants spawning.
    Then I tested it with something like 10 sheep per chunk, LOTS OF SHEEP.... it didnt CRASH the server but definitely slowed it down, but thats a lot of sheep so no surprise
     
  5. McAcrylic

    McAcrylic Active Member

    Joined:
    Oct 21, 2017
    Messages:
    59
    Likes Received:
    0
    Ye, I would assume so, and I did checked it out. However, I had to get a new system to do custom spawning.
    It is basically a scanning system, whereby it checks the block x distance from player, detecting the chunk and the custom variable defined to that chunk to spawn a particular mob.

    To simplify, it scans through nearby chunks which has a custom variable set to it to have a certain mob spawn at that location.

    I want to hear from you if you feel this is an efficient method or not. But thank you for your suggestion!
     
  6. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    225
    Im not 100% sure if that would be efficient or not. I personally have never dealt with mob spawning before in a manner like this.
    It always comes down to your event, how often you are checking and loop these blocks and chunks and how many players you have on, doing these things.
     
    • Like Like x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...