Jump to content

Recommended Posts

  • Active+ Member

Hi All! 

Sorry in advance if is not the right forum to post this topic but TBH I don't know exactly where should I put this. If it's the wrong forum please move it or please let me know to delete it. 

Context:

So, recently, in my "learning" process I've encountered some issues with the special_item_group.txt file. Basically I took this file from another SVF and paste it to mine. Well, I've got a lot of errors in the server syserr with the following: 

GiveItemFromSpecialItemGroup: cannot find special item group XYZ in node ABC

And what I learned from this, apparently is that you cannot connect in-game with ur account if this error occurs. xD

So, I've made a python script that I'll share with you. 

Spoiler

What it does? Well, it deletes the groups that have ASCII (or text) in the place where the VNUM item is supposed to be. For example: 

Group    ¼¼¹îµ·ÁÖ¸Ó´Ï  (Lets name it: A)
{
    Vnum    50023
    1    µ·²Ù·¯¹Ì    50000    5
    2    µ·²Ù·¯¹Ì    40000    10
    3    µ·²Ù·¯¹Ì    30000    15
    4    µ·²Ù·¯¹Ì    20000    20
    5    µ·²Ù·¯¹Ì    10000    50
}
Group    Àå¹Ì (Lets name it: B)
{
    Vnum    50024
    1    50300    1    3
    2    70102    1    1
    3    25040    1    1
    4    80003    1    5
    5    27003    5    10
    6    27006    5    15
    7    27002    5    25
    8    27005    5    40
}

The script will delete the group "A" (or ¼¼¹îµ·ÁÖ¸Ó´Ï) because for 1-2-3-4 and 5, we have text / ASCII symbols instead of vnums. 

 

How to run the script? Ask ChatGPT here. 😆

 

This is the script. Please adjust your folders path accordingly. 
im

Import re



def is_valid_group(lines):

    """

    Checks if all the lines in a group contain only valid numeric values in the correct places.

    """

    for line in lines:

        parts = line.strip().split()

        # Lines with exactly 4 parts should be checked for all numeric values

        if len(parts) == 4:

            if not all(part.isdigit() for part in parts):

                return False

    return True



def process_file(input_path, output_path):

    with open(input_path, 'r', encoding='latin-1') as file:

        lines = file.readlines()



    valid_lines = []

    current_group = []

    in_group = False



    for line in lines:

        if line.startswith("Group"):

            if in_group:

                if is_valid_group(current_group):

                    valid_lines.extend(current_group)

                current_group = []

            in_group = True

        if in_group:

            current_group.append(line)

        else:

            valid_lines.append(line)

        if line.strip() == "}":

            if in_group:

                if is_valid_group(current_group):

                    valid_lines.extend(current_group)

            current_group = []

            in_group = False



    # Write the valid lines back to the output file

    with open(output_path, 'w', encoding='utf-8') as file:

        file.writelines(valid_lines)




# File paths

input_file = r'C:\Users\...special_item_group.txt'

output_file = r'C:\Users\...special_item_group_decoded.txt'



# Process the file

process_file(input_file, output_file)

I know is not ideal, but if you already have a special_item_group.txt file that is not working for you, instead of starting from 0 with it, you can just re-construct it with the missing groups. 🙂 

 

Edited by KolenMG
  • muscle 1
  • Love 1
  • Love 1
Link to comment
https://metin2.dev/topic/32866-special_item_group-file-fixer/
Share on other sites

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/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.