Solved Mob spawn skript

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

83y

New Member
Nov 7, 2019
8
0
1
20
Here is my code, read the notes within the skript:
Code:
command /start:
  trigger:
    set {mobs} to 1
    set {time} to 10
    loop all players:
      set {dead::%loop-player%} to false
      while {dead::%loop-player%} is false:
        broadcast "%{time}%"

# rounds divides time by 1.2 and rounds down

        set {time} to floor({time} / 1.2)
        broadcast "%{time}%"

# eg. if input were 10 output would be 8

        set {time} to "%{time}% seconds"

# converts {time} an integer into a string and adds " seconds" onto the end

        broadcast "%{time}%"

# I am aiming to get it so it will eg. wait 8 seconds i've tried putting the integer
# in and adding seconds on at the end but this just gives an error.
# what should I do? plz help.

        wait {time}
        set {_random} to floor({mobs})
        broadcast "%{_random}%"
        if {time} <= 3:
          broadcast "mobs"
          add 0.2 to {mobs}
        else:
          remove 1 from {time}

# the multiplier of how many mobs increase (rounds downwards)

          add 0.2 to {mobs}

        spawn {_random} of creeper above loop-player
 
You have converted `integer` into `string`, but you also have to parse it as `timespan` like so:
Code:
set {time} to "%{time}% seconds" parsed as timespan

So your code became:
Code:
command /start:
  trigger:
    set {mobs} to 1
    set {time} to 10
    loop all players:
      set {dead::%loop-player%} to false
      while {dead::%loop-player%} is false:
        broadcast "%{time}%"
 
# rounds divides time by 1.2 and rounds down
 
        set {time} to floor({time} / 1.2)
        broadcast "%{time}%"
 
# eg. if input were 10 output would be 8
 
        set {time} to "%{time}% seconds" parsed as timespan
 
# converts {time} an integer into a string and adds " seconds" onto the end
 
        broadcast "%{time}%"
 
# I am aiming to get it so it will eg. wait 8 seconds i've tried putting the integer
# in and adding seconds on at the end but this just gives an error.
# what should I do? plz help.
 
        wait {time}
        set {_random} to floor({mobs})
        broadcast "%{_random}%"
        if {time} <= 3:
          broadcast "mobs"
          add 0.2 to {mobs}
        else:
          remove 1 from {time}
 
# the multiplier of how many mobs increase (rounds downwards)
 
          add 0.2 to {mobs}
 
        spawn {_random} of creeper above loop-player
 
  • Like
Reactions: 83y
Status
Not open for further replies.