Jump to content

Recommended Posts

Hey everyone!

Pretty self-explanatory: if I level up by a quest exp reward, the new quests won't pop up.

I have a solution, but it only solves the problem partly: using set_quest_state("xx","xy").

It works, but my problem is -> Its not realistic to implement this with every variant possible to every quest. (It can be done, just not so efficent)

Also, it messes with the levelup quest (hunting quest each level). (It leaves the "buttonstate" qf on -1, meaning no relog or nothing can help it. (I mean yea, I can manually do it but again - not realistic."))

 

I just want to solve this problem once and for all. Anyone can help me with this?

Thanks in advance!

Link to comment
https://metin2.dev/topic/33329-quest-level-up-pcgive_exp2/
Share on other sites

  • Honorable Member
9 hours ago, farmmedal said:

Hey everyone!

Pretty self-explanatory: if I level up by a quest exp reward, the new quests won't pop up.

I have a solution, but it only solves the problem partly: using set_quest_state("xx","xy").

It works, but my problem is -> Its not realistic to implement this with every variant possible to every quest. (It can be done, just not so efficent)

Also, it messes with the levelup quest (hunting quest each level). (It leaves the "buttonstate" qf on -1, meaning no relog or nothing can help it. (I mean yea, I can manually do it but again - not realistic."))

 

I just want to solve this problem once and for all. Anyone can help me with this?

Thanks in advance!

Sorry, but I really don't understand what's the issue here.
https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

quest test begin
    state start begin
        when enter begin
            syschat("..And now we're back to the start.. so yeah.")
        end -- when

        when leave begin
            q.done();
        end -- when

        when letter begin
            send_letter("Start the quest!")
        end -- when

        when button or info begin
            set_state("in_mission");
        end -- when
    end -- state

    state in_mission begin
        when enter begin
            pc.setqf("remaining", 1);
            syschat("You're now in mission state! Kill a mob to level up, I guess?")
        end -- when

        when kill with not npc.is_pc() begin
            local new_remaining = pc.getqf("remaining")-1;
            pc.setqf("remaining", new_remaining);
            if (new_remaining > 0) then
                return;
            end -- if

            pc.give_exp2(pc.get_next_exp());
            set_state("start");
        end -- when
    end -- state
end -- quest

Use your triggers cleanly and efficiently, and you won't ever have any issue.

Edited by Metin2 Dev International
Core X - External 2 Internal
  • muscle 1

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
https://metin2.dev/topic/33329-quest-level-up-pcgive_exp2/#findComment-168718
Share on other sites

Thanks for the answer!

state ending begin	-- the ending of a random quest
	when 9003.chat."You are about to level up?" begin
		say("Here is your reward.")
		wait()
		pc.give_exp2(150)
		set_state(__complete__)
	end
end

--Lets say I'm level 1 with pc.get_exp() == 150. This means, with this exp reward, I will reach level 2.

quest lv2quest begin -- This is the beginning of an another quest.
	state newquest begin 
		state start begin
			when login or levelup with pc.get_level() >= 2 then
			set_state(newquestbegin)
		end
	end
end

--I receive my reward, reach level 2 by the quest reward (pc.give_exp2, at the end of the first quest), but "levelup" won't trigger,
--will not load up the new quest. When doing a relog, the "login" part triggers of course, but this does not seem very professional.
--It works simply with every other way -> If I level up via gm command or by killing monsters, everything works simply., all the quests load up as they
--should
--I tried and used set_quest_state, but there are a lot of possibilities, again, not a clean work. It works - but it's not realistic to use it.

I hope this way it becomes more understandable. The pc.give_exp2, that results in a level up will not trigger the "levelup" on other quests.

Link to comment
https://metin2.dev/topic/33329-quest-level-up-pcgive_exp2/#findComment-168719
Share on other sites

  • Honorable Member
4 hours ago, farmmedal said:

Thanks for the answer!

state ending begin	-- the ending of a random quest
	when 9003.chat."You are about to level up?" begin
		say("Here is your reward.")
		wait()
		pc.give_exp2(150)
		set_state(__complete__)
	end
end

--Lets say I'm level 1 with pc.get_exp() == 150. This means, with this exp reward, I will reach level 2.

quest lv2quest begin -- This is the beginning of an another quest.
	state newquest begin 
		state start begin
			when login or levelup with pc.get_level() >= 2 then
			set_state(newquestbegin)
		end
	end
end

--I receive my reward, reach level 2 by the quest reward (pc.give_exp2, at the end of the first quest), but "levelup" won't trigger,
--will not load up the new quest. When doing a relog, the "login" part triggers of course, but this does not seem very professional.
--It works simply with every other way -> If I level up via gm command or by killing monsters, everything works simply., all the quests load up as they
--should
--I tried and used set_quest_state, but there are a lot of possibilities, again, not a clean work. It works - but it's not realistic to use it.

I hope this way it becomes more understandable. The pc.give_exp2, that results in a level up will not trigger the "levelup" on other quests.

 

quest lv2quest begin -- This is the beginning of an another quest.
	state newquest begin 
		state start begin


um.. what? 

Also why would you need something like this? Either you're asking for a quest that brings you missions on certain levels, which you should do on a single questfile, for example levelup_missions, where you can make a clean series of quests bouncing back between 2-3 states in a moderate amount of lines, or you're asking for a quest that enables another quest, which needs the setting of a remote state via set_quest_state.

By default (official also did this with 1-2 quests iirc) if you really need to activate levelup quests upon leveling up via pc.give_exp2(), either you fix it sourceside or you have to code the quests differently.

Pro tip: when letter trigger is your friend.

Edited by Syreldar

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
https://metin2.dev/topic/33329-quest-level-up-pcgive_exp2/#findComment-168724
Share on other sites

I made a video because I feel that it's still not understandable what I would like to achieve.

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

Edit: While I made the video, you expanded your answer. Could you please explain what do you mean under source especially?

I had an answer from @ WeedHex two years ago:

I think its because of C++.

Using the questlua_pc.cpp function GiveExp() you won't trigger this:

quest::CQuestManager::instance().LevelUp(GetPlayerID());
So

when login or levelup

Only login will works.

Edited August 29, 2022 by WeedHex

Yet it's still unsolved. Could not figure it out.😞

 

The "levelup" part is already "solved" by putting

set_quest_state("levelup","run")

to the end of a each and every quest, so it works but let's be honest, only counts as a "half-solution".

Edited by Metin2 Dev International
Core X - External 2 Internal
Link to comment
https://metin2.dev/topic/33329-quest-level-up-pcgive_exp2/#findComment-168725
Share on other sites

  • Honorable Member
7 minutes ago, farmmedal said:

Could you please explain what do you mean under source especially?

Exactly what I said, you open your sources and make it so the GiveExp function enables the levelup trigger. By default it doesn't, so you would have to code the quest differently.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
https://metin2.dev/topic/33329-quest-level-up-pcgive_exp2/#findComment-168726
Share on other sites

The problem is:

- I barely understand anything of the code, because its c++ and I do not know any of that language.

- I could not find "quest::CQuestManager::instance().LevelUp(GetPlayerID());" in the original files either. - so I have nothing to compare to.

Simply I can not figure it out myself, thats why I'm asking for help here. I'm not a programmer, but I do try my best.

I know it's not a small thing to ask, but for me it seems impossible to achieve, while it looks like its around 2 minutes for you guys.

I did not mean any offense of course, I would just most value if any of you could help me with this matter.

Thanks!

 

Link to comment
https://metin2.dev/topic/33329-quest-level-up-pcgive_exp2/#findComment-168727
Share on other sites

Thank you for your answer!

Tried it, it compiles well but not working.

					if (exp + amount >= next_exp)
					{
						iExpBalance = (exp + amount) - next_exp;
						amount = next_exp - exp;

						SetExp(0);
						exp = next_exp;
						quest::CQuestManager::instance().LevelUp(GetPlayerID());
					}
					else

I feel like it's close, but not quite there.

Link to comment
https://metin2.dev/topic/33329-quest-level-up-pcgive_exp2/#findComment-168745
Share on other sites

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.