Jump to content

Recommended Posts

Hey, i am trying to add collect quest where will be time shown. Like i go to biologist give him item and i see how long time left so i can give item again.

Spoiler
quest collect_quest_lv30 begin
	state start begin
		when login or levelup with pc.level >= 30 begin
			set_state(information)
		end	
	end

	state information begin
		when letter begin
			local v = find_npc_by_vnum(20084)
			if v != 0 then
				target.vid("__TARGET__", v, "Biolog Chaegirab")
			end
			send_letter("Biologický výzkum")
		end

		when button or info begin
			say_title("Biologický výzkum")
			say("Biolog má pro tebe nějaký úkol,")
			say("jdi k němu a uvidíš co ti řekne.")
			say("")
		end
		
		when __TARGET__.target.click begin
			target.delete("__TARGET__")
			say_title("Biolog Chaegirab")

			say("Dobře, že jsi přišel.")
			say("Mám pro tebe důležitý úkol.")
			say("Týká se to zubů orka.")
			say("")
			wait()
			say_title("Biolog Chaegirab")
			say("Já a můj učenec Uriel jsme")
			say("zjistili, že některé zuby Černého orka")
			say("mohou být lečivé. Myslíme")
			say("si, že zápach, který je cítit")
			say("z těch zubů, dělá příšery agresivní.")
			say("")
			wait()
			say_title("Biolog Chaegirab")
			say("Chceme zjistit, co to způsobuje,")
			say("proč jsou příšery agresivní z té vůně,")
			say("kdyby jsme to zjistili, možná by jsme")
			say("mohli vyrobit protilátku.")
			say("")																																						  
			set_state(go_to_disciple)
			pc.setqf("duration",0)  -- ĄiĄH¸Ő¸ŐŞş®É¶ˇ
			pc.setqf("collect_count",0) -- ˇX¨ú±oąLŞşŞ««~ĽĆ¶q
			pc.setqf("drink_drug",0) -- ˇX łÜ°g´bĂĤôŞş¸Ü 1
		end
	end

	state go_to_disciple begin
		when letter begin
			q.set_clock("time_limit", pc.getqf("time_limit") - get_time()) -- Set remaining time text on client's Quest window
			send_letter("&Výzkum - Zub orka")
			
		end
		when button or info begin
			say_title("Výzkum - Zub orka")
			say("Výzkum zuby Černého orka z údolí Seungryong")
			say("Přines mu každých 5 minut jeden zub.")
			say_item_vnum(30006) 
			say_reward("Zatím jsi našel".." "..pc.getqf("collect_count").." zubů.")
			say("")
			if ((get_global_time() - pc.getf("collect","exit_collect_time")) < 5*60) then
			
				local remaining_wait_time = (pc.getf("collect","exit_collect_time") - get_global_time() + 5*60)
				say(" Před odevzdáním Zubu orka musíš počkat. ")
				say_reward(" Můžeš znovu odevzdat za: "..get_time_remaining(remaining_wait_time)..'[ENTER]')
				return
			end				
		end

		when 635.kill or 636.kill or 637.kill begin
			local drop = number(1, 100)
			if drop == 1 then
				game.drop_item(30006,1)
			end
		end

		when 71035.use begin
			if pc.getqf("drink_drug")==1 then
				say_title("Biolog Chaegirab")
				say("Už jsi ho použil.")
				say("")
				return
			end
			item.remove()	
			pc.setqf("drink_drug",1)
		end

    	when 20084.chat."Zuby orka" with pc.count_item(30006) >0   begin
			if get_time() > pc.getqf("duration") then
				say_title("Biolog Chaegirab")
				say("Ahoj, vidím, že jsi mi přinesl")
				say("zub, počkej chvíli podívám se na něj.")
				say("")
				pc.remove_item("30006", 1)
				pc.setf("collect","exit_collect_time", get_global_time())
				pc.setqf("time_limit", get_time() + 5 * 60)
				pc.setqf("duration",get_time()+300) -----------------------------------22??
				wait()
				
				local pass_percent
				if pc.getqf("drink_drug")==0 then
					pass_percent=60
				else		
					pass_percent=90
				end
				
				local s= number(1,100)
				if s<= pass_percent  then
				   if pc.getqf("collect_count")< 9 then     --10­ÓĄH¤U 
						local index =pc.getqf("collect_count")+1 
						pc.setqf("collect_count",index)     --¨ú±o¤@­Ó®É +1 
						say(pass_percent)
						say_title("Biolog Chaegirab")
						say("Takové zuby se mi vždy hodí.")
						say("Ještě mi musíš")
						say("donést".." "..10-pc.getqf("collect_count").. " zubů.")
						say("")
						pc.setqf("drink_drug",0)	 --ĂĤôŞě©l¤Ć
						return
					end
					say_title("Biolog Chaegirab")
					say("Výborně!")
					say("Povedlo se ti nazbírat všechny zuby orka.")
					say("Teď jsme schopný posoudit,")	
					say("proč jsou ty příšery agresivní.")
					say("")
					wait()
					say_title("Biolog Chaegirab")
					say("Nic méně, abych mohl vyrobit ")
					say("protilátku, tak potřebuju jednu věc,")
					say("která se nazývá Kámen duše Jinunggyis.")
					say("Prosím, najdi ho.")
					pc.setqf("collect_count",0)
					pc.setqf("drink_drug",0)	
					pc.setqf("duration",0) 
					set_state(key_item)
					return
				else								
				say_title("Biolog Chaegirab")
				say("Tento zub je příliš prohnilí.")
				say("Prosím, sežeň mi jiný.")
				say("")
				pc.setqf("drink_drug",0)	 --ĂĤôŞě©l¤Ć
				return
				end
	    else	  
			say_title("Biolog Chaegirab")
			say("Promiň, ale ještě jsem nedokončil")
			say("výzkum, vrať se později.")
			if ((get_global_time() - pc.getf("collect","exit_collect_time")) < 5*60) then
			
				local remaining_wait_time = (pc.getf("collect","exit_collect_time") - get_global_time() + 5*60)
				say(" Před odevzdáním Zubu orka musíš počkat.  ")
				say_reward(" Můžeš znovu odevzdat za: "..get_time_remaining(remaining_wait_time)..'[ENTER]')
				return
			end		  
		  say("")
		  return
		end
	end
end

	state key_item begin
		when letter begin
			send_letter("&Kámen duše Jinunggyis")
			
			if pc.count_item(30220)>0 then	
				local v = find_npc_by_vnum(20084)
				if v != 0 then
					target.vid("__TARGET__", v, "Biolog Chaegirab")
				end
			end
		end

		when button or info begin
			if pc.count_item(30220) >0 then
				say_title("Kámen duše Jinunggyis")
				---                                                   l
				say("Jdi za biologem.")
				say("")
				return
			end
			say_title("Kámen duše Jinunggyis")
			say("Biolog potřebuje ")
			say("kámen duše Jinunggyis.")
			say("")
			say_item_vnum(30220)----------- Żu°­±ÚĆF»îĄŰ
			say("Seženeš ho z Hrdých orků-generálů,")
			say("Černých orků a Černých obřích orků.")
			say("")
		end
		when 635.kill or
			 636.kill or 
			 637.kill  begin
			local s = number(1, 500)
			if s == 1 and pc.count_item(30220)==0 then
				pc.give_item2(30220, 1)
				send_letter("&Kámen duše Jinunggyis")		
			end	
		end
	
		when __TARGET__.target.click or 20084.chat."Kámen duše Jinunggyis" with pc.count_item(30220) > 0  begin
		    target.delete("__TARGET__")
			say_title("Biolog Chaegirab")
			say("Děkuji ti,")
			say("nyní mohu udělat protilátku.")
			say("Tady máš tajný recept,")
			say("Baek-Go ti ukáže co s ním.")
			say("")
			pc.remove_item(30220,1)
			set_state(__reward__)
		end
	end
	
	state __reward__ begin
		when letter begin
			send_letter("&Najdi Baek-Goa")
			local v = find_npc_by_vnum(20018)
			if v != 0 then
				target.vid("__TARGET__", v, "Baek-Go")
			end
		end

		when button or info begin
			say_title("Najdi Baek-Goa")
			---                                                   l
			say("Biolog Chaegirab ti dal tajný ")
			say("recept, a proto najdi")
			say("Baek-Goa a předej mu ho.")
			say("")
		end
		
		when __TARGET__.target.click  or
			20018.chat."Najdi Baek-Goa"  begin
		    target.delete("__TARGET__")
			say_title("Baek-Go")
			say("Děkuji ti za tajný recept,")
			say("za něj ti zlepším")
			say("rychlost pohybu o 10.")
			say("")
			say_reward("Zvýšil jsem ti trvale")
			say_reward("rychlost pohybu o 10.")
			say("")
			affect.add_collect(apply.MOV_SPEED, 10, 60*60*24*365*60) --60¦~	
			clear_letter()
			set_quest_state("collect_quest_lv40", "run")
			set_state(__complete__)
		end
	end

	state __complete__ begin
	end
end

 

I have it like this. Which works (kinda). The function i am looking for is 

        when letter begin
            q.set_clock("time_limit", pc.getqf("time_limit") - get_time()) -- Set remaining time text on client's Quest window
            send_letter("&Výzkum - Zub orka")

It works but when i stay logged in at biologist, give him item i have the countdown. When the countdown ends i can give him item again. So i give him item but it does not show time left when im in quest window. It just says time is up. When i relog it shows time corectly. Is there way to make it without reloging? Thanks

Link to comment
https://metin2.dev/topic/32810-collect-quest-with-time-show/
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.