Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Mobs.scp Generator for Hardcore Channels

Joined
Jul 24, 2011
Messages
811
Reaction score
642
What this script does?
-It generating new Mobs.scp (you can define the name) by Percentages multiplier on different stats.
-You can currently set HP, Defense, Damage multipliers. You can also add your own multipliers if you want.
-Useful if you want to make simple hardcore channels.

Usage:
Simply configure the DEFINE parts with the new data and drag and drop your Mobs.scp and it will drop an output with the defined file name.

Python:
import sys
import os

# Put Headers into array
beginning_parts = []
headers = False
mobs_data = []

# DEFINE Output File Name
output_file_name = 'Mobs2.scp'

# DEFINE percentages:
hp_percentage = 500
def_percentage = 125
damage_percentage = 150

if len(sys.argv) > 1:
    file_path = sys.argv[1]  # Access the dropped file path from the command-line arguments
    try:
        with open(file_path, 'r') as file:
            # Loop through the opened Mobs.scp
            for x in file:
                # Put lines until [Mobs] table not found
                if '[Mobs]' not in x and headers == False:
                    beginning_parts.append(x)
                elif '[Mobs]' in x:
                    # Put the headers as well and exit this if branch
                    beginning_parts.append(x)
                    headers = True
                    # Break the current loop
                    continue
                
                # Beginning of data editing   
                if headers == True:   
                    #Monster Line Helper: 19 - HP, 20 - Defense, 25-26 - Min/MaxAttack 1, 32-33 - Min/MaxAttack 2.
                    mob_attr_elements = x.split()
                    # Multiply by the percentages
                    mob_attr_elements[19] = int(float(mob_attr_elements[19]) * (hp_percentage / 100))
                    mob_attr_elements[20] = int(float(mob_attr_elements[20]) * (def_percentage / 100))
                    mob_attr_elements[25] = int(float(mob_attr_elements[25]) * (damage_percentage / 100))
                    mob_attr_elements[26] = int(float(mob_attr_elements[26]) * (damage_percentage / 100))
                    mob_attr_elements[32] = int(float(mob_attr_elements[32]) * (damage_percentage / 100))
                    mob_attr_elements[33] = int(float(mob_attr_elements[33]) * (damage_percentage / 100))
                    # New Line to fix the table when writing back
                    mob_attr_elements.append('\n')
                    
                    separator = '\t'

                    x = separator.join(str(item) for item in mob_attr_elements)
                    
                    mobs_data.append(x)
    except FileNotFoundError:
        print("File not found.")
    # Write Data into file:
    try:
        with open(os.path.dirname(file_path) + "\\" + output_file_name, 'w') as file:
            for item in beginning_parts:
                file.write(str(item))
            for item in mobs_data:
                file.write(str(item))
    except Exception as e:
        print(f"An error occurred: {str(e)}")
else:
    print("No file dropped.")
    
#Debug:
#print (mobs_data)
 
Back
Top