Jump to content

Problem with daily quest


Recommended Posts

quest daily_quest_over100 begin
	state start begin 
		when login or levelup with pc.get_level() >=100 begin
			if get_global_time()> pc.getqf(tempo)
				set_state(info)
			end
		end
	end
	
	state info begin -- info about the mission
		when letter begin
			send_letter("Daily quest")
		end -- letter sent

		when button or info begin
			say_title("Daily quest")
			say("Hi, " .. pc.get_name() .. ".")
			say("You can choose the easy way,")
			say("with a poor reward or")
			say("the hard way, for a better reward")
			say("")
			local risp = select("Easy","Hard", "Cancel")
			if risp==3 then -- Cancel
				return
			elseif risp == 1 -- Easy
				pc.setqf("dif",0) -- difficulty FLAG (0=easy, 1=hard)
				set_state(running)
			else -- Hard
				pc.setqf("dif",1)
				set_state(running)
			end
		end -- when closed
	end -- INFO closed

	state running begin
		
		pc.setqf("done",0) -- quest completed FLAG (0=not completed, 1=completed)
		
		if pc.getqf(dif)==0 then
			pc.setqf("mob_to_kill",math.random(2411, 2414))
			-- how many kills
			local qta = {
							100, 125, 150, 175, 200,
							225, 250, 275, 300
						}
			pc.setqf("qta_to_kill",qta[math.random(1, 9)])
			-- 50k yang for each kill, max=15M yang
			pc.setqf("reward",50000 * (pc.getqf(qta_to_kill)))
		else
			local vmob = {
							1093, 1191, 1901, 2092, 2191, 2491, 2492, 2493
						 }
			pc.setqf("mob_to_kill",(vmob[math.random(1, 8)])
			pc.setqf("qta_to_kill",(math.random(1, 10)))
			-- 3M exp for each kill, max=30M exp
			pc.setqf("reward",3000000 * (pc.getqf(qta_to_kill)))
		end

		when letter begin
			if pc.getqf(dif) == 0
				send_letter("Daily mission, Easy")
			else
				send_letter("Daily mission, Hard")
			end
		end

		when button or info begin -- info about the quest
			if pc.getqf(done) == 0 then -- if he didn't complete the quest
				if pc.getqf(dif) == 0 then
					say_title("Daily quest, Hasy")
				else
					say_title("Daily quest, Hard")
				end
				say("So, you have chosen the easy way..")
				say("Here is your objective.")
				say("")
				say_reward("You have to kill: " .. qta_to_kill .. mob_name(pc.getqf(mob_to_kill)))
				if pc.getqf(dif) == 0 then
					say_reward("That's what you'll got: " .. pc.getqf(reward) .. " yang.")
				else
					say_reward("That's what you'll got: " .. pc.getqf(reward) .. " experience.")
				end
			else
				say_title("Daily mission reward")
				say("Congratulations " ..pc.get_name() .. " !!")
				say("You've earned a nice reward..")
				wait()
				if pc.getqf(dif)==0 then
					say_reward("You have earned: " .. pc.getqf(reward) .. " yang.")
					pc.changegold(pc.getqf(reward))
				else
					say_reward("You have earned: " .. pc.getqf(reward) .. " experience.")
					pc.give_exp2(pc.getqf(reward))
				end
				-- timer FLAG, this quest is repeatable once per day (24h)
				pc.setqf("tempo", get_global_time()+86400) -- 60*60*24
				-- deleting FLAGS
				pc.delqf(mob_to_kill)
				pc.delqf(reward)
				pc.delqf(qta_to_kill)
				pc.delqf(dif)
				pc.delqf(done)
				set_state(__COMPLETE__)
			end
		end

		when pc.getqf(mob_to_kill).kill begin
			pc.setqf("qta_to_kill",(pc.getqf(qta_to_kill))-1)
			if pc.getqf(qta_to_kill) == 0 then
				pc.setqf("done",1)
				send_letter("Daily mission, Reward")
			end
		end
	end -- closed RUNNING

	state __COMPLETE__ begin
		when enter begin
			q.done()
		end
	end -- closed __COMPLETE__
end -- closed QUEST

This is the error

 


root@OSL-91741:/usr/game/share/locale/italy/quest # ./qc daily_hunt.lua
QUEST : daily_quest_over100
STATE : start
WHEN  : login or
WHEN  : levelup
        with pc . get_level ( ) >= 100
if get_global_time ( ) > pc . getqf ( tempo )
set_state ( "info" )
end

daily_hunt.lua:7:syntax error : [string "startpc . get_level ( ) >= 100"]:2: `then' expected near `set_state'
Abort (core dumped)
 

 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

La 03.09.2018 la 12:22, Slime a spus:

quest daily_quest_over100 begin
	state start begin 
		when login or levelup with pc.get_level() >=100 begin
			if get_global_time()> pc.getqf(tempo)
				set_state(info)
			end
		end
	end
	
	state info begin -- info about the mission
		when letter begin
			send_letter("Daily quest")
		end -- letter sent

		when button or info begin
			say_title("Daily quest")
			say("Hi, " .. pc.get_name() .. ".")
			say("You can choose the easy way,")
			say("with a poor reward or")
			say("the hard way, for a better reward")
			say("")
			local risp = select("Easy","Hard", "Cancel")
			if risp==3 then -- Cancel
				return
			elseif risp == 1 -- Easy
				pc.setqf("dif",0) -- difficulty FLAG (0=easy, 1=hard)
				set_state(running)
			else -- Hard
				pc.setqf("dif",1)
				set_state(running)
			end
		end -- when closed
	end -- INFO closed

	state running begin
		
		pc.setqf("done",0) -- quest completed FLAG (0=not completed, 1=completed)
		
		if pc.getqf(dif)==0 then
			pc.setqf("mob_to_kill",math.random(2411, 2414))
			-- how many kills
			local qta = {
							100, 125, 150, 175, 200,
							225, 250, 275, 300
						}
			pc.setqf("qta_to_kill",qta[math.random(1, 9)])
			-- 50k yang for each kill, max=15M yang
			pc.setqf("reward",50000 * (pc.getqf(qta_to_kill)))
		else
			local vmob = {
							1093, 1191, 1901, 2092, 2191, 2491, 2492, 2493
						 }
			pc.setqf("mob_to_kill",(vmob[math.random(1, 8)])
			pc.setqf("qta_to_kill",(math.random(1, 10)))
			-- 3M exp for each kill, max=30M exp
			pc.setqf("reward",3000000 * (pc.getqf(qta_to_kill)))
		end

		when letter begin
			if pc.getqf(dif) == 0
				send_letter("Daily mission, Easy")
			else
				send_letter("Daily mission, Hard")
			end
		end

		when button or info begin -- info about the quest
			if pc.getqf(done) == 0 then -- if he didn't complete the quest
				if pc.getqf(dif) == 0 then
					say_title("Daily quest, Hasy")
				else
					say_title("Daily quest, Hard")
				end
				say("So, you have chosen the easy way..")
				say("Here is your objective.")
				say("")
				say_reward("You have to kill: " .. qta_to_kill .. mob_name(pc.getqf(mob_to_kill)))
				if pc.getqf(dif) == 0 then
					say_reward("That's what you'll got: " .. pc.getqf(reward) .. " yang.")
				else
					say_reward("That's what you'll got: " .. pc.getqf(reward) .. " experience.")
				end
			else
				say_title("Daily mission reward")
				say("Congratulations " ..pc.get_name() .. " !!")
				say("You've earned a nice reward..")
				wait()
				if pc.getqf(dif)==0 then
					say_reward("You have earned: " .. pc.getqf(reward) .. " yang.")
					pc.changegold(pc.getqf(reward))
				else
					say_reward("You have earned: " .. pc.getqf(reward) .. " experience.")
					pc.give_exp2(pc.getqf(reward))
				end
				-- timer FLAG, this quest is repeatable once per day (24h)
				pc.setqf("tempo", get_global_time()+86400) -- 60*60*24
				-- deleting FLAGS
				pc.delqf(mob_to_kill)
				pc.delqf(reward)
				pc.delqf(qta_to_kill)
				pc.delqf(dif)
				pc.delqf(done)
				set_state(__COMPLETE__)
			end
		end

		when pc.getqf(mob_to_kill).kill begin
			pc.setqf("qta_to_kill",(pc.getqf(qta_to_kill))-1)
			if pc.getqf(qta_to_kill) == 0 then
				pc.setqf("done",1)
				send_letter("Daily mission, Reward")
			end
		end
	end -- closed RUNNING

	state __COMPLETE__ begin
		when enter begin
			q.done()
		end
	end -- closed __COMPLETE__
end -- closed QUEST

This is the error

 


root@OSL-91741:/usr/game/share/locale/italy/quest # ./qc daily_hunt.lua
QUEST : daily_quest_over100
STATE : start
WHEN  : login or
WHEN  : levelup
        with pc . get_level ( ) >= 100
if get_global_time ( ) > pc . getqf ( tempo )
set_state ( "info" )
end

daily_hunt.lua:7:syntax error : [string "startpc . get_level ( ) >= 100"]:2: `then' expected near `set_state'
Abort (core dumped)

 

 

 

Citat

 

 

There are your error:  https://metin2.download/picture/uPGWaOe2OSPIMIzuZLxJrq5qjbhPgdNC/.png

Cheers.

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



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