• The moderator of this forum is jetou.
  • Welcome to Smogon! Take a moment to read the Introduction to Smogon for a run-down on everything Smogon, and make sure you take some time to read the global rules.

Programming Making a custom format and mod

Hi, I don't really want to drag you along too long.
I'm struggling to find proper documentation or examples on this, and digging through forks is not helping me much either.

I forked the github and created my own Format. I'm just trying to understand how to create and edit formats on my own and took a look at what was there. The idea to start: Gen9 Natdex OU, but adding a dummy Ubers pokémon (Zekrom) with a dummy Ubers signature move it's not supposed to have (Geomancy) and changing it's type. For this, I added a format, created a mod (gen9custom) adding a learnset and a pokédex file, as given below:
Formats
JavaScript:
{
        section: "Custom formats",
    },
    {
        name: "[Gen 9] National Dex Custom",
        mod: 'gen9custom',
        ruleset: ['Standard NatDex'],
        banlist: [
            'ND Uber', 'ND AG', 'Arena Trap', 'Moody', 'Power Construct', 'Shadow Tag', 'King\'s Rock',
            'Quick Claw', 'Razor Fang', 'Assist', 'Baton Pass', 'Last Respects', 'Shed Tail',
        ],
        unbanlist: ['Zekrom'],
    },
What is of note is the naming here; National Dex [name] is the prefix because this somehow fixes item display.

Learnset
JavaScript:
import type { ModdedLearnsetData } from "../../../sim/dex-species";

export const Learnsets: { [speciesid: string]: ModdedLearnsetData } = {
    zekrom: {
        inherit: true,
        learnset: {
            geomancy: ["9L1"],
        },
    },
};

Pokedex (seems to work as wanted, though I have not conducted a thorough stat test Abilities were still valid and the typing had changed when dealing damage)
JavaScript:
import type { ModdedSpeciesData } from "../../../sim/dex-species";

export const Pokedex: { [speciesid: string]: ModdedSpeciesData } = {
    zekrom: {
        inherit: true,
        types: ["Fairy"],
    },
};

Now the Format shows up properly, however there's a couple issues with it that I just can't figure out.
This is what you get forked for the current gen's Natdex OU (so gen9 natdex ou as of right now)
JavaScript:
{
        name: "[Gen 9] National Dex",
        mod: 'gen9',
        ruleset: ['Standard NatDex', 'Terastal Clause'],
        banlist: [
            'ND Uber', 'ND AG', 'Arena Trap', 'Moody', 'Power Construct', 'Shadow Tag', 'King\'s Rock',
            'Quick Claw', 'Razor Fang', 'Assist', 'Baton Pass', 'Last Respects', 'Shed Tail',
        ],
    },
The Standard Natdex ruleset implements the access to unobtainable and past mons and items (if I'm not mistaken. See rulesets.ts lines 92-156)

However, this implementation lacks some things I cannot quite understand. Keep in mind these changes are pure ass, I just want to understand how to change all these sorts of things (if possible).

First of all, the biggest problem, changing Zekrom's moveset now makes it ONLY able to use Geomancy. I tested unbanning Zamazenta instead and giving it Geomancy as Zekrom is not in Gen9 (dexit) and as such might not have had a moveset by default, but it causes the same issue.
It seems like it doesn't properly inherit the moveset and instead completely overwrites it. I could always copy paste the entire pokédex's learnset and edit that, but preferably the changes are just an extention using inheritance to retain maintainability. For this, the 'inherit' option would seemingly work, but it seems to both work and not work; it works for other files, like inheriting from generations. It is available for use in learnsets however, as seen in the learnset for gen8 & gen5bw1.

Besides from this, unbanning Zekrom in turn removes the ILLEGAL tag from all Uber and AG pokémon. At the same time, moveset changes are also not reflected in the teambuilder: Geomancy is in this example still marked as ILLEGAL for Zekrom, with all it's regular moves still displaying as normal when they wouldn't get through the team validator.
The typing is updated and the moves listed are usable in battle, they are however also not displayed; not in the teambuilder or in-battle nor through commands.
I don't really know which ones of these are feasible to fix if any, but I'd still like to ask. I've spent a good couple days scouring the internet at this point and I just can't seem to find much if anything.
 
I have now gotten it to work through /dt [mon], [format] (I was using the command incorrectly earlier, oopsies) and in-battle it *works* but the teambuilder does not reflect any changes made. In-game it doesn't show changed types either, nor updated ability options. As for the move changes, I think my only solution is overwriting the entire learnset with the default one and then edit that one to have my changes. It's just a tad bit unfortunate that I can't seem to replicate the same visual behaviour as other formats seem to acomplish, probably due to under-the-hood behaviour I cannot find.
 
Alright I have answers in that github issue.
tldr, don't use learnsets.ts with inherit, and use a script instead.
To actually reflect changes typing and whatnot, you have to make a custom client. Bummer, but will be managable.
 
Back
Top