Premium .colossus. 60 Posted August 7, 2021 Premium Share Posted August 7, 2021 Hey guys, with this snippet, the absorption chance is calculated nearly correctly using discrete distribution. I quickly picked out the Lennt system and "adapted" it to it. With other systems this shouldn't be too difficult either in char_item.cpp below #include "threeway_war.h" #include <random> replace switch (lVal) { case 2: { lVal = SASH_GRADE_2_ABS; } break; case 3: { lVal = SASH_GRADE_3_ABS; } break; case 4: { lVal = number(SASH_GRADE_4_ABS_MIN, SASH_GRADE_4_ABS_MAX_COMB); } break; default: { lVal = SASH_GRADE_1_ABS; } break; } SetSocket(SASH_ABSORPTION_SOCKET, lVal); with long percentageAdd = 0; std::random_device rd; std::mt19937 gen(rd()); std::discrete_distribution<> d({ 200, 100, 20, 10, 5, 1 }); percentageAdd = d(gen); SetSocket(SASH_ABSORPTION_SOCKET, lVal + percentageAdd); Absorption is possible from 0-5%. You can adjust or expand the distribution here: d({ 200, 100, 20, 10, 5, 1 }); 2 Link to comment Share on other sites More sharing options...
Contributor MrQuin 6462 Posted August 7, 2021 Contributor Share Posted August 7, 2021 (edited) Rubinium says hi: Edited August 18, 2022 by Metin2 Dev Core X - External 2 Internal 1 1 5 2 My only accounts are here and on M2D, Don't trust anyone else from other shitty sites. Link to comment Share on other sites More sharing options...
Premium .colossus. 60 Posted August 7, 2021 Author Premium Share Posted August 7, 2021 (edited) 3 hours ago, MrQuin said: Rubinium says hi: feel free to use it. i had it in my source for ages and someone asked me for this. at least its an improvement for many who still use the lennt one. if it´s not desired i won´t release such stuff. Edited August 18, 2022 by Metin2 Dev Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
Contributor MrQuin 6462 Posted August 7, 2021 Contributor Share Posted August 7, 2021 (edited) 24 minutes ago, .colossus. said: feel free to use it. i had it in my source for ages and someone asked me for this. at least its an improvement for many who still use the lennt one. if it´s not desired i won´t release such stuff. Rubinium devs stole it from you i see. Edited August 18, 2022 by Metin2 Dev Core X - External 2 Internal My only accounts are here and on M2D, Don't trust anyone else from other shitty sites. Link to comment Share on other sites More sharing options...
Premium .colossus. 60 Posted August 7, 2021 Author Premium Share Posted August 7, 2021 you missunderstood me. seems like i got it frome rubinum source, but as i said i implemented it in my files for ages. Link to comment Share on other sites More sharing options...
Mafuyu 51 Posted August 14, 2021 Share Posted August 14, 2021 (edited) how do i have to understand? sash scales from lvl 4 sashes are 11-25%, so how can i add this properly? lVal = number(SASH_GRADE_4_ABS_MIN, SASH_GRADE_4_ABS_MAX_COMB); did i miss something? xD edit: interesting, it only gives the correct absorption when i use the npc to refine them, when i create them with command, it gives low values on it. Is this changeable? like i have higher sashes in chests and they get low values Edited August 15, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Premium .colossus. 60 Posted August 18, 2021 Author Premium Share Posted August 18, 2021 (edited) On 8/14/2021 at 10:04 PM, Mafuyu said: how do i have to understand? sash scales from lvl 4 sashes are 11-25%, so how can i add this properly? lVal = number(SASH_GRADE_4_ABS_MIN, SASH_GRADE_4_ABS_MAX_COMB); did i miss something? xD edit: interesting, it only gives the correct absorption when i use the npc to refine them, when i create them with command, it gives low values on it. Is this changeable? like i have higher sashes in chests and they get low values this depends on your system. Edited August 15, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Active+ Member Abel(Tiger) 1206 Posted August 19, 2021 Active+ Member Share Posted August 19, 2021 (edited) The code you posted can be explained like this: When I get a sash (mostly with /item command) I will get (1,2,3 or 4) absortion based on sash type (wtf???) and with that discrete_distribution I have a change to get +abs. Example: I have a small change to get a type 1 sash with 6 absortion Please don't copy code from other files if you don't know what it does. Rubinum used discrete_distribution when you combine two level 4 sashes for the +abs PS: the code you posted is from item.cpp not char_item.cpp Edited August 19, 2021 by Abel(Tiger) 1 2 Link to comment Share on other sites More sharing options...
Recommended Posts