• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

v21.1 Python Instant Sorting SQL Script: The Sortable SQL Database Creator! 1.69

This resource pertains to version 21.1 of Pokémon Essentials.
NEW SCRIPT - BUGFIXED AND BETTER THAN EVER, includes Pokemon_Forms edition!

Never again will this script unintentionally buff a Pokemon too much, making its BST over 600!

Create a text file, fill it with this, rename it from New Text Document.txt to "PokemonRebalancerScript.py", and run it by double-clicking it. Get the code from the newly created output.txt file and use it to overwrite your existing pokemon.txt file's code.

Code:
filename = "pokemon.txt"
total_cap = 600  # new total cap
factor_cap = 1.5  # new factor cap
max_value = 255

def calculate_new_values(nums, total_cap, factor_cap):
    original_total = sum(nums)
    if original_total < total_cap:
        factor = min(total_cap / original_total, factor_cap)
        new_first_num = nums[0]  # Store the first number before modifying
        new_rest_nums = [int(min(num * factor, max_value)) for num in nums[1:]]
        new_total = new_first_num + sum(new_rest_nums)
        while new_total > total_cap:
            # Adjust the first number iteratively to ensure the total is not exceeded
            new_first_num = int(min(new_first_num - 1, max_value))
            new_rest_nums = [int(min(num * factor, max_value)) for num in nums[1:]]
            new_total = new_first_num + sum(new_rest_nums)
        new_nums = [new_first_num] + new_rest_nums
    else:
        new_nums = nums
    return new_nums

with open(filename, "r") as f:
    lines = f.readlines()

for i in range(len(lines)):
    line = lines[i]
    if line.startswith("BaseStats = "):
        nums = line.split("=")[1].strip().split(",")
        try:
            nums = [int(num) for num in nums]  # Convert back to integers
            new_nums = calculate_new_values(nums, total_cap, factor_cap)
            new_line = "BaseStats = " + ",".join(map(str, new_nums)) + "\n"
            lines[i] = new_line
        except ValueError:
            # Handle invalid input format gracefully
            pass

with open("output.txt", "w") as f:
    f.writelines(lines)

And then, do the same with a new Python File to be named "PokemonRebalancerScript - Copy.py". This will buff Pokemon Forms, such as Alolan Rattata and Mega Pokemon.

Code:
filename = "pokemon_forms.txt"
total_cap = 600  # new total cap
factor_cap = 1.5  # new factor cap
max_value = 255

def calculate_new_values(nums, total_cap, factor_cap):
    original_total = sum(nums)
    if original_total < total_cap:
        factor = min(total_cap / original_total, factor_cap)
        new_first_num = nums[0]  # Store the first number before modifying
        new_rest_nums = [int(min(num * factor, max_value)) for num in nums[1:]]
        new_total = new_first_num + sum(new_rest_nums)
        while new_total > total_cap:
            # Adjust the first number iteratively to ensure the total is not exceeded
            new_first_num = int(min(new_first_num - 1, max_value))
            new_rest_nums = [int(min(num * factor, max_value)) for num in nums[1:]]
            new_total = new_first_num + sum(new_rest_nums)
        new_nums = [new_first_num] + new_rest_nums
    else:
        new_nums = nums
    return new_nums

with open(filename, "r") as f:
    lines = f.readlines()

for i in range(len(lines)):
    line = lines[i]
    if line.startswith("BaseStats = "):
        nums = line.split("=")[1].strip().split(",")
        try:
            nums = [int(num) for num in nums]  # Convert back to integers
            new_nums = calculate_new_values(nums, total_cap, factor_cap)
            new_line = "BaseStats = " + ",".join(map(str, new_nums)) + "\n"
            lines[i] = new_line
        except ValueError:
            # Handle invalid input format gracefully
            pass

with open("output.txt", "w") as f:
    f.writelines(lines)
Back
Top