Jump to content

How To Fix StunBug


Lazy

Recommended Posts

Hey. Long time ago I did fix on the StunBug, but just now I decided to share this. :lol:
So... Open the file item.cpp and go to functions: EquipTo & Unequip.

Find this:

	DWORD dwImmuneFlag = 0;

	for (int i = 0; i < WEAR_MAX_NUM; ++i)
		if (m_pOwner->GetWear(i))
			SET_BIT(dwImmuneFlag, m_pOwner->GetWear(i)->m_pProto->dwImmuneFlag);

	m_pOwner->SetImmuneFlag(dwImmuneFlag);

Replace with:

	DWORD dwImmuneFlag = 0;

	for (int i = 0 ; i < WEAR_MAX_NUM; i++) 
	{
		LPITEM pItem = m_pOwner->GetWear(i);
		if (pItem)
		{
			SET_BIT(dwImmuneFlag, m_pOwner->GetWear(i)->GetImmuneFlag());
		}
	}

Ayo!

  • Love 8
Link to comment
Share on other sites

  • Premium

Well. You removed only

m_pOwner->SetImmuneFlag(dwImmuneFlag);

Why?

Stun bug is caused by the certain chance of apply.

(80% i think)

Regards.

If the last item you equipped is not the shield, inmune doesn't work at all, that's the bug since the creation of Metin.

Link to comment
Share on other sites

Well. You removed only

m_pOwner->SetImmuneFlag(dwImmuneFlag);

Why?

Stun bug is caused by the certain chance of apply.

(80% i think)

Regards.

If you equiped e.g. armor and this item haven't any immunes then immunes set to 0, it's delete all immunes. Now doesn't delete immunes just added immunes contained in item.

Link to comment
Share on other sites

  • 3 weeks later...
Actually, the chance you are talking about is in char_resist.cpp. Stun resistance has just 90% of success. This is not a bug, but if you want Stun fixed 100%, you'd also change this:
bool CHARACTER::IsImmune(DWORD dwImmuneFlag)
{
	if (IS_SET(m_pointsInstant.dwImmuneFlag, dwImmuneFlag))
	{
		int immune_pct = 90;
		int	percent = number(1, 100);

		if (percent <= immune_pct)	// 90% Immune
		{
			if (test_server && IsPC())
				ChatPacket(CHAT_TYPE_PARTY, "<IMMUNE_SUCCESS> (%s)", GetName()); 

			return true;
		}
		else
		{
			if (test_server && IsPC())
				ChatPacket(CHAT_TYPE_PARTY, "<IMMUNE_FAIL> (%s)", GetName());

			return false;
		}
	}

	if (test_server && IsPC())
		ChatPacket(CHAT_TYPE_PARTY, "<IMMUNE_FAIL> (%s) NO_IMMUNE_FLAG", GetName());

	return false;
}

 

to this:
 
bool CHARACTER::IsImmune(DWORD dwImmuneFlag)
{
	if (IS_SET(m_pointsInstant.dwImmuneFlag, dwImmuneFlag))
	{
		if (test_server && IsPC())
			ChatPacket(CHAT_TYPE_PARTY, "<IMMUNE_SUCCESS> (%s)", GetName()); 

		return true;
	}

	if (test_server && IsPC())
		ChatPacket(CHAT_TYPE_PARTY, "<IMMUNE_FAIL> (%s) NO_IMMUNE_FLAG", GetName());

	return false;
}

 

 

  • Love 3
Link to comment
Share on other sites

  • 2 months later...
  • Active Member

Ok, finally i've solved the problem (i think).
 
i've added some lines to cmd_gm.cpp, so /state proint the immune flags too (just for checking):
Look for ACMD(do_state)
then add:

	ch->ChatPacket(CHAT_TYPE_INFO, "IMMUNE:");
	ch->ChatPacket(CHAT_TYPE_INFO, "   STUN:%d SLOW:%d FALL:%d",
			tch->GetPoint(POINT_IMMUNE_STUN),
			tch->GetPoint(POINT_IMMUNE_SLOW),
			tch->GetPoint(POINT_IMMUNE_FALL));

Looks like this:

 

ch->ChatPacket(CHAT_TYPE_INFO, "   ICE:%3d%% EARTH:%3d%% DARK:%3d%%",
   tch->GetPoint(POINT_RESIST_ICE),
   tch->GetPoint(POINT_RESIST_EARTH),
   tch->GetPoint(POINT_RESIST_DARK));
  
ch->ChatPacket(CHAT_TYPE_INFO, "IMMUNE:");
ch->ChatPacket(CHAT_TYPE_INFO, "   STUN:%d SLOW:%d FALL:%d",
   tch->GetPoint(POINT_IMMUNE_STUN),
   tch->GetPoint(POINT_IMMUNE_SLOW),
   tch->GetPoint(POINT_IMMUNE_FALL));

ch->ChatPacket(CHAT_TYPE_INFO, "MALL:");
ch->ChatPacket(CHAT_TYPE_INFO, "   ATT:%3d%% DEF:%3d%% EXP:%3d%% ITEMx%d GOLDx%d",

 

In item.cpp it's not a big change, but it seems working for me:

(In functions bool CItem::EquipTo and bool CItem::Unequip)

	for (int i = 0; i < WEAR_MAX_NUM; ++i)
	{
		if (m_pOwner->GetWear(i))
		{
			SET_BIT(dwImmuneFlag, m_pOwner->GetWear(i)->GetImmuneFlag());
		}
	}
	m_pOwner->SetImmuneFlag(dwImmuneFlag);

post-211-0-98685400-1404630314_thumb.jpg

Link to comment
Share on other sites

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.