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

Increase amount of bats being spawned

Discussion in 'Skript' started by LoneElf, Oct 1, 2017.

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

    LoneElf Well-Known Member

    Joined:
    Apr 30, 2017
    Messages:
    164
    Likes Received:
    2
    Hey - How would I increase the amount of bats that get spawned? Thanks :emoji_wink:

     
  2. Best Answer:
    Post #20 by Pikachu, Oct 7, 2017
  3. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    on natural spawn of a bat spawn another bat
     
  4. LoneElf

    LoneElf Well-Known Member

    Joined:
    Apr 30, 2017
    Messages:
    164
    Likes Received:
    2
    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
     
  5. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    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?)
     
  6. LoneElf

    LoneElf Well-Known Member

    Joined:
    Apr 30, 2017
    Messages:
    164
    Likes Received:
    2
    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
     
  7. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    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
     
  8. LoneElf

    LoneElf Well-Known Member

    Joined:
    Apr 30, 2017
    Messages:
    164
    Likes Received:
    2
    Ok! Thanks for the reply! I will try it out soon!

    Thank you,
    - @LoneElf
    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
     
  9. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    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
     
  10. LoneElf

    LoneElf Well-Known Member

    Joined:
    Apr 30, 2017
    Messages:
    164
    Likes Received:
    2
    How do you get the x and y coord if you have set the location to a variable?

    Thanks,
    - @LoneElf
     
  11. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    {loc}'s x-coord
     
  12. LoneElf

    LoneElf Well-Known Member

    Joined:
    Apr 30, 2017
    Messages:
    164
    Likes Received:
    2
    Alright - I have this:
    Code (Skript):
    1.  
    2.   set {_randomLocX} to a random number between {pos1}'s x-coord and {pos2}'s x-coord
    3.   set {_randomLocY} to a random number between {pos1}'s y-coord and {pos2}'s y-coord
    4.   set {_randomLocZ} to a random number between {pos1}'s z-coord and {pos2}'s z-coord
    5.   set {_randomLocSet} to
    Code (Skript):
    1. command /pos1:
    2.   trigger:
    3.     set {pos1} to location of player
    4.  
    5. command /pos2:
    6.   trigger:
    7.     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:
     
  13. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    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
     
  14. LoneElf

    LoneElf Well-Known Member

    Joined:
    Apr 30, 2017
    Messages:
    164
    Likes Received:
    2
    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 (Skript):
    1. command /pos1:
    2.   trigger:
    3.     set {pos1} to location of player
    4.  
    5. command /pos2:
    6.   trigger:
    7.     set {pos2} to location of player
    8.  
    9. every 2 seconds in "world":
    10.   set {_randomLocX} to a random number between {pos1}'s x-coord and {pos2}'s x-coord
    11.   set {_randomLocY} to a random number between {pos1}'s y-coord and {pos2}'s y-coord
    12.   set {_randomLocZ} to a random number between {pos1}'s z-coord and {pos2}'s z-coord
    13.   spawn a bat at location of {_randomLocX} {_randomLocY} {_randomLocZ} in "world"
    Here is my error:
    Code (Skript):
    1. 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
     
  15. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    Im pretty sure you just need commas
     
  16. LoneElf

    LoneElf Well-Known Member

    Joined:
    Apr 30, 2017
    Messages:
    164
    Likes Received:
    2
    Here is my error:
    Code (Skript):
    1. 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 (Skript):
    1. command /pos1:
    2.   trigger:
    3.     set {pos1} to location of player
    4.  
    5. command /pos2:
    6.   trigger:
    7.     set {pos2} to location of player
    8.  
    9. every 2 seconds in "world":
    10.   set {_randomLocX} to a random number between {pos1}'s x-coord and {pos2}'s x-coord
    11.   set {_randomLocY} to a random number between {pos1}'s y-coord and {pos2}'s y-coord
    12.   set {_randomLocZ} to a random number between {pos1}'s z-coord and {pos2}'s z-coord
    13.   spawn a bat at location of {_randomLocX}, {_randomLocY}, {_randomLocZ} in world
    Thank you!
    - @LoneElf
     
  17. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    The location function is the better version of the expression
    location(x,y,z,world)
     
  18. LoneElf

    LoneElf Well-Known Member

    Joined:
    Apr 30, 2017
    Messages:
    164
    Likes Received:
    2
    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
     
  19. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    The script would probably be more helpful that describing it
     
  20. LoneElf

    LoneElf Well-Known Member

    Joined:
    Apr 30, 2017
    Messages:
    164
    Likes Received:
    2
    Sorry about that. Here is the code:
    Code (Skript):
    1. command /pos1:
    2.   trigger:
    3.     set {pos1} to location of player
    4.  
    5. command /pos2:
    6.   trigger:
    7.     set {pos2} to location of player
    8.  
    9. every 2 seconds in "world":
    10.   set {_randomLocX} to a random number between {pos1}'s x-coord and {pos2}'s x-coord
    11.   set {_randomLocY} to a random number between {pos1}'s y-coord and {pos2}'s y-coord
    12.   set {_randomLocZ} to a random number between {pos1}'s z-coord and {pos2}'s z-coord
    13.   spawn a bat at location({_randomLocX},{_randomLocY},{_randomLocZ},world)
    Here is the error:
    Code (Skript):
    1. 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
     
  21. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    125
    Medals:
    Try location({_randomlocx}, {_randomlocy}, {_randomlocz}, event-world) or location({_randomlocx}, {_randomlocy}, {_randomlocz}, world("world"))
     
Thread Status:
Not open for further replies.
Loading...