Jump to content
×
×
  • Create New...

How To Fix StunBug


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

  • Premium

I suppose that real developers wrote a whole game once and they had never developed it after, so ymir has to employ new developers who weren't as good as firsts

 

This.

 

The original team that created the game left Ymir many years ago.

  • Love 1

 

 

Link to comment
Share on other sites

  • 2 months later...

By removing

m_pOwner->SetImmuneFlag(dwImmuneFlag);

You are just removing the flag setting. i.e, no immune bug, because there won't be any immunes anymore!

The rest of the code is therefore useless because you just change a locally scoped variable which you don't use.

Link to comment
Share on other sites

SetImmuneFlag called in other functions too. This code causes that the last immune has no effect. For example: if you have stun and slow immune in a shield, only stun will work, slow won't...

$ uptime
1:26AM  up 732 days,  8:29, 1 user, load averages: 0.38, 0.31, 0.22

$ uname -srp
FreeBSD 9.1-RELEASE amd64

Link to comment
Share on other sites

SetImmuneFlag called in other functions too. This code causes that the last immune has no effect. For example: if you have stun and slow immune in a shield, only stun will work, slow won't...

 

Which functions? I only see it in the monster-only section "SetProto".

 

Link to comment
Share on other sites

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

$ uptime
1:26AM  up 732 days,  8:29, 1 user, load averages: 0.38, 0.31, 0.22

$ uname -srp
FreeBSD 9.1-RELEASE amd64

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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.