Dyshaxo 49 Posted February 26, 2015 Share Posted February 26, 2015 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) I'm releasing self-tipped Source-Code extension for attacking Pets Preview: In Scope Square - the hottest P-Server project that will ever start - the whole thing is of course 1000x better, fixed with possible bugs, and a gui, with which the pet can then essentially control where the target of the Can choose pets himself, and can also launch skills of the pet you open "PetSystem.h" and insert under "void unmount();" bool Attack(LPCHARACTER pkVictim = NULL); Should then look like this: Spoiler Same file, looks for: CPetActor * GetByVnum(DWORD vnum) const; and inserts below: void LaunchAttack(LPCHARACTER pkVictim = NULL); Should then look like this: Spoiler you open "PetSystem.cpp" and: searches for bool CPetActor::Update(DWORD deltaTime) Replace complete function with: bool CPetActor::Update(DWORD deltaTime) { bool bResult = false; // Æê ÁÖÀÎÀÌ Á×¾ú°Å³ª, ¼ÒȯµÈ ÆêÀÇ »óÅ°¡ ÀÌ»óÇÏ´Ù¸é ÆêÀ» ¾ø¾Ú. (NOTE: °¡²û°¡´Ù ÀÌ·± Àú·± ÀÌÀ¯·Î ¼ÒȯµÈ ÆêÀÌ DEAD »óÅ¿¡ ºüÁö´Â °æ¿ì°¡ ÀÖÀ½ // ÆêÀ» ¼ÒȯÇÑ ¾ÆÀÌÅÛÀÌ ¾ø°Å³ª, ³»°¡ °¡Áø »óÅ°¡ ¾Æ´Ï¶ó¸é ÆêÀ» ¾ø¾Ú. if (m_pkOwner->IsDead() || (IsSummoned() && m_pkChar->IsDead()) || NULL == ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID()) || ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID())->GetOwner() != this->GetOwner() ) { this->Unsummon(); return true; } if (this->GetCharacter()->GetVictim()) { bResult = this->Attack(); } if (!bResult) { if (this->IsSummoned() && HasOption(EPetOption_Followable)) bResult = this->_UpdateFollowAI(); } return bResult; } Same file, looks for the function: void CPetActor::ClearBuff() Adds the following func AFTER this function (not IN the function): bool CPetActor::Attack(LPCHARACTER pkVictim) { if (pkVictim) { if (!pkVictim->IsMonster() || pkVictim->IsDead()) return false; if (m_pkChar->GetVictim()) return false; } else { pkVictim = m_pkChar->GetVictim(); if (!pkVictim) return false; } m_pkChar->SetVictim(pkVictim); const PIXEL_POSITION& rkPetPos = m_pkChar->GetXYZ(); const PIXEL_POSITION& rkVictimPos = pkVictim->GetXYZ(); int iDistance = DISTANCE_APPROX(rkPetPos.x - rkVictimPos.x, rkPetPos.y - rkVictimPos.y); if (iDistance >= m_pkChar->GetMobAttackRange()) { m_pkChar->Follow(pkVictim, m_pkChar->GetMobAttackRange()); } else { if (get_dword_time() - m_pkChar->GetLastAttackTime() >= 3000) { if (m_pkChar->Attack(pkVictim)) { m_pkChar->SendMovePacket(FUNC_ATTACK, 0, rkPetPos.x, rkPetPos.y, 0, get_dword_time()); m_pkChar->SetLastAttacked(get_dword_time()); } } } return true; } should then look like this: Spoiler You are looking for the function: bool CPetSystem::Update(DWORD deltaTime) and ABOVE inserts the following function: void CPetSystem::LaunchAttack(LPCHARACTER pkVictim) { if (!pkVictim) return; for (itertype(m_petActorMap) it = m_petActorMap.begin(); it != m_petActorMap.end(); ++it) { CPetActor* pkPetActor = it->second; if (pkPetActor->IsSummoned()) pkPetActor->Attack(pkVictim); } } should then look like this: Spoiler and last but not least - open the file: "char_battle.cpp", looks for the function: bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType) and adds under the following content: // only pc sets victim null. For npc, state machine will reset this. if (BATTLE_DEAD == iRet && IsPC()) SetVictim(NULL); This one: if (BATTLE_DEAD != iRet && IsPC()) { if (m_petSystem && m_petSystem->CountSummoned() > 0) m_petSystem->LaunchAttack(pkVictim); } Should then look like this: Spoiler So that would increase the biceps buttock opening by - for my part - 2 meters. #Edt: So that the pets can also die: Opens the pvp.cpp, searches for bool CPVPManager::CanAttack(LPCHARACTER pkChr, LPCHARACTER pkVictim) and inserts: if (pkChr->IsPet() && pkVictim->IsMonster()) { return true; } if (pkChr->IsMonster() && pkVictim->IsPet()) { return true; } Like this: Spoiler Enjoy! 14 1 5 27 Link to comment Share on other sites More sharing options...
ѕeмa™ 308 Posted February 26, 2015 Share Posted February 26, 2015 (edited) tested: all compiled right, pet dont attack xd ( maybe because pet dont have animations? ) 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...
Ayaka 300 Posted February 26, 2015 Share Posted February 26, 2015 Nice thing! But like the music more than the feature xD reminds me of savant (a little bit) 1 F E E L - T H E - A W E S O M E N E S S Link to comment Share on other sites More sharing options...
flexio 83 Posted February 27, 2015 Share Posted February 27, 2015 (edited) tested: all compiled right, pet dont attack xd ( maybe because pet dont have animations? ) EDIT Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Former Staff Shisui 493 Posted February 27, 2015 Former Staff Share Posted February 27, 2015 Guide is in german because... Idc. You should care, otherwise they'll close this. Link to comment Share on other sites More sharing options...
ѕeмa™ 308 Posted February 27, 2015 Share Posted February 27, 2015 (edited) tested: all compiled right, pet dont attack xd ( maybe because pet dont have animations? ) animations. this is why is wolf in video Solved. Animations is not needed. Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal https://m2admin.net/ Link to comment Share on other sites More sharing options...
Krixius 13 Posted February 27, 2015 Share Posted February 27, 2015 Translate the guide to english lol. PD: Works. Regards Akroma Link to comment Share on other sites More sharing options...
jma96 1 Posted February 27, 2015 Share Posted February 27, 2015 (edited) This work. ^^ Thanks. And pet can have HP and die. Edit: One little problem. ^^ 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 27, 2015 Share Posted February 27, 2015 Thanks. Link to comment Share on other sites More sharing options...
Management Karbust 4929 Posted February 27, 2015 Management Share Posted February 27, 2015 English tutorial please... 1 Link to comment Share on other sites More sharing options...
Tacticus 74 Posted February 27, 2015 Share Posted February 27, 2015 thx...but it will be more nice if pet have quest,which can start pet to attack,and stop attack mobs or players Link to comment Share on other sites More sharing options...
Premium Galet 515 Posted February 27, 2015 Premium Share Posted February 27, 2015 (edited) Corrected tabulation, code, include and english How-To [HowTo] Search in petsystem.h "void unmount();" and add this under : bool Attack(LPCHARACTER pkVictim = NULL); It's look like this : Then search "CPetActor* GetByVnum(DWORD vnum) const;" and add this under : void LaunchAttack(LPCHARACTER pkVictim = NULL); It's look like this : -> Save and then open PetSystem.cpp: Search the "bool CPetActor::Update(DWORD deltaTime)" function And replace it with this : bool CPetActor::Update(DWORD deltaTime) { bool bResult = false; if (m_pkOwner->IsDead() || (IsSummoned() && m_pkChar->IsDead()) || NULL == ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID()) || ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID())->GetOwner() != this->GetOwner() ) { this->Unsummon(); return true; } if (this->GetCharacter()->GetVictim()) { bResult = this->Attack(); } if (!bResult) { if (this->IsSummoned() && HasOption(EPetOption_Followable)) bResult = this->_UpdateFollowAI(); } return bResult; } Search the "void CPetActor::ClearBuff()" function And add this function under : bool CPetActor::Attack(LPCHARACTER pkVictim) { if (pkVictim) { if (!pkVictim->IsMonster() || pkVictim->IsDead()) return false; if (m_pkChar->GetVictim()) return false; } else { pkVictim = m_pkChar->GetVictim(); if (!pkVictim) return false; } m_pkChar->SetVictim(pkVictim); const PIXEL_POSITION& rkPetPos = m_pkChar->GetXYZ(); const PIXEL_POSITION& rkVictimPos = pkVictim->GetXYZ(); int iDistance = DISTANCE_APPROX(rkPetPos.x - rkVictimPos.x, rkPetPos.y - rkVictimPos.y); if (iDistance >= m_pkChar->GetMobAttackRange()) { m_pkChar->Follow(pkVictim, m_pkChar->GetMobAttackRange()); } else { if (get_dword_time() - m_pkChar->GetLastAttackTime() >= 3000) { if (m_pkChar->Attack(pkVictim)) { m_pkChar->SendMovePacket(FUNC_ATTACK, 0, rkPetPos.x, rkPetPos.y, 0, get_dword_time()); m_pkChar->SetLastAttacked(get_dword_time()); } } } return true; } It will look like this: Search "bool CPetSystem::Update(DWORD deltaTime)" And add this above: void CPetSystem::LaunchAttack(LPCHARACTER pkVictim) { if (!pkVictim) return; for (itertype(m_petActorMap) it = m_petActorMap.begin(); it != m_petActorMap.end(); ++it) { CPetActor* pkPetActor = it->second; if (pkPetActor->IsSummoned()) pkPetActor->Attack(pkVictim); } } It will look like this: Save and open "char_battle.cpp" : Add a the begining : #include "PetSystem.h" Then search this function : "bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType)" And especially this part: // only pc sets victim null. For npc, state machine will reset this. if (BATTLE_DEAD == iRet && IsPC()) SetVictim(NULL); Add this under: if (BATTLE_DEAD != iRet && IsPC()) { if (m_petSystem && m_petSystem->CountSummoned() > 0) m_petSystem->LaunchAttack(pkVictim); } It will look like this: Save and open "pvp.cpp" Then search this function : "bool CPVPManager::CanAttack(LPCHARACTER pkChr, LPCHARACTER pkVictim)" And add this under : if (pkChr->IsPet() && pkVictim->IsMonster()) { return true; } if (pkChr->IsMonster() && pkVictim->IsPet()) { return true; } Like this: Recompile, and done Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal 1 6 Link to comment Share on other sites More sharing options...
Dyshaxo 49 Posted February 27, 2015 Author Share Posted February 27, 2015 Corrected tabulation and english How-To Thanks =) I actually had the Intention to translate it, but no time and stuff, really nice from you ^-^ All in all - this is a Bitchmove-Release. The Guy selling this annoyed me hard. And 250€ is definetly too much for 2 Functions and a call. 1 Link to comment Share on other sites More sharing options...
Dyshaxo 49 Posted February 27, 2015 Author Share Posted February 27, 2015 Nice thing! But like the music more than the feature xD reminds me of savant (a little bit) It IS Savant Nice to hear that there are actually people listening to his songs =) He's an awesome artist and started with the toy-keyboard of his little sister, awesome guy =) 1 Link to comment Share on other sites More sharing options...
Premium phayara 430 Posted February 27, 2015 Premium Share Posted February 27, 2015 (edited) Corrected tabulation and english How-To [HowTo] Search in petsystem.h "void unmount();" and add this under : bool Attack(LPCHARACTER pkVictim = NULL); It's look like this : Then search "CPetActor* GetByVnum(DWORD vnum) const;" and add this under : void LaunchAttack(LPCHARACTER pkVictim = NULL); It's look like this : -> Save and then open PetSystem.cpp: Search the "bool CPetActor::Update(DWORD deltaTime)" function And replace it with this : bool CPetActor::Update(DWORD deltaTime) { bool bResult = false; if (m_pkOwner->IsDead() || (IsSummoned() && m_pkChar->IsDead()) || NULL == ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID()) || ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID())->GetOwner() != this->GetOwner() ) { this->Unsummon(); return true; } if (this->GetCharacter()->GetVictim()) { bResult = this->Attack(); } if (!bResult) { if (this->IsSummoned() && HasOption(EPetOption_Followable)) bResult = this->_UpdateFollowAI(); } return bResult; } Search the "void CPetActor::ClearBuff()" function And add this function under : bool CPetActor::Attack(LPCHARACTER pkVictim) { if (pkVictim) { if (!pkVictim->IsMonster() || pkVictim->IsDead()) return false; if (m_pkChar->GetVictim()) return false; } else { pkVictim = m_pkChar->GetVictim(); if (!pkVictim) return false; } m_pkChar->SetVictim(pkVictim); const PIXEL_POSITION& rkPetPos = m_pkChar->GetXYZ(); const PIXEL_POSITION& rkVictimPos = pkVictim->GetXYZ(); int iDistance = DISTANCE_APPROX(rkPetPos.x - rkVictimPos.x, rkPetPos.y - rkVictimPos.y); if (iDistance >= m_pkChar->GetMobAttackRange()) { m_pkChar->Follow(pkVictim, m_pkChar->GetMobAttackRange()); } else { if (get_dword_time() - m_pkChar->GetLastAttackTime() >= 3000) { if (m_pkChar->Attack(pkVictim)) { m_pkChar->SendMovePacket(FUNC_ATTACK, 0, rkPetPos.x, rkPetPos.y, 0, get_dword_time()); m_pkChar->SetLastAttacked(get_dword_time()); } } } return true; } It will look like this: Search "bool CPetSystem::Update(DWORD deltaTime)" And add this above: void CPetSystem::LaunchAttack(LPCHARACTER pkVictim) { if (!pkVictim) return; for (itertype(m_petActorMap) it = m_petActorMap.begin(); it != m_petActorMap.end(); ++it) { CPetActor* pkPetActor = it->second; if (pkPetActor->IsSummoned()) pkPetActor->Attack(pkVictim); } } It will look like this: Save and open "char_battle.cpp" : Then search this function : "bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType)" And especially this part: // only pc sets victim null. For npc, state machine will reset this. if (BATTLE_DEAD == iRet && IsPC()) SetVictim(NULL); Add this under: if (BATTLE_DEAD != iRet && IsPC()) { if (m_petSystem && m_petSystem->CountSummoned() > 0) m_petSystem->LaunchAttack(pkVictim); } It will look like this: Save and open "pvp.cpp" Then search this function : "bool CPVPManager::CanAttack(LPCHARACTER pkChr, LPCHARACTER pkVictim)" And add this under : if (pkChr->IsPet() && pkVictim->IsMonster()) { return true; } if (pkChr->IsMonster() && pkVictim->IsPet()) { return true; } Like this: Recompile, and done Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Dyshaxo 49 Posted February 27, 2015 Author Share Posted February 27, 2015 (edited) Corrected tabulation and english How-To [HowTo] Search in petsystem.h "void unmount();" and add this under : bool Attack(LPCHARACTER pkVictim = NULL); It's look like this : Then search "CPetActor* GetByVnum(DWORD vnum) const;" and add this under : void LaunchAttack(LPCHARACTER pkVictim = NULL); It's look like this : -> Save and then open PetSystem.cpp: Search the "bool CPetActor::Update(DWORD deltaTime)" function And replace it with this : bool CPetActor::Update(DWORD deltaTime) { bool bResult = false; if (m_pkOwner->IsDead() || (IsSummoned() && m_pkChar->IsDead()) || NULL == ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID()) || ITEM_MANAGER::instance().FindByVID(this->GetSummonItemVID())->GetOwner() != this->GetOwner() ) { this->Unsummon(); return true; } if (this->GetCharacter()->GetVictim()) { bResult = this->Attack(); } if (!bResult) { if (this->IsSummoned() && HasOption(EPetOption_Followable)) bResult = this->_UpdateFollowAI(); } return bResult; } Search the "void CPetActor::ClearBuff()" function And add this function under : bool CPetActor::Attack(LPCHARACTER pkVictim) { if (pkVictim) { if (!pkVictim->IsMonster() || pkVictim->IsDead()) return false; if (m_pkChar->GetVictim()) return false; } else { pkVictim = m_pkChar->GetVictim(); if (!pkVictim) return false; } m_pkChar->SetVictim(pkVictim); const PIXEL_POSITION& rkPetPos = m_pkChar->GetXYZ(); const PIXEL_POSITION& rkVictimPos = pkVictim->GetXYZ(); int iDistance = DISTANCE_APPROX(rkPetPos.x - rkVictimPos.x, rkPetPos.y - rkVictimPos.y); if (iDistance >= m_pkChar->GetMobAttackRange()) { m_pkChar->Follow(pkVictim, m_pkChar->GetMobAttackRange()); } else { if (get_dword_time() - m_pkChar->GetLastAttackTime() >= 3000) { if (m_pkChar->Attack(pkVictim)) { m_pkChar->SendMovePacket(FUNC_ATTACK, 0, rkPetPos.x, rkPetPos.y, 0, get_dword_time()); m_pkChar->SetLastAttacked(get_dword_time()); } } } return true; } It will look like this: Search "bool CPetSystem::Update(DWORD deltaTime)" And add this above: void CPetSystem::LaunchAttack(LPCHARACTER pkVictim) { if (!pkVictim) return; for (itertype(m_petActorMap) it = m_petActorMap.begin(); it != m_petActorMap.end(); ++it) { CPetActor* pkPetActor = it->second; if (pkPetActor->IsSummoned()) pkPetActor->Attack(pkVictim); } } It will look like this: Save and open "char_battle.cpp" : Then search this function : "bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType)" And especially this part: // only pc sets victim null. For npc, state machine will reset this. if (BATTLE_DEAD == iRet && IsPC()) SetVictim(NULL); Add this under: if (BATTLE_DEAD != iRet && IsPC()) { if (m_petSystem && m_petSystem->CountSummoned() > 0) m_petSystem->LaunchAttack(pkVictim); } It will look like this: Save and open "pvp.cpp" Then search this function : "bool CPVPManager::CanAttack(LPCHARACTER pkChr, LPCHARACTER pkVictim)" And add this under : if (pkChr->IsPet() && pkVictim->IsMonster()) { return true; } if (pkChr->IsMonster() && pkVictim->IsPet()) { return true; } Like this: Recompile, and done char_battle.cpp add to Includes: #include "PetSystem.h", should work =) Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
Premium Galet 515 Posted February 27, 2015 Premium Share Posted February 27, 2015 I corrected, there's an include missing, I edited my tutorial, but this is missing in the original too. Your welcome 1 Link to comment Share on other sites More sharing options...
Premium phayara 430 Posted February 27, 2015 Premium Share Posted February 27, 2015 (edited) New error. Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Premium Galet 515 Posted February 27, 2015 Premium Share Posted February 27, 2015 Check your end braces "}" "{" Link to comment Share on other sites More sharing options...
Premium phayara 430 Posted February 27, 2015 Premium Share Posted February 27, 2015 (edited) Check your end braces "}" "{" Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Premium Galet 515 Posted February 27, 2015 Premium Share Posted February 27, 2015 It's all good, I don't know, upload your whole file in pastebin, i'll correct for you. Link to comment Share on other sites More sharing options...
Premium phayara 430 Posted February 27, 2015 Premium Share Posted February 27, 2015 It's all good, I don't know, upload your whole file in pastebin, i'll correct for you. http://pastebin.com/hCCQE23C Link to comment Share on other sites More sharing options...
newja 53 Posted February 27, 2015 Share Posted February 27, 2015 It's all good, I don't know, upload your whole file in pastebin, i'll correct for you. http://pastebin.com/hCCQE23C You've lost your bracket here if (m_pkChar->Attack(pkVictim)) { m_pkChar->SendMovePacket(FUNC_ATTACK, 0, rkPetPos.x, rkPetPos.y, 0, get_dword_time()); m_pkChar->SetLastAttacked(get_dword_time()); Link to comment Share on other sites More sharing options...
Premium Galet 515 Posted February 27, 2015 Premium Share Posted February 27, 2015 http://pastebin.com/pb0GJ6Ap Try this ^^ For me the pet don't do dammage, but he can die. ^^ 2 Link to comment Share on other sites More sharing options...
ѕeмa™ 308 Posted February 27, 2015 Share Posted February 27, 2015 http://pastebin.com/pb0GJ6Ap Try this ^^ For me the pet don't do dammage, but he can die. ^^ maybe because u dont put the damage in mob proto? 1 https://m2admin.net/ Link to comment Share on other sites More sharing options...
Recommended Posts