Forum Moderator Gurgarath 2514 Posted July 4, 2021 Forum Moderator Share Posted July 4, 2021 (edited) Hello guys, I am once again coming with a really little fix that is related to rare attribute (6/7 bonuses). This bug is extra rare because to trigger it you must have a way to add 6 and 7 bonuses to an item and you must have an incorrect field or an error in your item_attr_rare table. So this is most likely a code sanitization but it's always good to avoid such errors as I encountered people having this bug. When you add a rare bonus, the game will fill a vector with the bonuses from the table and randomly pick one in the vector. However, if you have an error in the table, this vector will be empty and the randomization will result in doing "number(0, -1)", which is obviously incorrect and your core will crash. For searching purposes (if someone in the future is looking for a fix), the error is this one : Quote number_ex: number(): first argument is bigger than second argument 0 -> -1 The fix is really simple, we must check if the vector is empty and then exit at this moment. In item_attribute.cpp, in the following function: bool CItem::AddRareAttribute() Under this block of code: for (int i = 0; i < MAX_APPLY_NUM; ++i) { const TItemAttrTable& r = g_map_itemRare[i]; if (r.dwApplyIndex != 0 && r.bMaxLevelBySet[nAttrSet] > 0 && HasRareAttr(i) != true) { avail.push_back(i); } } Add the following check: This is the hidden content, please Sign In or Sign Up And that's pretty much it, pretty straightforward, but instead of crashing, you will have a syserr and you will know what to check next! Edited August 12, 2022 by Gurgarath 63 2 1 20 2 24 Gurgarath coming soon Link to comment Share on other sites More sharing options...
Premium WeedHex 635 Posted July 4, 2021 Premium Share Posted July 4, 2021 I don't use 6-7 btw this is an important fix! Thanks for sharing GG 1 1 Link to comment Share on other sites More sharing options...
Management AZICKO 7348 Posted July 4, 2021 Management Share Posted July 4, 2021 Awesome, Amazing! 1 Scamming ? Reselling ? metin2.download | metin2.dev | fr.metin2.dev | metin2dev.org | metin2.top | top-metin2.org Link to comment Share on other sites More sharing options...
IceShiva 150 Posted July 4, 2021 Share Posted July 4, 2021 (edited) There is also stupid bug, You can access 0-255 array index where vaild index is 0-4, if memory is filled at address which array points and value is < 1 with incorrect index you should get free name change. If you want trigger, just call net.SendChangeNamePacket(254, "newcharactername") from python. Try to decrement/increment index to find filled memory and check behaviour. Edited August 26, 2022 by Metin2 Dev Core X - External 2 Internal 1 3 1 Link to comment Share on other sites More sharing options...
Premium Intel 758 Posted July 11, 2021 Premium Share Posted July 11, 2021 (edited) For a second I was thinking "this crash feels familiar.." and yep For a system I made I had not to include some items in the table and sometimes the game would crash and found out about this stupid thing as well. Edited August 18, 2022 by Metin2 Dev Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
narcisxb 26 Posted October 29, 2021 Share Posted October 29, 2021 (edited) Ok, so this fix will make Malis Official 6/7 ATTR System FAIL every single time you try to add a new bonus. Any ideea why? I want to use the fix but at the same time I love his system. Edited October 29, 2021 by narcisxb 2 Link to comment Share on other sites More sharing options...
Premium Hunger 472 Posted November 6, 2021 Premium Share Posted November 6, 2021 On 10/29/2021 at 1:50 PM, narcisxb said: Ok, so this fix will make Malis Official 6/7 ATTR System FAIL every single time you try to add a new bonus. Any ideea why? I want to use the fix but at the same time I love his system. The code above has nothing to do with the adding chance 1 Link to comment Share on other sites More sharing options...
narcisxb 26 Posted November 6, 2021 Share Posted November 6, 2021 (edited) 38 minutes ago, Hunger said: The code above has nothing to do with the adding chance I literally tested the code. As soon as I commented it I could add 6/7 again. (I tested it two or three times). With this fix tou can t add 6/7 (it always fails) using that system. Give it a try yourself I was just as surprised. Edited November 6, 2021 by narcisxb Link to comment Share on other sites More sharing options...
Premium EnKor 42 Posted September 8, 2022 Premium Share Posted September 8, 2022 On 11/6/2021 at 6:18 AM, narcisxb said: I literally tested the code. As soon as I commented it I could add 6/7 again. (I tested it two or three times). With this fix tou can t add 6/7 (it always fails) using that system. Give it a try yourself I was just as surprised. I got 100% same error as you. But in my case it was because i add FIX before Spoiler for (int i = 0; i < MAX_APPLY_NUM; ++i) { const TItemAttrTable& r = g_map_itemRare[i]; if (r.dwApplyIndex != 0 && r.bMaxLevelBySet[nAttrSet] > 0 && HasRareAttr(i) != true) { avail.push_back(i); } } Fix need to be after like he say On 7/4/2021 at 2:20 PM, Gurgarath said: Under this block of code: for (int i = 0; i < MAX_APPLY_NUM; ++i) { const TItemAttrTable& r = g_map_itemRare[i]; if (r.dwApplyIndex != 0 && r.bMaxLevelBySet[nAttrSet] > 0 && HasRareAttr(i) != true) { avail.push_back(i); } } Add the following check: if (avail.empty()) { sys_err("Couldn't add a rare bonus - item_attr_rare has incorrect values!"); return false; } if pc.get_sex() == true and npc.get_sex() == false then npc.purge() end Link to comment Share on other sites More sharing options...
Recommended Posts