#How to make a quest that follow the ingame day/night cycle?

27 messages · Page 1 of 1 (latest)

plain igloo
#

Is there a way to make the quest trigger when a specific time of the day occurr?
i ended up with this by digging a little for some docs but it doesn't seem to work very well...

FTBQuestsEvents.customTask('7F4E9157A515BA94', event => {

  event.maxProgress = 1
  event.setCheckTimer(20)

  event.setCheck((task, player) => {
    if(player.server.overworld().dayTime() == 24000) {
      task.progress++
    }
  })
})
pearl bloomBOT
#

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

swift knoll
#

strict equality may be faulty if for some reason the check skips 24000. you shouldn't check when the value is exact, but rather if the value has been reached. in your case that'd be checking if dayTime() >= 0 && dayTime() < 12000 - and immediately on detection, turn off the loop and instead switch to dayTime() >= 12000 && dayTime() < 24000 - which on detection switches back to the previous loop. that way you have a safety cushion of half a day in case you miss the specific time and i doubt any lag spike is gonna last more than half a minecraft day

plain igloo
#

FTBQuestsEvents.customTask('7F4E9157A515BA94', event => {

event.maxProgress = 1
event.setCheckTimer(20)

let b = false

event.setCheck((task, player) => {
if(dayTime() >= 0 && dayTime() < 12000 && b == false) {
b = true
task.progress++
}
else if (dayTime() >= 12000 && dayTime() < 24000 && b == true) {
b = false
}
})
})

#

its giving me ticking player crash

swift knoll
#

well dayTime() hasn't been defined, try player.server.overworld().dayTime()

plain igloo
#

now its working but it doesn't loop

swift knoll
#

wdym doesn't loop? you mean it stops incrementing after the first one?

plain igloo
#

after the second one

swift knoll
#

so it increments twice?

#

try changing event.maxProgress

plain igloo
#

idk i put max progress at 10 and the quest is set to repeatable but still nothing

swift knoll
#

wait don't repeatable quests have to be reset by hand?

#

as in the player has to collect the reward

fervent nest
#

If there’s no reward though, then iirc it doesn’t work as repeatable, it just stays completed

swift knoll
#

huh

plain igloo
#

i turned off repeatable quest anyway and still no results...

fervent nest
#

There should be a “time” task from one of the FTB Quests addons, but I forget which one—I’ll see if I can find it when I’m back at my laptop, but it should let you trigger completion when you reach a certain time of day

#

That way you can skip creating your own entirely, if I’m remembering correctly…if I’m misremembering what the “time” task can do, sorry to get your hopes up

plain igloo
#

you mean quest additions addon? Yeah i already tried the timer and its not exatly what i'm looking for sadly. Even extra quest addon one.

fervent nest
#

ah, yeah i just got a chance to launch my pack and i see that it doesn't care about what time it is, just how much time has passed

plain igloo
#

,,,js
FTBQuestsEvents.customTask('7F4E9157A515BA94', event => {

event.maxProgress = 10
event.setCheckTimer(20)

let b = false

event.setCheck((task, player) => {
if(player.server.overworld().dayTime() >= 0 && player.server.overworld().dayTime() < 12000 && b == false) {
task.progress++
b = true
}
else if (player.server.overworld().dayTime() >= 12000 && player.server.overworld().dayTime() < 24000 && b == true) {
b = false
}
return
})
})
,,,

#

what if i reset the quest on completion?

plain igloo
#

nevermind it wasn't neither that

#

`let b = false

ServerEvents.tick(event => {

let server = event.server
let level = server.overworld()
if (!level) return
let daytime = level.dayTime()

if(daytime >= 0 && daytime < 12000) {
b = false
}
else if(daytime >= 12000 && daytime < 24000) {
b = true
}
})

FTBQuestsEvents.customTask('7F4E9157A515BA94', event => {

event.maxProgress = 1
event.setCheckTimer(20)

event.setCheck((task) => {
if(b == false) {
task.progress++
console.log(b)
}
else if(b == true) {
console.log(b)
}
})
})`

#

i tried with ServerEvents.ticks but somehow the CustomTask event just refuse to loop in the correct way