Jump to content

Mariage quest


Go to solution Solved by Rumor,

Recommended Posts

Hi all I have a question where I put the notice when a couple get married to see al players? Like : " Andres married whit Ana join him.

Mi quest is here ty all :)

quest marriage_manage begin
	state start begin
		when oldwoman.chat."Vreau sã mã cãsãtoresc." with not pc.is_engaged_or_married() begin
			if not npc.lock() then
				say_title("Femeia Bãtrânã:")
				say("Ziua bunã, doreºti sã te cãsãtoreºti.")
				say("Te cãsãtoreºti cu mine?")
				return
			end
			if pc.level < 25 then
				say_title("Femeia Bãtrânã:")
				say("Eºti prea mic pentru a te putea cãsãtori.")
				say("Nu te pot cãsãtori pânã nu ajungi la nivelul")
				say("necesar 25. Ai înþãles?")
				say("Revino la mine când ajungi la nivelul 25.")
				npc.unlock()
				return
			end

			local m_ring_num = pc.countitem(70301)
			local m_has_ring = m_ring_num > 0
			if not m_has_ring then
				say_title("Femeia Bãtrânã:")
				say("Oh, nu ai la tine intelul de logodnã.")
				say_item("inel de logodnã.", 70301, "")
				say("Ai nevoie de el pentru a te putea cãsãtori.")
				npc.unlock()

				return
			end

			local m_sex = pc.get_sex()
			if not marriage_manage.is_equip_wedding_dress() then
				say_title("Femeia Bãtrânã:")
				say("Costumul de nuntã unde este?")
				say("Eu nu pot continua ceremonia în acest caz.")
				say("Revino când ai costumul.")

				if m_sex == 0 then
					say_item("Costum:", marriage_manage.get_wedding_dress(pc.get_job()), "")
					say("Trebuie sã ai acest costum pentru a continua.")
				else
					say_item("Costum:", marriage_manage.get_wedding_dress(pc.get_job()), "")
					say("Trebuie sã ai acest costum pentru a continua.")
				end
				npc.unlock()
				return
			end

			local NEED_MONEY = 1000000
			if pc.get_money() < NEED_MONEY then
				say_title("Femeia Bãtrânã:")
				say("Oh, era sã uit. Ai nevoie de o sumã de yang")
				say("pentru a continua ceremonia de cãsãtorie.")
				say(string.format("Ai nevoie de: 1.000.000 Yang.", NEED_MONEY/10000))
				npc.unlock()
				return
			end
			
			say_title("Femeia Bãtrânã:")
			say("Oh, ai decis sã te cãsãtoreºti, spune-mi care")
			say("este numele persoanei dragi þie.")

			local sname = input()
			if sname == "" then
				say_title("Femeia Bãtrânã:")
				say("Oh, era sã uit. Trebuie sã fie de faþã pentru")
				say("a continua aceastã ceremonie.")
				npc.unlock()
				return
			end

			local u_vid = find_pc_by_name(sname)
			local m_vid = pc.get_vid()
			if u_vid == 0 then
				say_title("Femeia Bãtrânã:")
				say("Eºti sigur(ã) cã acesta este numele?")
				say("Deoarece nu este trecu în nici un registru.")
				npc.unlock()
				return
			end

			if not npc.is_near_vid(u_vid, 10) then
				say_title("Femeia Bãtrânã:")
				say("Oh, era sã uit. Trebuie sã fie de faþã pentru")
				say("a continua aceastã ceremonie.")
				say(string.format("%s nu este lângã tine.", sname))
				npc.unlock()
				return
			end

			local old = pc.select(u_vid)
			local u_level = pc.get_level()
			local u_job = pc.get_job()
			local u_sex = pc.get_sex()
			local u_name = pc.name
			local u_gold = pc.get_money()
			local u_married = pc.is_married()
			local u_has_ring = pc.countitem(70301) > 0
			local u_wear = marriage_manage.is_equip_wedding_dress()
			pc.select(old)
			local m_level = pc.get_level()

			if u_vid == m_vid then
				say_title("Femeia Bãtrânã:")
				say("Nu poþi face aºa ceva. Ceremonia este")
				say("anulatã. Revino.")
				npc.unlock()
				return
			end

			if u_sex == m_sex then
				say_title("Femeia Bãtrânã:")
				say("Oh, nu pot cãsãtori pe cineva de acelaº ")
				say("sex. Revino cu persoana potrivitã.")
				npc.unlock()
				return
			end

			if u_married then
				say_title("Femeia Bãtrânã:")
				say("Oh, divorþeazã înainte, pentru a te putea")
				say("cãsãtori din nou.")
				npc.unlock()
				return
			end

			if u_level < 25 then
				say_title("Femeia Bãtrânã:")
				say("Oh, nu te pot cãsãtori cu o persoanã care")
				say("este sub nivelul 25.")
				npc.unlock()
				return
			end

			if m_level - u_level > 15 or u_level - m_level > 15 then
				say_title("Femeia Bãtrânã:")
				say("Oh, între voi doi este o diferenþã mare de")
				say("nivel. Reveniþ când aveþi acelaº nivel.")
				npc.unlock()
				return
			end

			if not u_has_ring then
				if m_ring_num >= 2 then
					say_title("Femeia Bãtrânã:")
					say("Trebuie sã aveþi amândoi inele de logodnã ")
					say("pentru a continua.")
				else
					say_title("Femeia Bãtrânã:")
					say("Oh, douã inele de logodnã sunt suficiente")
					say("pentru voi doi.")
				end

				say_item("inel de logodnã.", 70301, "")
				say("Ai nevoie de el pentru a te putea cãsãtori.")
				npc.unlock()
				return
			end

			if not u_wear then
				say_title("Femeia Bãtrânã:")
				say("Costumul de nuntã unde este?")
				say("Eu nu pot continua ceremonia în acest caz.")
				say("Revino când aveþi costumele.")
				if u_sex == 0 then
					say_item("Costum:", marriage_manage.get_wedding_dress(u_job), "")
					say("Trebuie sã ai acest costum pentru a continua.")
				else
					say_item("Costum:", marriage_manage.get_wedding_dress(u_job), "")
					say("Trebuie sã ai acest costum pentru a continua.")
				end
				npc.unlock()
				return
			end


			local ok_sign = confirm(  u_vid, "sposa"..pc.name.. "ok?", 30)
			if ok_sign == CONFIRM_OK then
				local m_name = pc.name
				if pc.get_gold()>=NEED_MONEY then
					pc.change_gold(-NEED_MONEY)

					pc.removeitem(70301, 1)
					pc.give_item2(70302, 1)
					local old = pc.select(u_vid)
					pc.removeitem(70301, 1)
					pc.give_item2(70302, 1)
					pc.select(old)

					say_title("Femeia Bãtrânã:")
					say("Oh, aþi primit credinþa. Sunte-þi cãsãtoriþi.")
					say("Acum vã voi da inelele, aveþi grijã cu ele.")
					wait()
					setskin(NOWINDOW)
					marriage.engage_to(u_vid)
				end
			else
				
				say_title("Femeia Bãtrânã:")
				say("Oh, nu te poþi cãsãtori. Revino când ")
				say("ai toate cele necesare.")
			end
			npc.unlock()
		end

		when oldwoman.chat."Informaþii." with pc.is_engaged() begin
			
			say("Cãsãtoria este foarte importantã deoarece ")
			say("odatã cu ea vei primi un inel de teleportare.")
			say("Acest inel de teleportare, te readuce lângã ")
			say("persoana dragã þie.")
			wait()
			setskin(NOWINDOW)
			marriage.warp_to_my_marriage_map()
		end


		when 9011.chat."Începe sãrbãtoarea." with pc.is_engaged() and marriage.in_my_wedding() begin
			if not npc.lock() then
				say("Ai încheiat deja ceremonia, cum aºa?")
				return
			end
			
			say("Pentru a oficializa cãsãtoria mai trebuie sã ")
			say("faceþi douã lucruri simple.")
			say("Scrie numele persoanei iubite mai jos.")

			local sname = input()
			local u_vid = find_pc_by_name(sname)
			local m_vid = pc.get_vid()

			if u_vid == 0 then
				
				say("Oh, era sã uit. Trebuie sã fie de faþã pentru")
				say("a continua aceastã ceremonie.")
				say_reward(string.format("%s nu este lângã tine.", sname))
				npc.unlock()
				return
			end

			if not npc.is_near_vid(u_vid, 10) then
				
				say("Oh, era sã uit. Trebuie sã fie de faþã pentru")
				say("a continua aceastã ceremonie.")
				say_reward(string.format("%s nu este lângã tine.", sname))
				npc.unlock()
				return
			end

			if u_vid == m_vid then
				
				say("Vã voi cãsãtori. Eºti pregãtit(ã) pentru")
				say("acest pas uriaº.")
				npc.unlock()
				return
			end

			if u_vid != marriage.find_married_vid() then
				
				say("Oh, era sã uit. Trebuie sã fie de faþã pentru")
				say("a continua aceastã ceremonie.")
				npc.unlock()
				return
			end

			local ok_sign = confirm(u_vid, "Te cãsãtoreºti cu "..pc.name.. " ?", 30)
			if ok_sign != CONFIRM_OK then
				
				say("Oh, totul este clar. Putem începe cãsãtoria.")
				say("Distracþie plãcutã la petrecere.")
				npc.unlock()
				return
			end
			
			say("O nouã pereche pentru noi.")
			marriage.set_to_marriage()
			say_reward("Aþi primit credinþa, felicitãri.")
			npc.unlock()
		end

		function give_wedding_gift()
			local male_item = {71072, 71073, 71074}
			local female_item = {71069, 71070, 71071} 
			if pc.get_sex() == MALE then
				pc.give_item2(male_item[number(1, 3)], 1)
			else
				pc.give_item2(female_item[number(1, 3)], 1)
			end
		end

		when 9011.chat."Porneºte muzica." with 
			(pc.is_engaged() or pc.is_married()) and 
			marriage.in_my_wedding() and
			not marriage.wedding_is_playing_music() begin
			marriage.wedding_music(true, "wedding.mp3")
			setskin(NOWINDOW)
		end
		when 9011.chat."Opreºte muzica." with 
			(pc.is_engaged() or pc.is_married()) and 
			marriage.in_my_wedding() and
			marriage.wedding_is_playing_music() begin
			marriage.wedding_music(false, "default")
			setskin(NOWINDOW)
		end
		when 9011.chat."Ceremonia pe timp de noapte." with 
			pc.is_married() and 
			marriage.in_my_wedding() begin
			marriage.wedding_dark(true)
			setskin(NOWINDOW)
		end

		when 9011.chat."Ceremonia pe timp de iarnã. " with pc.is_married() and marriage.in_my_wedding() begin
			marriage.wedding_snow(true)
			setskin(NOWINDOW)
		end

		when 9011.chat."Terminã ceremonia." with pc.is_married() and marriage.in_my_wedding() begin
			if not npc.lock() then
				say("Dar, nu ai terminat deja ceremonia? ")
				return
			end

			
			say("Vrei sã termini aceastã ceremonie? ")
			local s = select("Da, Vreau. ","Ma-m rãzgândit. ")
			if s == 1 then
				local u_vid = marriage.find_married_vid()
				if u_vid == 0 then
					say("Oh, eºti singur(ã), nu pot încheia aceastã ")
					say("ceremonie fãrã jumãtatea ta. ")
					npc.unlock()
					return
				end
				
				say("Oh, dacã doreºti sã fie gata ceremonia trebuie ")
				say("ca partenerul tãu sã fie de acord. ")
				local ok_sign = confirm(u_vid, "Terinã ceremonia? ", 30)
				if ok_sign == CONFIRM_OK then
					marriage.end_wedding()
				else
					
					say("Partenerul nu este de acord ca ceremonia ")
					say("sã ia sfârºit. ")
				end

			end

				npc.unlock()
		end
		when 20355.chat."Divorþeazã. " with pc.is_married() begin

			if not marriage_manage.check_divorce_time() then
				return
			end

			local u_vid = marriage.find_married_vid()
			if u_vid == 0 or not npc.is_near_vid(u_vid, 10) then
				say_title("Cãpitan: ")
				say("Oh, pentru a divorþa trebuie ca partenerul ")
				say("tãu sã fie de faþã. ")
				return
			end

			say_title("Cãpitan: ")
			say("Pentru a putea continua acest divorþ vei ")
			say("avea nevoie de 500.000 Yang. ")

			local MONEY_NEED_FOR_ONE = 500000
			local s = select("Divorþeazã. ", "Ma-m rãzgândit. ")

			if s == 1 then
				local m_enough_money = pc.gold > MONEY_NEED_FOR_ONE
				local m_have_ring = pc.countitem(70302) > 0

				local old = pc.select(u_vid)
				local u_enough_money = pc.gold > MONEY_NEED_FOR_ONE
				local u_have_ring = pc.countitem(70302) > 0
				pc.select(old)

				if not m_have_ring then
					say_title("Cãpitan: ")
					say("Trebuie sã aduci inelul primit de la Babã. ")
					return;
				end
				if not u_have_ring then
					say_title("Cãpitan: ")
					say("Trebuie sã aduci inelul primit de la Babã. ")
					return;
				end

				if not m_enough_money then
					say_title("Cãpitan: ")
					say("Nu ai acea sumã destul de importantã. ")
					say_reward(string.format("Ai nevoie de %d Yang. ", MONEY_NEED_FOR_ONE/10000))
					return;
				end
				if not u_enough_money then
					say_title("Cãpitan: ")
					say("Ambii trebuie sã aveþi la voi 500.000 Yang. ")
					return;
				end
				
				say_title("Cãpitan: ")
				say("Încã mai doreºti sã divorþezi? ")

				local c=select("Cum am spus, Da. ", "Ma-m rãzgândit. ")
				if 2 == c then
					say_pc_name()
					say("Doresc divorþ, asta este decizia mea. ")
					wait()
					say_title("Cãpitan: ")
					say("Se pare cã voi doi nu aþi fost meniþi sã ")
					say("fiþi împreunã. ")
					return
				end

				local ok_sign = confirm(u_vid, pc.name.." vrei sã divorþezi?", 30)
				if ok_sign == CONFIRM_OK then

					local m_enough_money = pc.gold > MONEY_NEED_FOR_ONE
					local m_have_ring = pc.countitem(70302) > 0

					local old = pc.select(u_vid)
					local u_enough_money = pc.gold > MONEY_NEED_FOR_ONE
					local u_have_ring = pc.countitem(70302) > 0
					pc.select(old)

					if m_have_ring and m_enough_money and u_have_ring and u_enough_money then
						pc.removeitem(70302, 1)
						pc.change_money(-MONEY_NEED_FOR_ONE)

						local old = pc.select(u_vid)
						pc.removeitem(70302, 1)
						pc.change_money(-MONEY_NEED_FOR_ONE)
						pc.select(old)

						say_title("Cãpitan:")
						say("Se pare cã voi doi nu aþi fost meniþi sã")
						say("fiþi împreunã.")
						say_verde("Cãsãtoria este anulatã.")
						marriage.remove()
					else
						say_title("Cãpitan:")
						say("Trebuie sã aºtepþi ceva timp pentru a putea")
						say("divorþa.")
						say_verde("Cãsãtoria nu poate fi anulatã.")
					end
				else
					say_title("Cãpitan:")
					say("Oh, cealaltã persoanã nu este de acord.")
				end
			end
		end

		when 20355.chat."Nu mai doresc inelul de logodnã. " with not pc.is_married() and  pc.count_item(70302)>0 begin
			say_title("Cãpitan: ")
			say("inelul de logodnã a fost distrus. ")
			pc.remove_item(70302)
		end

		when 20355.chat."Divorþ unilateral.(De unul singur.) " with pc.is_married() begin

			if not marriage_manage.check_divorce_time() then
				return
			end

			say_title("Cãpitan: ")
			say("Pentru a divorþa de un(a)ul singur(ã) trebui e ")
			say("sã plãteºti o sumã de 1.000.000 Yang. ")

			local s = select("Da, Vreau. ", "Ma-m rãzgândit. ")

			local NEED_MONEY = 1000000
			if s == 2 then
				return
			end

			if pc.money < NEED_MONEY then
				say_title("Cãpitan:")
				say("Ai nevoie de 1.000.000 Yang.")
				return
			end

			say_title("Cãpitan: ")
			say("Chear doreºti cu adevãrat sã divorþezi? ")
			local c = select("Doresc un divorþ. ", "Nu, cred cã nu. ")

			if c == 2 then
				say_title("Cãpitan: ")
				say("Este alegerea ta. ")
				return
			end

			pc.removeitem(70302, 1)
			pc.change_gold(-NEED_MONEY)

			marriage.remove()

			say_title("Cãpitan: ")
			say("Se pare cã voi doi nu aþi fost meniþi sã ")
			say("fiþi împreunã. ")
			say_verde("Cãsãtoria este anulatã. ")
		end

		when oldwoman.chat."Lista nunþilor actuale. " with not pc.is_engaged() begin
			local t = marriage.get_wedding_list()
			if table.getn(t) == 0 then
				say("Momentan nu este nici o ceremonie. ")
			else
				local wedding_names = {}
				table.foreachi(t, function(n, p) wedding_names[n] = p[3].." ºi "..p[4].." " end)
				wedding_names[table.getn(t)+1] = locale.confirm
				local s = select_table(wedding_names)

				if s != table.getn(wedding_names) then
					marriage.join_wedding(t[s][1], t[s][2])
				end
			end
		end
		when 9011.click with not pc.is_engaged() and not pc.is_married() begin
			say("Ne-am adunat astãzi aici pentru a putea ")
			say("sãrbãtori lângã acest cuplu. ")
		end

		function check_divorce_time()

			local DIVORCE_LIMIT_TIME = 86400

			if is_test_server() then
				DIVORCE_LIMIT_TIME = 60
			end

			if marriage.get_married_time() < DIVORCE_LIMIT_TIME then 
				say_title("Cãpitan: ")
				say("Eu vara nu dorm, vara nu dorm. ")
				say("Revino. ")
				return false
			end

			return true
		end

		function is_equip_wedding_dress()
			local a = pc.get_armor()
			return a >= 11901 and a <= 11904
		end
		function get_wedding_dress(pc_job)
			if 0==pc_job then
				return 11901
			elseif 1==pc_job then
				return 11903
			elseif 2==pc_job then
				return 11902
			elseif 3==pc_job then
				return 11904
			else
				return 0;
			end
		end
	end
end

  • Love 1
Link to comment
Share on other sites

  • Solution

If you want to have an announce button for the couple to use to announce the marriage..

 

Go to line 316 and add this block:

when 9011.chat."Wedding announce" with pc.is_married() and marriage.in_my_wedding() begin
        	if pc.getqf("wedding_announce_time") < get_time() then
        		local old_vid = pc.get_vid()
			local u_vid = marriage.find_married_vid()
			if u_vid != 0 then
				pc.select(u_vid)
				local partner = pc.getname()
				pc.select(old_vid)
				notice_all(pc.name.." and "..partner.." invite you to their wedding!")
				notice_all("Talk to the Old Lady to join the celebration.")
				pc.setqf("wedding_announce_time", get_time()+60*10)
				setskin(NOWINDOW)  
			else
				say("Your partner is not online!")
				say("")
			end
		else
			local remaining = pc.getqf("wedding_announce_time") - get_time()
			say("You can announce again after "..remaining.." seconds.")
			say("")
		end
  • Metin2 Dev 1
  • Love 2
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.