Jump to content

Fix Mount HP/MP unmount mount Affects


Recommended Posts

Hello, 2-3 days ago I encountered a small bug, and it took me a while to figure out what the problem was.

Q: What does this bug consist of? When you mount/unmount with an active affect, it decreases your HP/MP."

Like https://metin2.download/video/lyZ8QAZR6iDE0uA8zaFoul4ch0s7VtYx/.mp4

Let's fix it.

Open char.cpp and search : void CHARACTER::ComputePoints()

then search on that functions :

	SetMaxStamina(iMaxStamina);

add under like :

	SetMaxStamina(iMaxStamina);

	int iCurHP = this->GetHP();
	int iCurSP = this->GetSP();

then on that function too search :

 

    CPetSystem* pPetSystem = GetPetSystem();
    if (NULL != pPetSystem)

/ u will have like this 

	ComputeSkillPoints();

	RefreshAffect();
	CPetSystem* pPetSystem = GetPetSystem();
	if (NULL != pPetSystem)
	{
		pPetSystem->RefreshBuff();
	}

	for (TMapBuffOnAttrs::iterator it = m_map_buff_on_attrs.begin(); it != m_map_buff_on_attrs.end(); it++)
	{
		it->second->GiveAllAttributes();
	}

	UpdatePacket();
}

just make it like this 

	ComputeSkillPoints();

	RefreshAffect();
	if (IsPC())
	{
		CPetSystem * pPetSystem = GetPetSystem();
		if (pPetSystem)
			pPetSystem->RefreshBuff();

		// @Fixed Hp/Mp mount/unmount
		if (this->GetHP() != iCurHP)
			this->PointChange(POINT_HP, iCurHP-this->GetHP());
		if (this->GetSP() != iCurSP)
			this->PointChange(POINT_SP, iCurSP-this->GetSP());
	}

	UpdatePacket();
}

like u copy just this

	if (IsPC())
	{
		CPetSystem * pPetSystem = GetPetSystem();
		if (pPetSystem)
			pPetSystem->RefreshBuff();

		// @Fixed Hp/Mp mount/unmount
		if (this->GetHP() != iCurHP)
			this->PointChange(POINT_HP, iCurHP-this->GetHP());
		if (this->GetSP() != iCurSP)
			this->PointChange(POINT_SP, iCurSP-this->GetSP());
	}

	UpdatePacket();
}

I know that it mentions the pet system there, but this solution resolved the mount/unmount HP/MP decrease issue

AFTER:

https://metin2.download/video/hSGH8YjPmSZ7R4dGrdBpovaluRK47GC1/.mp4

Edited by Metin2 Dev International
Core X - External 2 Internal
  • kekw 2
Link to comment
https://metin2.dev/topic/33038-fix-mount-hpmp-unmount-mount-affects/
Share on other sites

12 minutes ago, TAUMP said:

Yep, copy paste from Martysama source, kek

It doesn’t matter where the fix comes from, as long as it works and solves the problem. Not everyone is a "PRO" dev, and that's perfectly fine. What matters is that you found a solution, even if it wasn’t online but in the source code. Everyone has their own learning path, and it’s normal not to find every answer on the internet.

The important thing is that you adapted and figured it out. You don’t have to be a pro to make progress or solve problems—every achievement counts.

4 minutes ago, Mafuyu said:

and what happens with 

	for (TMapBuffOnAttrs::iterator it = m_map_buff_on_attrs.begin(); it != m_map_buff_on_attrs.end(); it++)
	{
		it->second->GiveAllAttributes();
	}

??

Nothing will happen, it's from the Ymir source, so it won't cause any issues because most likely a pointer this .

This is the default function.

  • Active+ Member
4 minutes ago, Mafuyu said:

so delete it? move it above your new block? what should we do with it? you removed it in your code 

He took this code from a leaked source, so he probably doesn't even know.

  • kekw 1

I posted this just to help others, yes, it's from Marty Fix, but I don't think we need to be so mean and mock it. If it doesn't help you at all, I ask for this post to be deleted, and that's all.

I posted this because I couldn't find a solution on the internet, and not all of us are PROs in C++. I was hoping it would help others as well.

Edited by DakaSenpai99
  • Good 1
24 minutes ago, DakaSenpai99 said:

I posted this just to help others, yes, it's from Marty Fix, but I don't think we need to be so mean and mock it. If it doesn't help you at all, I ask for this post to be deleted, and that's all.

I posted this because I couldn't find a solution on the internet, and not all of us are PROs in C++. I was hoping it would help others as well.

Sure, but first you need to analyze why marty get rid of that part and find this solution if you want to contribute instead of copy paste his edit. My laugh is not about that but becouse of this part:

"It's from the Ymir source, so it won't cause any issues"

Probably become my new motto.

20 hours ago, Mafuyu said:

so still people dont know what to make with the missing part.

it->second is the value the object associated with the key in the map, meaning the object containing the buff.
GiveAllAttributes() is a method called on that object likely an active buff that applies all attributes (stats or effects) to a character or entity.
Thus, the function ensures that all buffs in m_map_buff_on_attrs apply their attributes to the associated character or entity.

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