Jump to content
For maintenance and updates, the community will be offline on 31 December 2022 ×
  • 0

daily quest structure in lua


Cripplez

Question

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

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

 

Edited by Cripplez
Link to comment
Share on other sites

  • Answers 0
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Activity

    1. 992

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    2. 3

      Biologist Manager (C++ & LUA)

    3. 3

      Visual studio 2022 compiling issue

    4. 63

      Metin2 | Mount System Renewal

    5. 58

      Metin2 2004 Beta Client

    6. 0

      🔥Paradise2 PVP SERVER GLOBAL!! EN-ES-PT 🕐📢Apertura 11 de diciembre 21 horas de España!

    7. 0

      Please help here ( Sush system problem )

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.