Hello, I'm trying to make a daily quest and I wanted to ask you if the structure of this quest is correct or it is missing code or could have unexpected bug that i didn't calculate.
Is it correct to use set_state(start) at the end to make it repeatable? thank you
This is just an example
Code
- quest daily_quest begin
- state start begin
- when login or levelup with pc.get_level() >= 50 begin
- if get_time() > pc.getqf("daily_cd") then
- set_state(daily)
- end
- end
- when letter with pc.get_level() >= 50 begin
- send_letter("Daily QUest")
- end
- when button or info begin
- say_title("Daily QUesta")
- if ((get_global_time() - pc.getf("daily_cd","daily_wait_time")) < 60) then
- local remaining_wait_time = (pc.getf("daily_cd", "daily_wait_time") - get_global_time() + (60 * 60 * 24))
- say("You must wait for timer")
- say_reward("You can repeat in: "..get_time_remaining(remaining_wait_time)..'[ENTER]')
- return
- end
- say("Now you can repeat the quest.")
- set_state(daily)
- end
- end
- state daily begin
- when letter begin
- send_letter("Daily quest")
- end
- when button or info begin
- say_title("Daily quest")
- say("Daily quest active")
- end
- // mission
- when 101.kill begin
- chat("daily quest completed.")
- pc.setf("daily_cd", "daily_wait_time", get_global_time());
- pc.setqf("daily_cd", get_time() + 60 * 60 * 24);
- set_state(start)
- end
- end
- end