Random entity

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

JustMe003

Member
Oct 30, 2019
2
0
0
37
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:
on break:
  set {_entity} to a random entity out of all entity's
  set {_entity} to a random entity
 
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
 
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


thanks for the example. I will use it in my skript!
 
Status
Not open for further replies.