• 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!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll 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.

[Scripting Question] Stat Multipliers depending on 'Modes'

Pokeminer20

PDM20, Coder of Chaos!
  • 412
    Posts
    11
    Years
    I plan on making a mechanic where when a Pokemon has a certain 'mode' as I am calling it, it's base stats get multiplied. for example:
    if (Pokemon) is Shiny -> Stats = BaseStats X 2
    if (Pokemon) is Shadow -> Stats = Basestats X 4
    if (Pokemon) is (Custom Mode) -> Stats = Basestats X 6
    I found something similar in Pokemon Empyrean with it's card system but I'm unsure how they did it. any help would be appreciated, because the alternative is making multiform calls with each individual stat for each Pokemon.

    P.S. what I call a "Mode" is just a way of saying Shadow Pokemon, Shiny Pokemon, and Normal Pokemon
     
    Seems like the most sensible place to try and hook into things would be PokeBattle_Pokemon. Hopefully there's a def for each stat and you can simply add your multipliers there, but if not it shouldn't be too tricky to work out how the stats get computed and modify that instead.
     
    Awesome! Mind sharing your solution so that anyone else who comes across this thread can use it? :)
     
    To begin, go into PokeBattle_Pokemon and locate "def isCompatibleWithMove?(move)"
    After it, but before "#Contest Attrtibutes" Add the following.
    Code:
    Def Placeholder#Replace Placeholder with whatever you want
    #return (Number) if (Mode name)
     return 1.0
    end

    or

    Code:
    Def #Multiplier Name (Repeat this Def for each new mode you add to your game)
     return (number) if #Mode Name
     return 1.0
    end
    Def Placeholder#Replace Placeholder with whatever you want
     return 1.0 * #(All Multipler Name you add)
    end
    [The difference between the first and second one is the first only allows one 'mode' to give it's multiplier, the second lets you stack it]
    after that, locate "def calcHP" and "Def calcStats" and replace with the following

    Code:
    # Returns the maximum HP of this Pokémon.
      def calcHP(base,level,iv,ev)
        return 1 if base==1
        base= (base * Placeholder).floor
        ret = ((base*2+iv+(ev>>2))*level/100).floor+level+10
        return ret
      end
    
    # Returns the specified stat of this Pokémon (not used for total HP).
      def calcStat(base,level,iv,ev,pv)
        base= (base * Placeholder).floor
        return ((((base*2+iv+(ev>>2))*level/100).floor+5)*pv/100).floor
      end
    afterwards you will need to find a way to trigger the custom modes however you want, be it an item or debug.
     
    Last edited:
    Back
    Top