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.

Random entity

Discussion in 'Skript' started by JustMe003, Oct 31, 2019.

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

    JustMe003 Member

    Joined:
    Oct 30, 2019
    Messages:
    2
    Likes Received:
    0
    I don't know if it's possible, but can you spawn a random entity when someone breaks a block? This code won't work:
    Code (Text):
    1. on break:
    2.   set {_entity} to a random entity out of all entity's
    3.   set {_entity} to a random entity
     
  2. BowYard

    BowYard Member

    Joined:
    Nov 2, 2017
    Messages:
    45
    Likes Received:
    0
    You can't generate something from nowhere, if you want to set a variable to a random entity you have first to add all the types of entity you want to a list.
    after done this you have to set the variable to a random object out of the list and parse it as entity type.

    Example:

    add "zombie" to {list::*}
    add "skeleton" to {list::*}
    set {_entity} to a random object out of {list::*}
    spawn ({_entity} parsed as entity type) at player's location
     
  3. JustMe003

    JustMe003 Member

    Joined:
    Oct 30, 2019
    Messages:
    2
    Likes Received:
    0

    thanks for the example. I will use it in my skript!
     
  4. BowYard

    BowYard Member

    Joined:
    Nov 2, 2017
    Messages:
    45
    Likes Received:
    0
    you're welcome!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...