• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

RPG classes for player

  • 2
    Posts
    5
    Years
    • Seen Feb 4, 2025
    I want to create unique RPG classes that change the gameplay by reducing the number of steps required to hatch an egg, increase shiny odds, increase capture rate etc. The class would be locked in at character creation, the idea is to make it like a single player mmorpg

    The problem is I have no idea how to script, so if anyone knows how to do this it'd be most appreciated if you could help me
     
    #==============================================================================
    # ■ Trainer Classes with Game-Altering Effects
    #==============================================================================

    module TrainerClasses

    # Define your trainer classes and their effects here.
    # Each class should be a hash with the following keys:
    # :name => The name of the trainer class.
    # :description => A short description of the class.
    # :effects => A hash of effects and their values.

    TRAINER_CLASSES = {
    "Breeder" => {
    :name => "Breeder",
    :description => "Masters of Pokémon breeding.",
    :effects => {
    :egg_hatch_rate => 0.5, # 50% faster hatching (multiplier)
    }
    },
    "Hunter" => {
    :name => "Hunter",
    :description => "Skilled at catching wild Pokémon.",
    :effects => {
    :catch_rate_bonus => 1.2, # 20% increased catch rate (multiplier)
    :shiny_rate_bonus => 1.5, # 50% increased shiny rate (multiplier)
    }
    },
    "Ace Trainer" => {
    :name => "Ace Trainer",
    :description => "Exceptional trainers with a knack for battle.",
    :effects => {
    :exp_gain_bonus => 1.2, # 20% increased EXP gain (multiplier)
    }
    },
    "Lucky Trainer" => {
    :name => "Lucky Trainer",
    :description => "Blessed by fortune, luck is on their side.",
    :effects => {
    :shiny_rate_bonus => 2.0, # Double Shiny Odds (multiplier)
    :exp_gain_bonus => 1.1, # 10% increased EXP gain (multiplier)
    :catch_rate_bonus => 1.1, # 10% increased catch rate (multiplier)
    }
    }
    }

    # Get the effects for a given trainer class.
    def self.get_effects(trainer_class_name)
    return TRAINER_CLASSES[trainer_class_name][:effects] if TRAINER_CLASSES.has_key?(trainer_class_name)
    return {} # Return empty hash if class not found
    end

    end

    #==============================================================================
    # ■ Applying Effects in Relevant Scripts
    #==============================================================================

    #------------------------------------------------------------------------------
    # Egg Hatching (PokemonEgg)
    #------------------------------------------------------------------------------

    class PokemonEgg
    alias :__old_initialize__ :initialize
    def initialize(*args)
    __old_initialize__(*args)
    trainer_class = $Trainer.trainer_type
    effects = TrainerClasses.get_effects(trainer_class)
    if effects[:egg_hatch_rate]
    @steps_to_hatch = (@steps_to_hatch * effects[:egg_hatch_rate]).to_i # Apply reduction
    end
    end
    end

    #------------------------------------------------------------------------------
    # Catch Rate (Battle)
    #------------------------------------------------------------------------------

    class Battle
    alias :__old_pbCatch__ :pbCatch
    def pbCatch(pkmn)
    catch_rate = pkmn.catchRate
    trainer_class = $Trainer.trainer_type
    effects = TrainerClasses.get_effects(trainer_class)
    if effects[:catch_rate_bonus]
    catch_rate = (catch_rate * effects[:catch_rate_bonus]).to_i # Apply bonus
    end
    __old_pbCatch__(pkmn, catch_rate)
    end
    end

    #------------------------------------------------------------------------------
    # Shiny Rate (Pokemon)
    #------------------------------------------------------------------------------

    class Pokemon
    alias :__old_initialize__ :initialize
    def initialize(*args)
    __old_initialize__(*args)
    trainer_class = $Trainer.trainer_type
    effects = TrainerClasses.get_effects(trainer_class)
    if effects[:shiny_rate_bonus]
    @personalID = rand(2**16) | (rand(2**16) << 16) if rand(8192) < (8192/effects[:shiny_rate_bonus]).floor
    end
    end
    end

    #------------------------------------------------------------------------------
    # EXP Gain (Battle)
    #------------------------------------------------------------------------------

    class Battle::BattlePeer
    alias :__old_pbGainExpOne__ :pbGainExpOne
    def pbGainExpOne(winner,defeated,exp)
    trainer_class = $Trainer.trainer_type
    effects = TrainerClasses.get_effects(trainer_class)
    if effects[:exp_gain_bonus]
    exp = (exp * effects[:exp_gain_bonus]).floor
    end
    __old_pbGainExpOne__(winner,defeated,exp)
    end
    end

    #==============================================================================
    # Example Usage (Setting Trainer Class)
    #==============================================================================
    # In a script event or other appropriate place:

    # $Trainer.trainer_type = "Hunter" # Set the trainer's class
    # puts $Trainer.trainer_type # Check the trainer's class

    #==============================================================================
    # End of Script
    #==============================================================================

    This is what I got when I asked an abominable intelligence for help, if anyone can make this work for Pokémon Essentials I'll be most grateful
     
    Back
    Top