Frozen 187 Posted December 18, 2015 Share Posted December 18, 2015 Hey guys, i think not many people know how to put the pet name like oficial so im making a tutorial on how to do it. First, go to game->PetSystem.cpp and search for: Spoiler void CPetActor::SetName(const char* name) Under that function add this: Spoiler void CPetActor::SetLevel(BYTE level) { BYTE petLevel = level; if (0 > level) { petLevel = 0; } if (true == IsSummoned()) m_pkChar->SetLevel(petLevel); m_level = petLevel; } Search for: Spoiler DWORD CPetActor::Summon(const char* petName, LPITEM pSummonItem, bool bSpawnFar) Replace with: Spoiler DWORD CPetActor::Summon(const char* petName, BYTE petLevel, LPITEM pSummonItem, bool bSpawnFar) In that same function (Summon), you will find this: Spoiler this->SetName(petName); Add under: Spoiler this->SetLevel(petLevel); Search for: Spoiler CPetActor* CPetSystem::Summon(DWORD mobVnum, LPITEM pSummonItem, const char* petName, bool bSpawnFar, DWORD options) Replace with: Spoiler CPetActor* CPetSystem::Summon(DWORD mobVnum, LPITEM pSummonItem, const char* petName, BYTE petLevel, bool bSpawnFar, DWORD options) In the same function you will find: Spoiler DWORD petVID = petActor->Summon(petName, pSummonItem, bSpawnFar); Replace with: Spoiler DWORD petVID = petActor->Summon(petName, petLevel, pSummonItem, bSpawnFar); Save the file. Open game->PetSystem.h. Search for: Spoiler std::string m_name; Add under: Spoiler BYTE m_level; Search for: Spoiler void SetName(const char* petName); Add under: Spoiler void SetLevel(BYTE petLevel); A little bit under you will find: Spoiler DWORD Summon(const char* petName, LPITEM pSummonItem, bool bSpawnFar = false); Replace with: Spoiler DWORD Summon(const char* petName, BYTE petLevel, LPITEM pSummonItem, bool bSpawnFar = false); Search for: Spoiler CPetActor* Summon(DWORD mobVnum, LPITEM pSummonItem, const char* petName, bool bSpawnFar, DWORD options = CPetActor::EPetOption_Followable | CPetActor::EPetOption_Summonable); Add Under; Spoiler CPetActor* Summon(DWORD mobVnum, LPITEM pSummonItem, const char* petName, BYTE petLevel, bool bSpawnFar, DWORD options = CPetActor::EPetOption_Followable | CPetActor::EPetOption_Summonable); Save the file. Lastly we will change the quest function pet.summon(mobVnum, petName, bFromFar) to pet.summon(mobVnum, petName, petLevel, bFromFar) Open game->questlua_pet.cpp and search for : Spoiler int pet_summon(lua_State* L) Replace the function with: Spoiler int pet_summon(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); CPetSystem* petSystem = ch->GetPetSystem(); LPITEM pItem = CQuestManager::instance().GetCurrentItem(); if (!ch || !petSystem || !pItem) { lua_pushnumber (L, 0); return 1; } if (0 == petSystem) { lua_pushnumber (L, 0); return 1; } // ¼Òȯ¼öÀÇ vnum DWORD mobVnum= lua_isnumber(L, 1) ? lua_tonumber(L, 1) : 0; // ¼Òȯ¼öÀÇ À̸§ const char* petName = lua_isstring(L, 2) ? lua_tostring(L, 2) : 0; BYTE petLevel = lua_isnumber(L, 3) ? lua_tonumber(L, 3) : 0; // ¼ÒȯÇÏ¸é ¸Ö¸®¼ºÎÅÍ ´Þ·Á¿À´ÂÁö ¿©ºÎ bool bFromFar = lua_isboolean(L, 4) ? lua_toboolean(L, 4) : false; CPetActor* pet = petSystem->Summon(mobVnum, pItem, petName, petLevel, bFromFar); if (pet != NULL) lua_pushnumber (L, pet->GetVID()); else lua_pushnumber (L, 0); return 1; } Save the file. Compile It. Done Now just change your pet quest function to pet.summon(mobVnum, petName, petLevel, bFromFar). To make the clientside changes check out .Avenue topic: https://metin2dev.org/board/index.php?/topic/8276-how-to-pet-level-in-other-color-like-official/ PS: In .Avenue topic dont forget to check also the second post he done is a important step to make you see the pet level. I hope this was usefull, Kind Regards, Frozen 5 Link to comment Share on other sites More sharing options...
Premium Galet 509 Posted December 18, 2015 Premium Share Posted December 18, 2015 Thanks Link to comment Share on other sites More sharing options...
ImBacK 8 Posted December 20, 2015 Share Posted December 20, 2015 thanks for u but what about level up & exp ? Link to comment Share on other sites More sharing options...
Frozen 187 Posted December 20, 2015 Author Share Posted December 20, 2015 2 hours ago, ImBacK said: thanks for u but what about level up & exp ? You can do it with a quest. Take a look of Denis topic: https://metin2dev.org/board/index.php?/topic/1322-pet-system-with-experience-and-level-effect/ Link to comment Share on other sites More sharing options...
ImBacK 8 Posted December 20, 2015 Share Posted December 20, 2015 14 hours ago, Frozen said: You can do it with a quest. Take a look of Denis topic: https://metin2dev.org/board/index.php?/topic/1322-pet-system-with-experience-and-level-effect/ i test it but pet level dont show and i add petLeve in quest nd IsPet in char.cpp Link to comment Share on other sites More sharing options...
Former Staff Shisui 490 Posted December 20, 2015 Former Staff Share Posted December 20, 2015 6 minutes ago, ImBacK said: i test it but pet level dont show pet.summon(mobVnum, petName, petLevel, bFromFar) Link to comment Share on other sites More sharing options...
ImBacK 8 Posted December 20, 2015 Share Posted December 20, 2015 12 hours ago, Shisui said: pet.summon(mobVnum, petName, petLevel, bFromFar) i add it and add IsPet in char.cpp Link to comment Share on other sites More sharing options...
Frozen 187 Posted December 20, 2015 Author Share Posted December 20, 2015 3 hours ago, ImBacK said: i add it and add IsPet in char.cpp Take a look in .Avenue topic, link is in the end of this topic. Link to comment Share on other sites More sharing options...
ImBacK 8 Posted December 21, 2015 Share Posted December 21, 2015 6 hours ago, Frozen said: Take a look in .Avenue topic, link is in the end of this topic. i make like avenue topic but level not show @@ I think there are some information in quest lost ! Link to comment Share on other sites More sharing options...
Frozen 187 Posted December 21, 2015 Author Share Posted December 21, 2015 Have you done this part? Server-Source, char.cpp Search for: if (IsPC() == true && (LC_IsEurope() == true || LC_IsCanada() == true || LC_IsSingapore() == true)) Replace the complete if-statement with: if ((IsPC() || IsMonster() || IsPet()) == true) { addPacket.dwLevel = GetLevel(); } else { addPacket.dwLevel = 0; } Credits: .Avenue Link to comment Share on other sites More sharing options...
ImBacK 8 Posted December 21, 2015 Share Posted December 21, 2015 12 hours ago, Frozen said: Have you done this part? Server-Source, char.cpp Search for: if (IsPC() == true && (LC_IsEurope() == true || LC_IsCanada() == true || LC_IsSingapore() == true)) Replace the complete if-statement with: if ((IsPC() || IsMonster() || IsPet()) == true) { addPacket.dwLevel = GetLevel(); } else { addPacket.dwLevel = 0; } Credits: .Avenue yes you can show my part Spoiler if ((IsPC()|| IsPet()) == true) { addPacket.dwLevel = GetLevel(); } else { addPacket.dwLevel = 0; } Link to comment Share on other sites More sharing options...
Ken 903 Posted December 21, 2015 Share Posted December 21, 2015 At first, you don't have to follow a long way for that. The second one is about CPetActor::SetLevel. You don't have to follow a long way for that too. The default will be one all the time if the level is less than zero. addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel() : 0; void CPetActor::SetLevel(BYTE level) { if (!IsSummoned()) return; if (level < 0) level = 1; // Default will be 1 all the time if the level is less than zero. m_pkChar->SetLevel(level); m_level = level; } Do not be sorry, be better. Link to comment Share on other sites More sharing options...
ImBacK 8 Posted December 21, 2015 Share Posted December 21, 2015 12 hours ago, Ken said: addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel() : 0; what the difference Link to comment Share on other sites More sharing options...
Ken 903 Posted December 21, 2015 Share Posted December 21, 2015 Just now, ImBacK said: what the difference We're calling that code style. You don't have to use if condition all the time. You're just assign the variable with the condition. You can do this with "?" too. Kind Regards ~ Ken Do not be sorry, be better. Link to comment Share on other sites More sharing options...
ImBacK 8 Posted December 21, 2015 Share Posted December 21, 2015 13 hours ago, Ken said: At first, you don't have to follow a long way for that. The second one is about CPetActor::SetLevel. You don't have to follow a long way for that too. The default will be one all the time if the level is less than zero. addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel() : 0; void CPetActor::SetLevel(BYTE level) { if (!IsSummoned()) return; if (level < 0) level = 1; // Default will be 1 all the time if the level is less than zero. m_pkChar->SetLevel(level); m_level = level; } ken i test your edit but level dont show !@ Link to comment Share on other sites More sharing options...
Frozen 187 Posted December 22, 2015 Author Share Posted December 22, 2015 11 hours ago, Ken said: At first, you don't have to follow a long way for that. The second one is about CPetActor::SetLevel. You don't have to follow a long way for that too. The default will be one all the time if the level is less than zero. addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel() : 0; void CPetActor::SetLevel(BYTE level) { if (!IsSummoned()) return; if (level < 0) level = 1; // Default will be 1 all the time if the level is less than zero. m_pkChar->SetLevel(level); m_level = level; } That's totally correct, thanks for the optimization. Kind Regards. Link to comment Share on other sites More sharing options...
BackPlayer 55 Posted December 29, 2015 Share Posted December 29, 2015 On 21/12/2015 at 2:23 PM, Ken said: At first, you don't have to follow a long way for that. The second one is about CPetActor::SetLevel. You don't have to follow a long way for that too. The default will be one all the time if the level is less than zero. addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel() : 0; void CPetActor::SetLevel(BYTE level) { if (!IsSummoned()) return; if (level < 0) level = 1; // Default will be 1 all the time if the level is less than zero. m_pkChar->SetLevel(level); m_level = level; } like this? cause i am noob... Spoiler if (IsPC() == true && (LC_IsEurope() == true || LC_IsCanada() == true || LC_IsSingapore() == true)) { addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel(); } else { addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel() : 0; } Link to comment Share on other sites More sharing options...
Frozen 187 Posted December 29, 2015 Author Share Posted December 29, 2015 15 minutes ago, BackPlayer said: like this? cause i am noob... Hide contents if (IsPC() == true && (LC_IsEurope() == true || LC_IsCanada() == true || LC_IsSingapore() == true)) { addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel(); } else { addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel() : 0; } No instead of the if statement just put this: What this is doing is the same as the if statement: (the checks) ? (what is equal case true) : (what is equal case false); addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel() : 0; Link to comment Share on other sites More sharing options...
BackPlayer 55 Posted December 29, 2015 Share Posted December 29, 2015 could i have a screen for to i am sure cause i english is sh.it Link to comment Share on other sites More sharing options...
Frozen 187 Posted December 29, 2015 Author Share Posted December 29, 2015 if (IsPC() == true && (LC_IsEurope() == true || LC_IsCanada() == true || LC_IsSingapore() == true)) { addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel(); } else { addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel() : 0; }addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel() : 0; Delete this /\ and put this V: addPacket.dwLevel = IsPC() || IsMonster() || IsPet() ? GetLevel() : 0; But you dont need to make the code like this, this is just a way to optimize the code, you can put like is in avenue topic. 1 Link to comment Share on other sites More sharing options...
loyein 18 Posted January 2, 2016 Share Posted January 2, 2016 Thanks, I will try. Link to comment Share on other sites More sharing options...
BackPlayer 55 Posted January 4, 2016 Share Posted January 4, 2016 don't work for me don't show me level pet without error Link to comment Share on other sites More sharing options...
Frozen 187 Posted January 4, 2016 Author Share Posted January 4, 2016 13 minutes ago, BackPlayer said: don't work for me don't show me level pet without error did you do the client part? Link to comment Share on other sites More sharing options...
BackPlayer 55 Posted January 4, 2016 Share Posted January 4, 2016 (edited) https://metin2.download/picture/BhJ6gY27s38m7GIugOZRyu1VjkeIQWB6/.png wait i forgot to use new fuction i try and new pet.summon but nothing Edited September 1, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Frozen 187 Posted January 4, 2016 Author Share Posted January 4, 2016 (edited) 10 minutes ago, BackPlayer said: https://metin2.download/picture/BhJ6gY27s38m7GIugOZRyu1VjkeIQWB6/.png wait i forgot to use new fuction i try and new pet.summon but nothing After you put that nothing happened? Edited September 1, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Recommended Posts