Skript Time Doesn't Work

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

Rebel100

Member
Sep 17, 2020
12
0
1
24
Basically I'm trying to write a plugin with skript that every minutes spawns 50 of a random monster at the location of all players. However, I also want the mobs to not despawn so im trying to give them a nametag and that kind of works. The biggest problem that im running into is that time is not working everytime I try to do something time based it says "error cannot understand that condition". BTW I am kind of new to skript so I might be making a stupid mistake.

Skript Version: 2.4
Skript Author: Me
Minecraft Version 1.16.3
Full Code:

Command /mob:
trigger:
every 60 seconds:
Loop 2000 times:
Loop all Players:
Chance of 10%:
Spawn 1 zombie at location of loop-player
set name of last spawned entity to “Zombie”
send “&6ZOMBIES” to loop-player
Chance of 10%:
spawn 1 spider at location of loop-player
set name of last spawned entity to "Spider"
send "&6SPIDERS" to loop-player

Errors on Reload: Can't understand conditon every 60 seconds
 
Basically I'm trying to write a plugin with skript that every minutes spawns 50 of a random monster at the location of all players. However, I also want the mobs to not despawn so im trying to give them a nametag and that kind of works. The biggest problem that im running into is that time is not working everytime I try to do something time based it says "error cannot understand that condition". BTW I am kind of new to skript so I might be making a stupid mistake.

Skript Version: 2.4
Skript Author: Me
Minecraft Version 1.16.3
Full Code:

Command /mob:
trigger:
every 60 seconds:
Loop 2000 times:
Loop all Players:
Chance of 10%:
Spawn 1 zombie at location of loop-player
set name of last spawned entity to “Zombie”
send “&6ZOMBIES” to loop-player
Chance of 10%:
spawn 1 spider at location of loop-player
set name of last spawned entity to "Spider"
send "&6SPIDERS" to loop-player

Errors on Reload: Can't understand conditon every 60 seconds
Every 60 seconds is an event thats why
[doublepost=1600441848,1600386752][/doublepost]
Basically I'm trying to write a plugin with skript that every minutes spawns 50 of a random monster at the location of all players. However, I also want the mobs to not despawn so im trying to give them a nametag and that kind of works. The biggest problem that im running into is that time is not working everytime I try to do something time based it says "error cannot understand that condition". BTW I am kind of new to skript so I might be making a stupid mistake.

Skript Version: 2.4
Skript Author: Me
Minecraft Version 1.16.3
Full Code:

Command /mob:
trigger:
every 60 seconds:
Loop 2000 times:
Loop all Players:
Chance of 10%:
Spawn 1 zombie at location of loop-player
set name of last spawned entity to “Zombie”
send “&6ZOMBIES” to loop-player
Chance of 10%:
spawn 1 spider at location of loop-player
set name of last spawned entity to "Spider"
send "&6SPIDERS" to loop-player

Errors on Reload: Can't understand conditon every 60 seconds
Code:
function spawnmob(p: player):#this is the function, there is a function tutorial on skunity
    set {_x} to a random integer between 1 and 4
    if {_x} is equal to 1:
        spawn a zombie at {_p}
    else if {_x} is equal to 2:
        spawn a spider at {_p}
    else if {_x} is equal to 3:
        spawn a creeper at {_p}
    else if {_x} is equal to 4:
        spawn a skeleton at {_p}
    add 1 to {mob_count}#this is to give every spawned mob a name or something
    set {mobs::%{mob_count}%} to last spawned entity#this is the mob and then you can use this to kill the mobs or teleport anything
    set name of last spawned entity to "%{mobs::%{mob_count}%}%" #you can set the name to anything is just an example. This is going to set every entity name to the correct name

command /mob:
    trigger:
        if {mob::*} is set:
            delete {mob::*}
            delete {mob_count} #clear the value
            kill {mobs::*} #kill spawned mobs to prevent lag
            delete {mobs::*}
            #note if you close the server the mobs variable is going to be lost
            #and you will not be able to kill the mobs
        else:
            set {mob::*} to true #the varaiable can have any value i set it to true
            while {mob::*} exists:
                Loop 50 times:
                    loop all players:
                        spawnmob(loop-player) #this is to call the function
                        wait a tick #This is to prevent a crash
                wait 60 seconds #delay
[doublepost=1600442039][/doublepost]If you have any question about the code just ask me I test the code and is working
 
Every 60 seconds is an event thats why
[doublepost=1600441848,1600386752][/doublepost]
Code:
function spawnmob(p: player):#this is the function, there is a function tutorial on skunity
    set {_x} to a random integer between 1 and 4
    if {_x} is equal to 1:
        spawn a zombie at {_p}
    else if {_x} is equal to 2:
        spawn a spider at {_p}
    else if {_x} is equal to 3:
        spawn a creeper at {_p}
    else if {_x} is equal to 4:
        spawn a skeleton at {_p}
    add 1 to {mob_count}#this is to give every spawned mob a name or something
    set {mobs::%{mob_count}%} to last spawned entity#this is the mob and then you can use this to kill the mobs or teleport anything
    set name of last spawned entity to "%{mobs::%{mob_count}%}%" #you can set the name to anything is just an example. This is going to set every entity name to the correct name

command /mob:
    trigger:
        if {mob::*} is set:
            delete {mob::*}
            delete {mob_count} #clear the value
            kill {mobs::*} #kill spawned mobs to prevent lag
            delete {mobs::*}
            #note if you close the server the mobs variable is going to be lost
            #and you will not be able to kill the mobs
        else:
            set {mob::*} to true #the varaiable can have any value i set it to true
            while {mob::*} exists:
                Loop 50 times:
                    loop all players:
                        spawnmob(loop-player) #this is to call the function
                        wait a tick #This is to prevent a crash
                wait 60 seconds #delay
[doublepost=1600442039][/doublepost]If you have any question about the code just ask me I test the code and is working
Every 60 seconds is an event thats why
[doublepost=1600441848,1600386752][/doublepost]
Code:
function spawnmob(p: player):#this is the function, there is a function tutorial on skunity
    set {_x} to a random integer between 1 and 4
    if {_x} is equal to 1:
        spawn a zombie at {_p}
    else if {_x} is equal to 2:
        spawn a spider at {_p}
    else if {_x} is equal to 3:
        spawn a creeper at {_p}
    else if {_x} is equal to 4:
        spawn a skeleton at {_p}
    add 1 to {mob_count}#this is to give every spawned mob a name or something
    set {mobs::%{mob_count}%} to last spawned entity#this is the mob and then you can use this to kill the mobs or teleport anything
    set name of last spawned entity to "%{mobs::%{mob_count}%}%" #you can set the name to anything is just an example. This is going to set every entity name to the correct name

command /mob:
    trigger:
        if {mob::*} is set:
            delete {mob::*}
            delete {mob_count} #clear the value
            kill {mobs::*} #kill spawned mobs to prevent lag
            delete {mobs::*}
            #note if you close the server the mobs variable is going to be lost
            #and you will not be able to kill the mobs
        else:
            set {mob::*} to true #the varaiable can have any value i set it to true
            while {mob::*} exists:
                Loop 50 times:
                    loop all players:
                        spawnmob(loop-player) #this is to call the function
                        wait a tick #This is to prevent a crash
                wait 60 seconds #delay
[doublepost=1600442039][/doublepost]If you have any question about the code just ask me I test the code and is working

Thanks for your help! I will test the code on my end to make sure it’s working! Thank You!
[doublepost=1600724833][/doublepost]Hey, I just tested the code and it works. However, I had one quick question I see there is some stuff about killing spawned mobs (Which is good I don't want insane server lag) but I was just wondering if it does that automatically or I have to run a command?
 
Status
Not open for further replies.