Adrian1428 31 Posted February 28, 2015 Share Posted February 28, 2015 (edited) I added pet attacking system and I have next bug: pet can drop item from mobs How can I solve this? Items have the pet owner's name or owner can pickup the items if pet is his. I tried something but doesn't work. Thanks in advance. Pet attacking: Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Adrian1428 31 Posted February 28, 2015 Author Share Posted February 28, 2015 #up Link to comment Share on other sites More sharing options...
Deucalion 249 Posted February 28, 2015 Share Posted February 28, 2015 (edited) In char_battle.cpp you have sth like this void CHARACTER::Reward(bool bItemDrop) there you have if (CBattleArena::instance().IsBattleArenaMap(pkAttacker->GetMapIndex()) == false) { item->SetOwnership(pkAttacker); } And you can use method to take id or e.g create a new method bool isPet() Edited February 28, 2015 by Deucalion 1 Link to comment Share on other sites More sharing options...
ѕeмa™ 308 Posted February 28, 2015 Share Posted February 28, 2015 (edited) i dont try it, in a few minutes , i go to try it, but i think this will work. Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal 1 https://m2admin.net/ Link to comment Share on other sites More sharing options...
The Naid 118 Posted February 28, 2015 Share Posted February 28, 2015 (edited) i dont try it, in a few minutes , i go to try it, but i think this will work. Pet's last hit = 0 drop. Great solution bro, Next time use brain. Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
ѕeмa™ 308 Posted February 28, 2015 Share Posted February 28, 2015 (edited) i dont try it, in a few minutes , i go to try it, but i think this will work. Pet's last hit = 0 drop. Great solution bro, Next time use brain. the best soultion = pet drop can get the owner. ok, when 2 players attack a metin, 2 players get rewards right? if the pet dont do the last hit, but the pet attack, both can have drops. Great solution bro, Next time use brain. Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal 1 https://m2admin.net/ Link to comment Share on other sites More sharing options...
newja 53 Posted February 28, 2015 Share Posted February 28, 2015 (edited) if (CBattleArena::instance().IsBattleArenaMap(pkAttacker->GetMapIndex()) == false) { if (pkAttacker->IsPC()) { item->SetOwnership(pkAttacker); } else if (pkAttacker->IsPet()) { for (CPetSystem::TPetActorMap::iterator go = pkAttacker->GetPetSystem()->m_petActorMap.begin();go != pkAttacker->GetPetSystem()->m_petActorMap.end(); ++go) { CPetActor* petActor = go->second; if (NULL != petActor) { LPCHARACTER own = petActor->GetOwner(); if (own) { item->SetOwnership(own); } } } } } I'm not using pet attack system so I can't test it. I'm 50% sure it works. Include must be added: #include "PetSystem.h" Regards, newja #Edit Works. Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal 4 Link to comment Share on other sites More sharing options...
jma96 1 Posted March 1, 2015 Share Posted March 1, 2015 Are you sure this work 100%? Because we already tried this and sometimes it works and sometimes not. Link to comment Share on other sites More sharing options...
Adrian1428 31 Posted March 1, 2015 Author Share Posted March 1, 2015 #delete Link to comment Share on other sites More sharing options...
Adrian1428 31 Posted March 1, 2015 Author Share Posted March 1, 2015 if (CBattleArena::instance().IsBattleArenaMap(pkAttacker->GetMapIndex()) == false) { if (pkAttacker->IsPC()) { item->SetOwnership(pkAttacker); } else if (pkAttacker->IsPet()) { for (CPetSystem::TPetActorMap::iterator go = pkAttacker->GetPetSystem()->m_petActorMap.begin();go != pkAttacker->GetPetSystem()->m_petActorMap.end(); ++go) { CPetActor* petActor = go->second; if (NULL != petActor) { LPCHARACTER own = petActor->GetOwner(); if (own) { item->SetOwnership(own); } } } } } I'm not using pet attack system so I can't test it. I'm 50% sure it works. Include must be added: #include "PetSystem.h" Regards, newja I tested but not works , I put the TPetActorMap m_petActorMap; public and not work. Link to comment Share on other sites More sharing options...
Deucalion 249 Posted March 1, 2015 Share Posted March 1, 2015 Problem is with SetOwnership yes? So maybe only need to add sth like this: if (ch->IsPet()) { for (CPetSystem::TPetActorMap::iterator iter = to->GetPetSystem()->m_petActorMap.begin(); iter != to->GetPetSystem()->m_petActorMap.end(); ++iter){ if (CPetActor* petActor = iter->second){ ch = petActor->GetOwner(); } } } in item.cpp in method void CItem::SetOwnership(LPCHARACTER ch, int iSec) above m_dwOwnershipPID = ch->GetPlayerID(); So the pice of code should look like this: if (true == LC_IsEurope()) { if (iSec <= 10) iSec = 30; } if (ch->IsPet()) { for (CPetSystem::TPetActorMap::iterator iter = to->GetPetSystem()->m_petActorMap.begin(); iter != to->GetPetSystem()->m_petActorMap.end(); ++iter){ if (CPetActor* petActor = iter->second){ ch = petActor->GetOwner(); } } } m_dwOwnershipPID = ch->GetPlayerID(); item_event_info* info = AllocEventInfo<item_event_info>(); It's untested! Efit: of course you need to add include "PetSystem.h" on the top of the file 1 Link to comment Share on other sites More sharing options...
newja 53 Posted March 1, 2015 Share Posted March 1, 2015 Are you sure this work 100%? Because we already tried this and sometimes it works and sometimes not. There's such a mess in the code, I can't really tell if it's everything now but.. go to char_battle.cpp and find: item->SetOwnership(ch); replace with this if (CBattleArena::instance().IsBattleArenaMap(ch->GetMapIndex()) == false) if (ch->IsPC()) { item->SetOwnership(ch); } else if (ch->IsPet()) { for (CPetSystem::TPetActorMap::iterator go = ch->GetPetSystem()->m_petActorMap.begin();go != ch->GetPetSystem()->m_petActorMap.end(); ++go) { CPetActor* petActor = go->second; if (NULL != petActor) { LPCHARACTER own = petActor->GetOwner(); if (own) { item->SetOwnership(own); } } } } or do as @Deucalion says, however its problem lies deeper than that. Regards, newja 1 Link to comment Share on other sites More sharing options...
Viello 54 Posted August 12, 2023 Share Posted August 12, 2023 I implemented that system and in my mob proto I changed my pet's attribute npc to monster, I can hit my pet and pet hits me back LMAO, and when I try to attack another monster, metin etc. it does not attack. If only I attack my pet it attacks me any opinion on that? 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