Active+ Member MT2Dev 1141 Posted October 10, 2024 Active+ Member Share Posted October 10, 2024 (edited) INTRODUCTION & PROBLEM Hello, we will solve the famous "Cannot Find Tree" problem in the "CHARACTER::Sync" function in the server src and also the problems that may be caused by the "Dead();" section used for everything that is not a PC in this function. WHAT DID WE CHANGE? All of the currently shared fixes are actually incomplete, we will make a new arrangement to solve this problem at its root, thus we will fix the problem completely. UPDATE - 18/10/2024 With @ Mitachi's great feedback, i rewrote the "RewardlessDead()" function. LAST UPDATE - 23/10/2024 I fixed a code that caused the (!new_tree) part of the function to return false under all circumstances (thanks to @ WeedHex ), also added all the nullptr checks and extra sys_err messages where necessary, expanded the content of the existing sys_err messages, these changes will not cause any performance disadvantages and there is no possibility of it being misused in any way anymore, please use the final version. HOW TO DO? Without going into details such as editing the reward mechanism of the existing dead function, we will simply create a new dead function and use it in Sync. The main purpose of this function, which can only be used for mobs and metins, is that it does not give a reward (drop) after the dead function, let's get started. First, open "char_battle.cpp" This is the hidden content, please Sign In or Sign Up Best regards, MT2Dev. Edited October 23, 2024 by MT2Dev Last update. 114 1 17 1 1 37 © Link to comment https://metin2.dev/topic/33085-c-charactersync-renewal-cannot-find-tree-fix/ Share on other sites More sharing options...
Active+ Member Nazox 421 Posted October 11, 2024 Active+ Member Share Posted October 11, 2024 Hey!, thanks , you can explain me a little about this problem I never listen about that ? 1 Nicks: Nazox™ Krone™ Nagato™ Yahiko™ Yakiro™ Proyecto: Trabajando en el. Compañeros & firma: DreamHQ - 2009-2015 [Nostalgia] Link to comment https://metin2.dev/topic/33085-c-charactersync-renewal-cannot-find-tree-fix/#findComment-167441 Share on other sites More sharing options...
Active Member Endymion 364 Posted October 11, 2024 Active Member Share Posted October 11, 2024 SET_BIT(m_pointsInstant.instant_flag, INSTANT_FLAG_NO_REWARD); Dead(); 1 3 Link to comment https://metin2.dev/topic/33085-c-charactersync-renewal-cannot-find-tree-fix/#findComment-167448 Share on other sites More sharing options...
Active+ Member MT2Dev 1141 Posted October 11, 2024 Author Active+ Member Share Posted October 11, 2024 (edited) On 10/11/2024 at 11:49 AM, Nazox said: Hey!, thanks , you can explain me a little about this problem I never listen about that ? Hey, sure! Basicly this fix actually for the very old h*ck that allows to you move players with sync packet out of the map and kick them out the game, with the original code if that scenario is happen, player will kicked via PHASE_CLOSE and if it's not player (else block) function will the trigger Dead event for the destroy but there is some problem in this logic, if you use this to move mobs out of the map they will dead instantly (even if their HP is full) and they will give a full drop(reward), thats something we don't need for our servers i guess, also this fix useful for problem very fast mounts will kick players out the game, btw thats a long comment sorry for my poor grammar. On 10/11/2024 at 4:06 PM, Endymion said: SET_BIT(m_pointsInstant.instant_flag, INSTANT_FLAG_NO_REWARD); Dead(); It's up to you, can do it by that way but i'm use this new function also for other fixes, for that reason i created new func for this job. #UPDATE Sync function updated for better performence. Edited October 14, 2024 by MT2Dev Update.. © Link to comment https://metin2.dev/topic/33085-c-charactersync-renewal-cannot-find-tree-fix/#findComment-167451 Share on other sites More sharing options...
Developer Mitachi 2182 Posted October 18, 2024 Developer Share Posted October 18, 2024 I'll start with a genuine thanks for sharing, in ::Reward, (tanaka or not) there actually is: PIXEL_POSITION pos = GetXYZ(); if (!SECTREE_MANAGER::instance().GetMovablePosition(GetMapIndex(), pos.x, pos.y, pos)) return; But, SetXYZ() is called after Dead() due can't sync, so the dead without reward make some sense here. However, the topic should then talk about the fix of this hack/bug that players can somehow exploit, because otherwise, reassigning sectree instead of PHASE_CLOSE is something everyone has been doing to avoid "fake launcher-crash" (is not exactly caused by a pkt loss, even if seems impossible trigger the bug on windows localhost, tested without IPE). About “RewardlessDead”, weird name for a Dead with NoReward, I guess you've just tried to make different than marty somehow, maybe I am wrong Also by copying half ::Dead function, there is a risk that if you add systems in the future that need to be triggered to death, you forget to add them in both, it looks unmaintainable, and I see no point to force the Reward(false) if is only for npc, or you will give to the hacker the align, steal hp/sp and the quest kill if he was also the killer (so if someone damaged him). A "pure" death can be something like (not tested): void CHARACTER::_() { // just to prevent, not needed if you use it properly if (IsPC()) { sys_log(0, "::_ Bad usage, it was a PC, called normal Dead()"); Dead(); return; } // remove the killer to avoid quest triggers may in Dead m_dwKillerPID = 0; // set no reward SET_BIT(m_pointsInstant.instant_flag, INSTANT_FLAG_NO_REWARD); // kill Dead(); } be careful, here you're not only avoiding the loots like drop, gold, but even what I mentioned above. 1 1 Link to comment https://metin2.dev/topic/33085-c-charactersync-renewal-cannot-find-tree-fix/#findComment-167562 Share on other sites More sharing options...
Active+ Member MT2Dev 1141 Posted October 18, 2024 Author Active+ Member Share Posted October 18, 2024 (edited) 23 minutes ago, Mitachi said: I'll start with a genuine thanks for sharing, in ::Reward, (tanaka or not) there actually is: PIXEL_POSITION pos = GetXYZ(); if (!SECTREE_MANAGER::instance().GetMovablePosition(GetMapIndex(), pos.x, pos.y, pos)) return; But, SetXYZ() is called after Dead() due can't sync, so the dead without reward make some sense here. However, the topic should then talk about the fix of this hack/bug that players can somehow exploit, because otherwise, reassigning sectree instead of PHASE_CLOSE is something everyone has been doing to avoid "fake launcher-crash" (is not exactly caused by a pkt loss, even if seems impossible trigger the bug on windows localhost, tested without IPE). About “RewardlessDead”, weird name for a Dead with NoReward, I guess you've just tried to make different than marty somehow, maybe I am wrong Also by copying half ::Dead function, there is a risk that if you add systems in the future that need to be triggered to death, you forget to add them in both, it looks unmaintainable, and I see no point to force the Reward(false) if is only for npc, or you will give to the hacker the align, steal hp/sp and the quest kill if he was also the killer (so if someone damaged him). A "pure" death can be something like (not tested): void CHARACTER::_() { // just to prevent, not needed if you use it properly if (IsPC()) { sys_log(0, "::_ Bad usage, it was a PC, called normal Dead()"); Dead(); return; } // remove the killer to avoid quest triggers may in Dead m_dwKillerPID = 0; // set no reward SET_BIT(m_pointsInstant.instant_flag, INSTANT_FLAG_NO_REWARD); // kill Dead(); } be careful, here you're not only avoiding the loots like drop, gold, but even what I mentioned above. Thanks for your great feedback! I missed a point that it could trigger quests, also if it's a pc, redirecting it to the Dead function is a great idea, I'll rework it with your suggestions, thanks again. Also, since I've received multiple messages about this, i need to say something about the source of this fix, after a conversation with dear @ Koray on a different TR forum, he gave me the idea for this fix, I prepared this topic for him, so i don't have an idea about Marty's latest fix, his method is probably better but I haven't seen it yet, best regards. Spoiler It's translated; Edited October 18, 2024 by Metin2 Dev International Core X - External 2 Internal © Link to comment https://metin2.dev/topic/33085-c-charactersync-renewal-cannot-find-tree-fix/#findComment-167565 Share on other sites More sharing options...
Active+ Member MT2Dev 1141 Posted October 23, 2024 Author Active+ Member Share Posted October 23, 2024 (edited) #LAST UPDATE The "Sync" function has been rewritten to fix a major bug that was affecting the code's operation, please use last version! Edited October 23, 2024 by MT2Dev 1 © Link to comment https://metin2.dev/topic/33085-c-charactersync-renewal-cannot-find-tree-fix/#findComment-167657 Share on other sites More sharing options...
Recommended Posts
Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/