avertuss 48 Posted April 15, 2018 Share Posted April 15, 2018 Hi. How to block deal damage to mobs if player has weared item with vnum 12345? Something like this in battle.cpp? if (pAttacker->GetVnum() == 12345 && pkVictim->IsNPC()) { iAtk = iAtk*0.1; } Link to comment Share on other sites More sharing options...
JarajTo 40 Posted April 16, 2018 Share Posted April 16, 2018 Yes, good code. It definitely works recommend Link to comment Share on other sites More sharing options...
avertuss 48 Posted April 17, 2018 Author Share Posted April 17, 2018 f5 Link to comment Share on other sites More sharing options...
Premium tierrilopes 452 Posted April 18, 2018 Premium Share Posted April 18, 2018 (edited) 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: 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 August 24, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
avertuss 48 Posted April 18, 2018 Author Share Posted April 18, 2018 (edited) 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: 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 August 24, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Active Member hachiwari 138 Posted April 18, 2018 Active Member Share Posted April 18, 2018 LPITEM pItem = pkAttacker->GetWear(WEAR_WEAPON); if (pItem && pItem->GetVnum() == 15 && pItem->IsEquipped() && pkVictim->IsNPC()) return 0; Link to comment Share on other sites More sharing options...
avertuss 48 Posted April 18, 2018 Author Share Posted April 18, 2018 2 godziny temu, hachiwari napisał: LPITEM pItem = pkAttacker->GetWear(WEAR_WEAPON); if (pItem && pItem->GetVnum() == 15 && pItem->IsEquipped() && pkVictim->IsNPC()) return 0; Where should i add it? Will it work with WEAR_WRIST etc? Link to comment Share on other sites More sharing options...
Bot Metin2 Dev 4882 Posted April 18, 2018 Bot Share Posted April 18, 2018 7 hours ago, avertuss said: Where should i add it? Will it work with WEAR_WRIST etc? battle.cpp 1 Link to comment Share on other sites More sharing options...
avertuss 48 Posted April 18, 2018 Author Share Posted April 18, 2018 4 godziny temu, WLsj24 napisał: battle.cpp 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. Link to comment Share on other sites More sharing options...
Bot Metin2 Dev 4882 Posted April 18, 2018 Bot Share Posted April 18, 2018 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... Link to comment Share on other sites More sharing options...
Premium tierrilopes 452 Posted April 21, 2018 Premium Share Posted April 21, 2018 On 18/04/2018 at 10:55 AM, avertuss said: I don't need block deal damage when item is in inventory, i want block deal damage when item is equpped. FindSpecifyItem >> GetItem (equiped cell slot) Link to comment Share on other sites More sharing options...
Management Karbust 4884 Posted April 21, 2018 Management Share Posted April 21, 2018 Can I also use something like this on the RING1 and RING2 slots? @tierrilopes Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now