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.

Amount of entities in chunk or near player

Discussion in 'Skript' started by bebeli555, Apr 28, 2020.

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

    bebeli555 Member

    Joined:
    Feb 6, 2020
    Messages:
    28
    Likes Received:
    0
    So anyone know is it possible to like get all entities or specific type of entites in chunk and store it into a variable or like get the amount of entities in radius of 20 of player? im trying to make a thing that would stop people from spamming so many minecarts into 1 spot so if i can get the amount of minecarts or all entities in chunk i could do that
     
  2. Abdera7mane

    Abdera7mane Active Member

    Joined:
    Aug 18, 2019
    Messages:
    56
    Likes Received:
    7
    Code (Text):
    1. set {_list::*} to all entites where [input's chunk is {_chunk}]
    change this condition so it does what you want
    Code (Text):
    1. input's chunk is {_chunk}
    input: is the entity which is being checked after executing this effect
    {_chunk}: is a local variable that holds a chunk type, you can replace it by an expression depends on what are you trying to do.
    {_list::*} is a local list that will holds all entites that matches specific conditions we determine earlier.
     
    • Like Like x 1
  3. bebeli555

    bebeli555 Member

    Joined:
    Feb 6, 2020
    Messages:
    28
    Likes Received:
    0
    Yeah thanks i came up with this yesterday to limit max entities in chunk

    Code (Text):
    1. on vehicle create:
    2.     loop all entities:
    3.         if size of entities in chunk of event-entity >= 65:
    4.             cancel event
     
  4. Abdera7mane

    Abdera7mane Active Member

    Joined:
    Aug 18, 2019
    Messages:
    56
    Likes Received:
    7
    why looping through all entities ? you don't need that
     
Thread Status:
Not open for further replies.

Share This Page

Loading...