Jump to content
For maintenance and updates, the community will be offline on 31 December 2022 ×

Official Like Absorbtion Calculation for Sash Combination


Recommended Posts

  • Premium

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 });

 

Link to comment
Share on other sites

  • Gold

Rubinium says hi:
3VOlGcS.png

Edited 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

  • Premium

 

3 hours ago, MrQuin said:

Rubinium says hi:
3VOlGcS.png

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 by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Gold
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.
KCGzfjo.png

Edited 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

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);

1e0f1552ec.gif

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 by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Premium
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);

1e0f1552ec.gif

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 by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Bronze

😂

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 by Abel(Tiger)
Link to comment
Share on other sites



  • Similar Content

  • Activity

    1. 1

      Costume shining/costume effect system

    2. 992

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    3. 3

      Biologist Manager (C++ & LUA)

    4. 3

      Visual studio 2022 compiling issue

    5. 63

      Metin2 | Mount System Renewal

    6. 58

      Metin2 2004 Beta Client

    7. 0

      🔥Paradise2 PVP SERVER GLOBAL!! EN-ES-PT 🕐📢Apertura 11 de diciembre 21 horas de España!

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.