Jump to content

How to block deal damage


Recommended Posts

  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic

  • Premium

For hit damage:

Look for:

	if (iDam <= 0) {
		return (BATTLE_DAMAGE);
	}

Paste this ABOVE:

	//begin hit block damage with sword +5   (vnum 15)
	if (pkAttacker->FindSpecifyItem(15) && pkVictim->IsNPC())
	{
		iDam = 0;
	}
	//end hit block damage with sword + 5(vnum 15)

Like in the print:

imagem86d661f4a7c29d0c.png

 

Go ingame and test it.

If you damage a mob with a hit while having a sword +5 (vnum) in inventory, damage will be 0.

 

That will work for weapon hits.

You also need to edit this function for arrows damage:

int CalcArrowDamage

 

And if you also want to block skills damage, you will need to edit it at char_skill.cpp, here:

FuncSplashDamage

 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

8 godzin temu, tierrilopes napisał:

For hit damage:

Look for:


	if (iDam <= 0) {
		return (BATTLE_DAMAGE);
	}

Paste this ABOVE:


	//begin hit block damage with sword +5   (vnum 15)
	if (pkAttacker->FindSpecifyItem(15) && pkVictim->IsNPC())
	{
		iDam = 0;
	}
	//end hit block damage with sword + 5(vnum 15)

Like in the print:

imagem86d661f4a7c29d0c.png

 

Go ingame and test it.

If you damage a mob with a hit while having a sword +5 (vnum) in inventory, damage will be 0.

 

That will work for weapon hits.

You also need to edit this function for arrows damage:


int CalcArrowDamage

 

And if you also want to block skills damage, you will need to edit it at char_skill.cpp, here:


FuncSplashDamage

 

I don't need block deal damage when item is in inventory, i want block deal damage when item is equpped. 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Bot
1 hour ago, avertuss said:

LPITEM pItem = pkAttacker->GetWear(WEAR_WRIST);
	if (pItem && pItem->GetVnum() == 16209 && pItem->IsEquipped() && pkVictim->IsNPC())
    	return 0;

in int battle_hit(LPCHARACTER pkAttacker, LPCHARACTER pkVictim, int & iRetDam) and it doesn't work. 

Try this:

open: char_battle.cpp

search:

bool CHARACTER::Damage(LPCHARACTER pAttacker, int dam, EDamageType type)

after { add:

		
	if (pkAttacker->GetWear(WEAR_WRIST) and pkAttacker->IsEquipped(16209))
	{
		SendDamagePacket(pAttacker, 0, DAMAGE_BLOCK);
		return false;
	}

No tested, maybe work...

english_banner.gif

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.