Solved Spawning a mob near a player

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

pepper82

Member
Jan 26, 2017
272
1
18
41
Hey all,

I am looking for a performance-friendly way of spawning a zombie within a specific range of a player via command.
Basically I want to check for a location where a zombie can spawn (e.g. to spawn a zombie there must be 2 air blocks etc.).

How would you do this?
 
code_language.skript:
command /test:
    trigger:
        loop blocks in radius whatever around player:
            if loop-block is air:
                if block above loop-block is air:
                    add loop-block's location to {_locs::*}
        set {_loc} to random element of {_locs::*}
        spawn a zombie at {_loc}
 
  • Like
Reactions: Ofir1999
Status
Not open for further replies.