#Script to print out messages in chat after a certain amount of time/ticks

8 messages · Page 1 of 1 (latest)

copper forge
#

basically want to add messages in chat every so now and again, forge 1.20.1

zinc baneBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

dapper sparrow
#
ServerEvents.tick(event => {
    if(event.server.getLevel("minecraft:overworld").time % 10000 == 0){
        // code here runs every 10000 ticks, so every 500 seconds
    }
})
copper forge
deft prairie
#

so what the code uses is a % operator
This divides and gives the rest amount, so for example 100 % 33 would give 1 (100-3*33=1)
if you want it to only trigger at a specfic time you can just do js if (event.server.getLevel("minecraft:overworld").time == 2000) { // code here runs once when time in ticks reaches 2000 }

dapper sparrow
#

Note that this will only print the message a single time for every world

inland ibex