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.
Thanks @Pikachu.
So, I tried what you suggested but I still get this error:
code_language.skript:
07.10 02:12:17 [Server] ERROR Variables cannot be used here. (scripts.sk, line 13: spawn a bat at location({_randomLocX},{_randomLocY},{_randomLocZ},world)')

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)
  location({_randomlocx}, {_randomlocy}, {_randomlocz}, world("world"))
 
Thanks @Pikachu.
So, I tried what you suggested but I still get this error:
code_language.skript:
07.10 02:12:17 [Server] ERROR Variables cannot be used here. (scripts.sk, line 13: spawn a bat at location({_randomLocX},{_randomLocY},{_randomLocZ},world)')

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)
  location({_randomlocx}, {_randomlocy}, {_randomlocz}, world("world"))
That isn't what i suggested? You didn't replace your thing
 
The weird thing is that I did change it, and I noticed that too. I'll try to save the skript file and reload the file again as it might have been a little issue with my connection, but I am not sure.

Thank you, @Pikachu,
- @LoneElf

EDIT: Ok, so I checked it now, and my code is what you suggested (I did try the other suggestion, but it left me with the same error):
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)
  location({_randomlocx}, {_randomlocy}, {_randomlocz}, world("world"))
 
The weird thing is that I did change it, and I noticed that too. I'll try to save the skript file and reload the file again as it might have been a little issue with my connection, but I am not sure.

Thank you, @Pikachu,
- @LoneElf

EDIT: Ok, so I checked it now, and my code is what you suggested (I did try the other suggestion, but it left me with the same error):
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)
  location({_randomlocx}, {_randomlocy}, {_randomlocz}, world("world"))
You don't put it on a seperate line, you put it in place of your current one.
 
Oh my! I apologize- I did not see that at all. My bad. I will try that soon. Thanks!
[doublepost=1507391622,1507386643][/doublepost]No errors! Thanks @Pikachu! I really appreciate your, and everyone else's help!

Thanks guys!

Best Regards,
- @LoneElf
[doublepost=1507392198][/doublepost]Alright. So, I just tested it and realized that the bats don't spawn. I feel like it has to be something with the locations as there is no error with the bat spawning line.
code_language.skript:
command /pos1:
  trigger:
    set {pos1} to location of player
    message "&7Position&8> &7Position 1 has been set."
 
command /pos2:
  trigger:
    set {pos2} to location of player
    message "&7Position&8> &7Position 2 has been set."

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("world"))

Also, I have this:
code_language.skript:
  event-entity.setCustomNameVisible(true);
  event-entity.setCustomName(event-entity.getItemStack().getItemMeta().getDisplayName() ? "%event-entity.getItemStack()%")
How would I get around setting the event-entity to the spawned bat? I need it to display something like, "&4Halloween Bat." I know how to set the name of the entity, but I don't know how to get the bat so that I can edit it's meta.

Sorry if I don't make sense in the bat displaying a hologram!

Thanks for the help!
- @LoneElf
[doublepost=1507570007][/doublepost]Bump
 
Status
Not open for further replies.