Increase amount of bats being spawned

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

LoneElf

Active Member
Apr 30, 2017
165
2
18
24
Hey - How would I increase the amount of bats that get spawned? Thanks :emoji_wink:
 
But how do I increase the chance of one naturally spawning because I can't remember the last time I saw a bat naturally spawn.

Thanks for the reply, @Donut!

Best Regards,
- @LoneElf
 
But how do I increase the chance of one naturally spawning because I can't remember the last time I saw a bat naturally spawn.

Thanks for the reply, @Donut!

Best Regards,
- @LoneElf
I dont think you can change the spawn rate but you could spawn 1 bat or how ever many you want when certain mobs spawn (maybe add a chance for them to spawn?)
 
Could I do something like: every 10 seconds in world: spawn a bat?

Also, how would I make it so the bat only spawns in the area of the KitPvP Map, not out of it?

Thanks,
- @LoneElf
 
Could I do something like: every 10 seconds in world: spawn a bat?

Also, how would I make it so the bat only spawns in the area of the KitPvP Map, not out of it?

Thanks,
- @LoneElf
Yeah i guess that would work, although instead of periodical its supposedly better to use a while loop when the server starts and have it wait 10 seconds.

make a command or something to set the corners of the map then pick a random location between those to points
 
Ok! Thanks for the reply! I will try it out soon!

Thank you,
- @LoneElf
make a command or something to set the corners of the map then pick a random location between those to points

Ok. I understand the concept of that (how it works), but I don't know how to actually do it. I know what you mean when you say that, it is just I have no clue on how to skript it.

Thanks,
- @LoneElf
 
I assume you know how to set the locations so get a random number between loc 1's x-coord and loc 2's x-coord. Repeat for y and z coord then get the location at that x y z and spawns the bat there
 
get a random number between loc 1's x-coord and loc 2's x-coord. Repeat for y and z coord then get the location at that x y z
How do you get the x and y coord if you have set the location to a variable?

Thanks,
- @LoneElf
 
Alright - I have this:
code_language.skript:
  set {_randomLocX} to a random number between {pos1}'s x-coord and {pos2}'s x-coord
  set {_randomLocY} to a random number between {pos1}'s y-coord and {pos2}'s y-coord
  set {_randomLocZ} to a random number between {pos1}'s z-coord and {pos2}'s z-coord
  set {_randomLocSet} to
code_language.skript:
command /pos1:
  trigger:
    set {pos1} to location of player

command /pos2:
  trigger:
    set {pos2} to location of player

How do I finish it off to get the final point (setting a variable to a location with the {_randomLoc} variables.)

Thanks :emoji_slight_smile:
 
I forget the exact syntax so just look at the docs but its something like “location at x y z in world” or there’s also a built in function to get a location from the points, but again, I forget the exact function so look at the docs
 
Alright. So, I tried that, and it says that I can't use variables in the replacement of the x, y, and z. Here is my code:
code_language.skript:
command /pos1:
  trigger:
    set {pos1} to location of player
 
command /pos2:
  trigger:
    set {pos2} to location of player

every 2 seconds in "world":
  set {_randomLocX} to a random number between {pos1}'s x-coord and {pos2}'s x-coord
  set {_randomLocY} to a random number between {pos1}'s y-coord and {pos2}'s y-coord
  set {_randomLocZ} to a random number between {pos1}'s z-coord and {pos2}'s z-coord
  spawn a bat at location of {_randomLocX} {_randomLocY} {_randomLocZ} in "world"

Here is my error:
code_language.skript:
06.10 03:10:26 [Server] ERROR Variables cannot be used here. (scripts.sk, line 13: spawn a bat at location of {_randomLocX} {_randomLocY} {_randomLocZ} in "world"')

Thank you,
- @LoneElf
 
Alright. So, I tried that, and it says that I can't use variables in the replacement of the x, y, and z. Here is my code:
code_language.skript:
command /pos1:
  trigger:
    set {pos1} to location of player
 
command /pos2:
  trigger:
    set {pos2} to location of player

every 2 seconds in "world":
  set {_randomLocX} to a random number between {pos1}'s x-coord and {pos2}'s x-coord
  set {_randomLocY} to a random number between {pos1}'s y-coord and {pos2}'s y-coord
  set {_randomLocZ} to a random number between {pos1}'s z-coord and {pos2}'s z-coord
  spawn a bat at location of {_randomLocX} {_randomLocY} {_randomLocZ} in "world"

Here is my error:
code_language.skript:
06.10 03:10:26 [Server] ERROR Variables cannot be used here. (scripts.sk, line 13: spawn a bat at location of {_randomLocX} {_randomLocY} {_randomLocZ} in "world"')

Thank you,
- @LoneElf
Im pretty sure you just need commas
 
Here is my error:
code_language.skript:
06.10 23:04:55 [Server] ERROR There's no location in a periodical event (scripts.sk, line 13: spawn a bat at location of {_randomLocX}, {_randomLocY}, {_randomLocZ} in world')

Here is my code:
code_language.skript:
command /pos1:
  trigger:
    set {pos1} to location of player
 
command /pos2:
  trigger:
    set {pos2} to location of player
 
every 2 seconds in "world":
  set {_randomLocX} to a random number between {pos1}'s x-coord and {pos2}'s x-coord
  set {_randomLocY} to a random number between {pos1}'s y-coord and {pos2}'s y-coord
  set {_randomLocZ} to a random number between {pos1}'s z-coord and {pos2}'s z-coord
  spawn a bat at location of {_randomLocX}, {_randomLocY}, {_randomLocZ} in world

Thank you!
- @LoneElf
 
Here is my error:
code_language.skript:
06.10 23:04:55 [Server] ERROR There's no location in a periodical event (scripts.sk, line 13: spawn a bat at location of {_randomLocX}, {_randomLocY}, {_randomLocZ} in world')

Here is my code:
code_language.skript:
command /pos1:
  trigger:
    set {pos1} to location of player
 
command /pos2:
  trigger:
    set {pos2} to location of player
 
every 2 seconds in "world":
  set {_randomLocX} to a random number between {pos1}'s x-coord and {pos2}'s x-coord
  set {_randomLocY} to a random number between {pos1}'s y-coord and {pos2}'s y-coord
  set {_randomLocZ} to a random number between {pos1}'s z-coord and {pos2}'s z-coord
  spawn a bat at location of {_randomLocX}, {_randomLocY}, {_randomLocZ} in world

Thank you!
- @LoneElf
The location function is the better version of the expression
location(x,y,z,world)
 
Alright. So, @Pikachu, I did the location(x,y,z,world) thing, and it said that variables could not be used there (replaced x y z with the variables above, and kept the world.)

Thanks,
- @LoneElf
 
Sorry about that. Here is the code:
code_language.skript:
command /pos1:
  trigger:
    set {pos1} to location of player
 
command /pos2:
  trigger:
    set {pos2} to location of player

every 2 seconds in "world":
  set {_randomLocX} to a random number between {pos1}'s x-coord and {pos2}'s x-coord
  set {_randomLocY} to a random number between {pos1}'s y-coord and {pos2}'s y-coord
  set {_randomLocZ} to a random number between {pos1}'s z-coord and {pos2}'s z-coord
  spawn a bat at location({_randomLocX},{_randomLocY},{_randomLocZ},world)

Here is the error:
code_language.skript:
07.10 00:47:16 [Server] ERROR Variables cannot be used here. (scripts.sk, line 13: spawn a bat at location({_randomLocX},{_randomLocY},{_randomLocZ},world)')

Thank you!
- @LoneElf
 
Sorry about that. Here is the code:
code_language.skript:
command /pos1:
  trigger:
    set {pos1} to location of player
 
command /pos2:
  trigger:
    set {pos2} to location of player

every 2 seconds in "world":
  set {_randomLocX} to a random number between {pos1}'s x-coord and {pos2}'s x-coord
  set {_randomLocY} to a random number between {pos1}'s y-coord and {pos2}'s y-coord
  set {_randomLocZ} to a random number between {pos1}'s z-coord and {pos2}'s z-coord
  spawn a bat at location({_randomLocX},{_randomLocY},{_randomLocZ},world)

Here is the error:
code_language.skript:
07.10 00:47:16 [Server] ERROR Variables cannot be used here. (scripts.sk, line 13: spawn a bat at location({_randomLocX},{_randomLocY},{_randomLocZ},world)')

Thank you!
- @LoneElf
Try location({_randomlocx}, {_randomlocy}, {_randomlocz}, event-world) or location({_randomlocx}, {_randomlocy}, {_randomlocz}, world("world"))
 
Status
Not open for further replies.