Jump to content

Recommended Posts

Hello, i have problem with continuation chain quests
Problem occurs when
For example:
I have 7 quests in chain on server.
If someone start to do this chain or complete all of 7
and i implement new i8th quest, hes not able to recieve it.
I have to delete all quest flags for player to make him able to get this 8th quest, but he has to start over again all quests.
How to solve this problem?

Link to comment
https://metin2.dev/topic/29121-problem-with-quest-continuation/
Share on other sites

  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

59 minutes ago, Mefarious said:

Hello, i have problem with continuation chain quests
Problem occurs when
For example:
I have 7 quests in chain on server.
If someone start to do this chain or complete all of 7
and i implement new i8th quest, hes not able to recieve it.
I have to delete all quest flags for player to make him able to get this 8th quest, but he has to start over again all quests.
How to solve this problem?

Post the 7th quest here, you have to use the "set_quest_state" even if the quest still not exist to save the flag. But you can also add some code on the "complete" state to do that

  • Contributor

You can check in the 8th quest if the 7th is complete:

state start begin
	if string.format("%d", get_quest_state('your_7th_quest_name') == "557528158" then
		set_state(run)
	end
end
state run begin
	-- start of your quest
end

Example of quests
 1st:
 

Spoiler

quest kon_1 begin

    state start begin

        when login or levelup or enter with pc.get_level() >=4 begin

            set_state(information)

        end

    end

    state information begin

        when letter begin

            local v = find_npc_by_vnum(20349)

            if v != 0 then

                target.vid("__TARGET__", v, "Stajenny")

            end

            send_letter("Nauka Jazdy")

        end

        when button or info begin

            say_title("Nauka Jazdy")

            say("")

            say("Jestes gotowy aby rozpoczac nauke jazdy konnej ")

            say("Odwiedz Stajennego po wiecej informacji ")

            say("na temat jazdy. ")

        end

        when 20349.chat."Jezdziectwo 1" begin

            target.delete("__TARGET__")

            say_title("Stajenny: ")

            say("")

            say("Witaj")

            say("Sadzimy iz jestes juz gotowy aby rozpoczac ")

            say("nauke jazdy konnej. ")

            say("Dzieki licencji bedziesz mogl poruszac sie po ")

            say("swiecie o wiele szybciej. ")

            say("W takim razie zaczynajmy od razu! ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Zanim lecz zaczniemy musisz posiadac ")

            say("Medal Konny")

            say("To wlasnie on uprawnia mlodych adeptow ")

            say("do rozpoczecia nauki jazdy konnej. ")

            say("Zdobyc go mozesz od czlego ksztaltnych malp ")

            say("przebywajacych w jaskiniach lub ze zlotych szkatolek ")

            say("ktore mozesz znalezc po calym swiecie. ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Teraz juz lec zdobyc Medal Konny ")

            say("Bede tu czekal na Ciebie. ")

            set_state(go_to_disciple)

        end

    end

    state go_to_disciple begin

        when letter begin

            send_letter("Jezdziectwo 1")

        end

        when button or info begin

            say_title("Znajdz Medal Konny")

            say("")

            say("Stajenny potrzebuje Medalu Konnego ")

            say("by rozpoczac twoj trening. ")

            say("Znajdziesz go u malp lub w zlotych skrzyniach")

            say_item("Medal Konny ",50050,"")

        end

       

        when 20349.chat."Mam Medal" with pc.count_item(50050) >0 begin

            say_title("Stajenny: ")

            say("")

            say("Oh!! Znalazles medal!")

            say("Teraz mozemy rozpoczac trening. ")

            say("Tylko najpierw sprawdze czy aby to nie falszywka")

            wait()

            pc.remove_item(50050, 1)

            say_title("Stajenny: ")

            say("")

            say("Wyglada na prawdziwy")

            say("Zobaczmy co jest na zdobytym Medalu napisane.. ")

            set_state(first)

        end

    end

   

    state first begin

        when letter begin

            local v = find_npc_by_vnum(20349)

            if v != 0 then

                target.vid("__TARGET__", v, "Stajenny")

            end

            send_letter("Dziwna Sprawa")

        end

        when button or info begin

            say_title("Dziwna Sprawa")

            say("")

            say("Stajenny ma dla Ciebie informacje ")

            say("Porozmawiaj z nim ")

            say("jak najszybciej. ")

        end

       

        when 20349.chat."Ten Medal jest.." begin

            say_title("Stajenny: ")

            say("")

            say("Ciekawe... ")

            say("Wedlug informacji zapisanych na medalu.. ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Matko.. chyba twoj trening bedzie musial poczekac ")

            say("Wedlug tych informacji gang czleko ksztaltnych ")

            say("przygotowuje Wilki do ataku na nasza wioske ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Musimy sie tym szybko zajac ")

            say("Najlepiej bedzie dowiedziec sie kto przewodzi ")

            say("Wataha. ")

            say("Udaj sie do leza wilkow i poszukaj informacji. ")

            target.delete("__TARGET__")

            set_state(inf)

        end

    end

   

    state inf begin

        when letter begin

            send_letter("Nagle Zadanie")

        end

        when button or info begin

            say_title("Stajenny: ")

            say("")

            say("Poszukaj informacji na temat przywodcy Watahy ")

            say("Byc moze Elitarne jednostki Wilkow ")

            say("beda posiadac jakies informacje ")

            say("")

            say_reward("Zabij Cung-Mok ")

            say_reward("aby zdobyc informacje")

        end

       

        when 151.kill begin

            if number( 1, 100 ) <= 25 then

                local v = find_npc_by_vnum(20349)

                if v != 0 then

                    target.vid("__TARGET__", v, "Stajenny")

                end

                say_title("Nagle Zdanie")

                say("")

                say_reward("Ten Wilk posiada jakies informacje ")

                say_reward("Idz zawiadomic stajennego ")

                say("")

                set_state(second)

            else

                say_reward("Ten Wilk nie posiadal zadnych informacji")

            end

        end

    end

   

    state second begin

        when 20349.chat."Zdobylem Informacje" begin

            target.delete("__TARGET__")

            say_title("Stajenny: ")

            say("")

            say("Pokaz mi to!")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Nie jest dobrze.. ")

            say("Ale mamy chwile czasu na przygotowanie. ")

            say("")

            say("Dziekuje za zdobycie tych informacji ")

            say("Rada na pewno bedzie wdzieczna. ")

            say("Daj nam chwile czasu na obmyslenie planu. ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Jedyne co moge Ci zaoferowac za pomoc ")

            say("To dac Ci to po co do mnie przyszedles... ")

            wait()

            pc.change_money(500)

            pc.give_exp2(2500)

            pc.give_item2(50051, 1)

            horse.unride()

            horse.advance()

            horse.ride()

            say_title("Otrzymano: ")

            say_reward("Licencje Jazdy Konnej ")

            say_reward("500 yang")

            say_reward("2500 exp")

            set_quest_state("kon_2", "run")

            set_state(__COMPLETE__)

        end

    end

    state __COMPLETE__ begin

    end

end

2sd:
 

Spoiler

quest kon_2 begin

    state start begin

    end

    state run begin

        when login or levelup or enter with pc.get_level() >=8 begin

            set_state(information)

        end

    end

    state information begin

        when letter begin

            local v = find_npc_by_vnum(20349)

            if v != 0 then

                target.vid("__TARGET__", v, "Stajenny")

            end

            send_letter("Plan Gotowy")

        end

        when button or info begin

            say_title("Plan Gotowy")

            say("")

            say("Stajenny wzywa Cie do siebie ")

            say("Pospiesz sie zanim zaczna bez Ciebie! ")

        end

        when 20349.chat."Jaki jest plan?" begin

            target.delete("__TARGET__")

            say_title("Stajenny: ")

            say("")

            say("Jestes juz, nareszcie..")

            say("")

            say("Razem z rada doszlismy do wniosku ")

            say("ze atak ze strony Watahy jest blisko ")

            say("skoro Elity wilkow dostaly juz rozkazy ")

            say("otoczenia wioski. ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Na informacji ktore nam dostyarczyles ")

            say("widnialy wspolrzedne ")

            say("Udasz sie tam gdzie prowadza ")

            say("i zdasz mi relacje ")

            say("ale najpierw... ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("nie zapomnij przyniesc 2 Medali Konnych ")

            say("aby ukazac checi do wykonania zlecenia przez Rade ")

            say("Rada zgodzila sie szkolic twego Konia w zamian ")

            say("za wykonywanie misji, lecz chca widziec, ze Ci zalezy. ")

            set_state(go_to_disciple)

        end

    end

    state go_to_disciple begin

        when letter begin

            send_letter("Medal Konny")

        end

        when button or info begin

            say_title("Znajdz Medal Konny")

            say("")

            say("Rada potrzebuje 2 Medali Konnych ")

            say("by wiedziec, ze jestes wart misji ")

            say("Znajdziesz go u malp lub w zlotych skrzyniach")

            say_item("Medal Konny ",50050,"")

        end

       

        when 20349.chat."Mam 2 Medale" with pc.count_item(50050) >1 begin

            say_title("Stajenny: ")

            say("")

            say("Teraz Rada nie bedzie miec watpliwosci")

            say("ze chcesz podejmowac sie zadan. ")

            say("Im silniejszy twoj kon tym wiecej Medali bedzie potrzebnych ")

            say("Pozwol, ze odbiore je od Ciebie..")

            pc.remove_item(50050, 2)

            wait()

            say_title("Stajenny: ")

            say("")

            say("A wiec tutaj masz wspolrzedne z informacji")

            say("ktore dostarczyles wczesniej. ")

            say("Udaj sie tam niezwlocznie ")

            say("Tylko nie rob nic glupiego...")

            set_state(pos)

        end

    end

   

    state pos begin

        when letter begin

            send_letter("Miejsce docelowe")

            target.pos("__TARGET1__", 87, 880, 41, "Wspolrzedne")

        end

        when button or info begin

            say_title("Miejsce docelowe")

            say("")

            say("Udaj sie w miejsce")

            say("w ktore wkazuja wspolrzedne")

        end

        when __TARGET1__.target.arrive begin

            target.delete("__TARGET1__")

            say("Widzisz ogromnego Wilka.. ")

            say("Wyglada na porzywodce Watahy..")

            set_state(first)

        end

    end

   

    state first begin

        when letter begin

            local v = find_npc_by_vnum(20349)

            if v != 0 then

                target.vid("__TARGET__", v, "Stajenny")

            end

            send_letter("Zdaj raport")

        end

        when button or info begin

            say_title("Zdaj raport")

            say("")

            say("Zdaj raport Stajennemu")

            say("co widziales ")

            say("w miejscu wspolrzednych ")

        end

       

        when 20349.chat."Zdaj Raport" begin

            say_title("Stajenny: ")

            say("")

            say("Wielki wilk? Jeszcze powiedz ze byl ")

            say("Szary z bujna grzywa.. ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Jesli mnie pamiec nie myli ")

            say("Istota ta to elitarna jednosta Tigrisa! ")

            say("Lykos... ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Bardzo niebezpieczny ")

            say("Jesli to on przewodzi Wataha to mamy niemaly problem.. ")

            say("Jeszcze nie jestes gotow aby stawic mu czola ")

            say("Na te walke musimy Cie przygotowac ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Musimy pogrzyzowac mu plany ")

            say("Odszukaj drugiego Elitarnego Wilka i go zabij ")

            say("Moze troche tym wkurzymy Lykosa ")

            say("i zyskamy na czasie ")

            target.delete("__TARGET__")

            set_state(inf)

        end

    end

   

    state inf begin

        when letter begin

            send_letter("Elitarny Wilk")

        end

        when button or info begin

            say_title("Dywersja: ")

            say("")

            say_reward("Zabij Mu-Rang")

            say_reward("aby kupic troche czasu")

        end

       

        when 152.kill begin

            if number( 1, 100 ) <= 100 then

                local v = find_npc_by_vnum(20349)

                if v != 0 then

                    target.vid("__TARGET__", v, "Stajenny")

                end

                say_title("Mu Rang nie zyje")

                say("")

                say_reward("Donies Stajennemu  ")

                say_reward("ze Mu Rang nie zyje ")

                say("")

                set_state(second)

            end

        end

    end

   

    state second begin

        when 20349.chat."Zadanie zrobione?" begin

            target.delete("__TARGET__")

            say_title("Stajenny: ")

            say("")

            say("Bardzo dobra robota..")

            say("Oby kupilo nam to troche czasu..")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Dobrze sie spisales, zasluzyles ")

            say("na mini awans ")

            say("")

            say("Wroc do mnie gdy bedziesz silniejszy")

            wait()

            pc.change_money(1000)

            pc.give_exp2(10000)

            horse.unride()

            horse.advance()

            horse.ride()

            say_title("Otrzymano: ")

            say_reward("Awans Konia ")

            say_reward("1000 yang")

            say_reward("10000 exp")

            set_quest_state("kon_3", "run")

            set_state(__COMPLETE__)

        end

    end

    state __COMPLETE__ begin

    end

end

i have already wrote 12 quests,
if i upload 1st one, and someone complete it, he wont recieve second quest if its not uploaded already

And i dont understand what is this number  == "557528158" then

all of my 30 quests already have set quest state written

Edited by Mefarious
1 hour ago, Mefarious said:

Example of quests
 1st:
 

  Reveal hidden contents

quest kon_1 begin

    state start begin

        when login or levelup or enter with pc.get_level() >=4 begin

            set_state(information)

        end

    end

    state information begin

        when letter begin

            local v = find_npc_by_vnum(20349)

            if v != 0 then

                target.vid("__TARGET__", v, "Stajenny")

            end

            send_letter("Nauka Jazdy")

        end

        when button or info begin

            say_title("Nauka Jazdy")

            say("")

            say("Jestes gotowy aby rozpoczac nauke jazdy konnej ")

            say("Odwiedz Stajennego po wiecej informacji ")

            say("na temat jazdy. ")

        end

        when 20349.chat."Jezdziectwo 1" begin

            target.delete("__TARGET__")

            say_title("Stajenny: ")

            say("")

            say("Witaj")

            say("Sadzimy iz jestes juz gotowy aby rozpoczac ")

            say("nauke jazdy konnej. ")

            say("Dzieki licencji bedziesz mogl poruszac sie po ")

            say("swiecie o wiele szybciej. ")

            say("W takim razie zaczynajmy od razu! ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Zanim lecz zaczniemy musisz posiadac ")

            say("Medal Konny")

            say("To wlasnie on uprawnia mlodych adeptow ")

            say("do rozpoczecia nauki jazdy konnej. ")

            say("Zdobyc go mozesz od czlego ksztaltnych malp ")

            say("przebywajacych w jaskiniach lub ze zlotych szkatolek ")

            say("ktore mozesz znalezc po calym swiecie. ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Teraz juz lec zdobyc Medal Konny ")

            say("Bede tu czekal na Ciebie. ")

            set_state(go_to_disciple)

        end

    end

    state go_to_disciple begin

        when letter begin

            send_letter("Jezdziectwo 1")

        end

        when button or info begin

            say_title("Znajdz Medal Konny")

            say("")

            say("Stajenny potrzebuje Medalu Konnego ")

            say("by rozpoczac twoj trening. ")

            say("Znajdziesz go u malp lub w zlotych skrzyniach")

            say_item("Medal Konny ",50050,"")

        end

       

        when 20349.chat."Mam Medal" with pc.count_item(50050) >0 begin

            say_title("Stajenny: ")

            say("")

            say("Oh!! Znalazles medal!")

            say("Teraz mozemy rozpoczac trening. ")

            say("Tylko najpierw sprawdze czy aby to nie falszywka")

            wait()

            pc.remove_item(50050, 1)

            say_title("Stajenny: ")

            say("")

            say("Wyglada na prawdziwy")

            say("Zobaczmy co jest na zdobytym Medalu napisane.. ")

            set_state(first)

        end

    end

   

    state first begin

        when letter begin

            local v = find_npc_by_vnum(20349)

            if v != 0 then

                target.vid("__TARGET__", v, "Stajenny")

            end

            send_letter("Dziwna Sprawa")

        end

        when button or info begin

            say_title("Dziwna Sprawa")

            say("")

            say("Stajenny ma dla Ciebie informacje ")

            say("Porozmawiaj z nim ")

            say("jak najszybciej. ")

        end

       

        when 20349.chat."Ten Medal jest.." begin

            say_title("Stajenny: ")

            say("")

            say("Ciekawe... ")

            say("Wedlug informacji zapisanych na medalu.. ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Matko.. chyba twoj trening bedzie musial poczekac ")

            say("Wedlug tych informacji gang czleko ksztaltnych ")

            say("przygotowuje Wilki do ataku na nasza wioske ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Musimy sie tym szybko zajac ")

            say("Najlepiej bedzie dowiedziec sie kto przewodzi ")

            say("Wataha. ")

            say("Udaj sie do leza wilkow i poszukaj informacji. ")

            target.delete("__TARGET__")

            set_state(inf)

        end

    end

   

    state inf begin

        when letter begin

            send_letter("Nagle Zadanie")

        end

        when button or info begin

            say_title("Stajenny: ")

            say("")

            say("Poszukaj informacji na temat przywodcy Watahy ")

            say("Byc moze Elitarne jednostki Wilkow ")

            say("beda posiadac jakies informacje ")

            say("")

            say_reward("Zabij Cung-Mok ")

            say_reward("aby zdobyc informacje")

        end

       

        when 151.kill begin

            if number( 1, 100 ) <= 25 then

                local v = find_npc_by_vnum(20349)

                if v != 0 then

                    target.vid("__TARGET__", v, "Stajenny")

                end

                say_title("Nagle Zdanie")

                say("")

                say_reward("Ten Wilk posiada jakies informacje ")

                say_reward("Idz zawiadomic stajennego ")

                say("")

                set_state(second)

            else

                say_reward("Ten Wilk nie posiadal zadnych informacji")

            end

        end

    end

   

    state second begin

        when 20349.chat."Zdobylem Informacje" begin

            target.delete("__TARGET__")

            say_title("Stajenny: ")

            say("")

            say("Pokaz mi to!")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Nie jest dobrze.. ")

            say("Ale mamy chwile czasu na przygotowanie. ")

            say("")

            say("Dziekuje za zdobycie tych informacji ")

            say("Rada na pewno bedzie wdzieczna. ")

            say("Daj nam chwile czasu na obmyslenie planu. ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Jedyne co moge Ci zaoferowac za pomoc ")

            say("To dac Ci to po co do mnie przyszedles... ")

            wait()

            pc.change_money(500)

            pc.give_exp2(2500)

            pc.give_item2(50051, 1)

            horse.unride()

            horse.advance()

            horse.ride()

            say_title("Otrzymano: ")

            say_reward("Licencje Jazdy Konnej ")

            say_reward("500 yang")

            say_reward("2500 exp")

            set_quest_state("kon_2", "run")

            set_state(__COMPLETE__)

        end

    end

    state __COMPLETE__ begin

    end

end

2sd:
 

  Reveal hidden contents

quest kon_2 begin

    state start begin

    end

    state run begin

        when login or levelup or enter with pc.get_level() >=8 begin

            set_state(information)

        end

    end

    state information begin

        when letter begin

            local v = find_npc_by_vnum(20349)

            if v != 0 then

                target.vid("__TARGET__", v, "Stajenny")

            end

            send_letter("Plan Gotowy")

        end

        when button or info begin

            say_title("Plan Gotowy")

            say("")

            say("Stajenny wzywa Cie do siebie ")

            say("Pospiesz sie zanim zaczna bez Ciebie! ")

        end

        when 20349.chat."Jaki jest plan?" begin

            target.delete("__TARGET__")

            say_title("Stajenny: ")

            say("")

            say("Jestes juz, nareszcie..")

            say("")

            say("Razem z rada doszlismy do wniosku ")

            say("ze atak ze strony Watahy jest blisko ")

            say("skoro Elity wilkow dostaly juz rozkazy ")

            say("otoczenia wioski. ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Na informacji ktore nam dostyarczyles ")

            say("widnialy wspolrzedne ")

            say("Udasz sie tam gdzie prowadza ")

            say("i zdasz mi relacje ")

            say("ale najpierw... ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("nie zapomnij przyniesc 2 Medali Konnych ")

            say("aby ukazac checi do wykonania zlecenia przez Rade ")

            say("Rada zgodzila sie szkolic twego Konia w zamian ")

            say("za wykonywanie misji, lecz chca widziec, ze Ci zalezy. ")

            set_state(go_to_disciple)

        end

    end

    state go_to_disciple begin

        when letter begin

            send_letter("Medal Konny")

        end

        when button or info begin

            say_title("Znajdz Medal Konny")

            say("")

            say("Rada potrzebuje 2 Medali Konnych ")

            say("by wiedziec, ze jestes wart misji ")

            say("Znajdziesz go u malp lub w zlotych skrzyniach")

            say_item("Medal Konny ",50050,"")

        end

       

        when 20349.chat."Mam 2 Medale" with pc.count_item(50050) >1 begin

            say_title("Stajenny: ")

            say("")

            say("Teraz Rada nie bedzie miec watpliwosci")

            say("ze chcesz podejmowac sie zadan. ")

            say("Im silniejszy twoj kon tym wiecej Medali bedzie potrzebnych ")

            say("Pozwol, ze odbiore je od Ciebie..")

            pc.remove_item(50050, 2)

            wait()

            say_title("Stajenny: ")

            say("")

            say("A wiec tutaj masz wspolrzedne z informacji")

            say("ktore dostarczyles wczesniej. ")

            say("Udaj sie tam niezwlocznie ")

            say("Tylko nie rob nic glupiego...")

            set_state(pos)

        end

    end

   

    state pos begin

        when letter begin

            send_letter("Miejsce docelowe")

            target.pos("__TARGET1__", 87, 880, 41, "Wspolrzedne")

        end

        when button or info begin

            say_title("Miejsce docelowe")

            say("")

            say("Udaj sie w miejsce")

            say("w ktore wkazuja wspolrzedne")

        end

        when __TARGET1__.target.arrive begin

            target.delete("__TARGET1__")

            say("Widzisz ogromnego Wilka.. ")

            say("Wyglada na porzywodce Watahy..")

            set_state(first)

        end

    end

   

    state first begin

        when letter begin

            local v = find_npc_by_vnum(20349)

            if v != 0 then

                target.vid("__TARGET__", v, "Stajenny")

            end

            send_letter("Zdaj raport")

        end

        when button or info begin

            say_title("Zdaj raport")

            say("")

            say("Zdaj raport Stajennemu")

            say("co widziales ")

            say("w miejscu wspolrzednych ")

        end

       

        when 20349.chat."Zdaj Raport" begin

            say_title("Stajenny: ")

            say("")

            say("Wielki wilk? Jeszcze powiedz ze byl ")

            say("Szary z bujna grzywa.. ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Jesli mnie pamiec nie myli ")

            say("Istota ta to elitarna jednosta Tigrisa! ")

            say("Lykos... ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Bardzo niebezpieczny ")

            say("Jesli to on przewodzi Wataha to mamy niemaly problem.. ")

            say("Jeszcze nie jestes gotow aby stawic mu czola ")

            say("Na te walke musimy Cie przygotowac ")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Musimy pogrzyzowac mu plany ")

            say("Odszukaj drugiego Elitarnego Wilka i go zabij ")

            say("Moze troche tym wkurzymy Lykosa ")

            say("i zyskamy na czasie ")

            target.delete("__TARGET__")

            set_state(inf)

        end

    end

   

    state inf begin

        when letter begin

            send_letter("Elitarny Wilk")

        end

        when button or info begin

            say_title("Dywersja: ")

            say("")

            say_reward("Zabij Mu-Rang")

            say_reward("aby kupic troche czasu")

        end

       

        when 152.kill begin

            if number( 1, 100 ) <= 100 then

                local v = find_npc_by_vnum(20349)

                if v != 0 then

                    target.vid("__TARGET__", v, "Stajenny")

                end

                say_title("Mu Rang nie zyje")

                say("")

                say_reward("Donies Stajennemu  ")

                say_reward("ze Mu Rang nie zyje ")

                say("")

                set_state(second)

            end

        end

    end

   

    state second begin

        when 20349.chat."Zadanie zrobione?" begin

            target.delete("__TARGET__")

            say_title("Stajenny: ")

            say("")

            say("Bardzo dobra robota..")

            say("Oby kupilo nam to troche czasu..")

            wait()

            say_title("Stajenny: ")

            say("")

            say("Dobrze sie spisales, zasluzyles ")

            say("na mini awans ")

            say("")

            say("Wroc do mnie gdy bedziesz silniejszy")

            wait()

            pc.change_money(1000)

            pc.give_exp2(10000)

            horse.unride()

            horse.advance()

            horse.ride()

            say_title("Otrzymano: ")

            say_reward("Awans Konia ")

            say_reward("1000 yang")

            say_reward("10000 exp")

            set_quest_state("kon_3", "run")

            set_state(__COMPLETE__)

        end

    end

    state __COMPLETE__ begin

    end

end

i have already wrote 12 quests,
if i upload 1st one, and someone complete it, he wont recieve second quest if its not uploaded already

And i dont understand what is this number  == "557528158" then

all of my 30 quests already have set quest state written

 

The best way is too add the set_quest_state("kon_3", "run") even if the quest not exist yet. Example at end of your 12th quest you setup

 

set_quest_state("kon_13", "run")

And when the quest will exist, it's will read the run state of it

The number "557528158" come from database (it's egal to "__complete" state), if you go to quest database you will see than state are saved by number and not by name. So you can check the state number of your already finish quest to know what number is for the "complete" state

 

1 minute ago, PetePeter said:

 

The best way is too add the set_quest_state("kon_3", "run") even if the quest not exist yet. Example at end of your 12th quest you setup

 

set_quest_state("kon_13", "run")

And when the quest will exist, it's will read the run state of it

The number "557528158" come from database (it's egal to "__complete" state), if you go to quest database you will see than state are saved by number and not by name. So you can check the state number of your already finish quest to know what number is for the "complete" state

 

But as you can see, i already set this quest flag in all my quests, even if they are not exist, its not working
and one quest completed in mysql have different id for every player that did this quest, one have 1896384362, other have -278129975.
to get it work i have to clear all quest flags and and compile all the quest in chain

6 minutes ago, Mefarious said:

But as you can see, i already set this quest flag in all my quests, even if they are not exist, its not working
and one quest completed in mysql have different id for every player that did this quest, one have 1896384362, other have -278129975.
to get it work i have to clear all quest flags and and compile all the quest in chain

The number on the database depend of the name of your complete state. If you name it "complete" or "__complete" or "__complete__" it's all different numbers. Normally if you use the same name for your complete state you must have the same number. And so you can do something like that:
 

 quest kon_2 begin

    state start begin
		when login or levelup or enter with pc.get_level() >= 8 begin
			local valueComplete = "557528158"				
			questState = get_quest_state("kon_1")
			questStateFormated = string.format("%d",  questState)

			if questStateFormated == valueComplete then
  				setstate(run)
  			end
		end
    end

    state run begin

        when login or levelup or enter with pc.get_level() >=8 begin

            set_state(information)

        end

    end 

	[...]


 

7 minutes ago, PetePeter said:

The number on the database depend of the name of your complete state. If you name it "complete" or "__complete" or "__complete__" it's all different numbers. Normally if you use the same name for your complete state you must have the same number. And so you can do something like that:
 

 quest kon_2 begin

    state start begin
		when login or levelup or enter with pc.get_level() >= 8 begin
			local valueComplete = "557528158"				
			questState = get_quest_state("kon_1")
			questStateFormated = string.format("%d",  questState)

			if questStateFormated == valueComplete then
  				setstate(run)
  			end
		end
    end

    state run begin

        when login or levelup or enter with pc.get_level() >=8 begin

            set_state(information)

        end

    end 

	[...]


 

When i look into database in quest table i see this

64746    lead    __status    1896384362
64696    lead    __status    -278129975
64691    lead    __status    1395287876
3 different player completed the same quest but they got different number, or im looking in bad table

7 minutes ago, Mefarious said:

When i look into database in quest table i see this

64746    lead    __status    1896384362
64696    lead    __status    -278129975
64691    lead    __status    1395287876
3 different player completed the same quest but they got different number, or im looking in bad table

Why are you looking for "lead" quest ? Check the status of the "kon_1"

Im giving example because i wont let anyone do kon_1 quest untill i solve this problem, i dont want people to complete it yet
every quest has different ID for every player

2 hours ago, TMP4 said:

You can check in the 8th quest if the 7th is complete:

state start begin
	if string.format("%d", get_quest_state('your_7th_quest_name') == "557528158" then
		set_state(run)
	end
end
state run begin
	-- start of your quest
end

Okey tried this, but doesnt work

Edited by Mefarious
37 minutes ago, Mefarious said:

Im giving example because i wont let anyone do kon_1 quest untill i solve this problem, i dont want people to complete it yet
every quest has different ID for every player

Okey tried this, but doesnt work

As I told you every state have a different number. Finish the kon_1 on your test server and look at the state number (You need wait the cache to save the quest on DB) and use this value on the code.

From the example you sent from the 3 players, are you sure they all completed it ?

2 minutes ago, PetePeter said:

As I told you every state have a different number. Finish the kon_1 on your test server and look at the state number (You need wait the cache to save the quest on DB) and use this value on the code.

From the example you sent from the 3 players, are you sure they all completed it ?

Yes im very sorry, im dumb. they are not at the same level to complete whole quest...
But i already tried with quest id state, nothing happened, quest still doesnt show up 

i completed whole quest, got ID, 
then compiled second quest with id check
started server
quest didnt show up
 

Edited by Mefarious

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.