• 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!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Calling and Comparing Pokemon Attributes

  • 3
    Posts
    5
    Years
    • Seen Jun 30, 2019
    Hey Pokeforums, I've recently started working on my first fan game and I'm a little lost.
    I'm completely new to scripting and been just learning as I go but I've come up against a roadblock which I haven't found the answer to anywhere by just searching around.

    What I want to do is have PokeRaces in a town that players can enter and gamble on.

    What I'm not sure how to do is to call and compare specific stats of Pokemon.

    Like I want to call and compare the Speed and HP stats of a Party member the player selects vs a NPCmon I generate for it to face. Again I am very new to scripting wondering if it's something simple I'm missing.
     
    Well, I'm going to assume you already know how to get a pokemon object in a variable (or just check the wiki so helpful: https://essentialsdocs.fandom.com/wiki/Editing_a_Pokémon)
    The calculated speed stat is in pkmn.speed while the Hp is in pkmn.totalhp and pkmn.hp (if you wanted to do something involving reduced performance with less health or something, idk.)
    pkmn.attack and pkmn.spatk are the calculated Attack stats while pkmn.defense and pkmn.spdef are the calculated Defense stats. I know you didn't ask, but there you go nonetheless.

    You can also open up the script editor to see what variables you have available to you for certain classes. Most all the pokemon stuff is in PokeBattle_Pokemon and every one has a neat little description for it.
     
    Thank you for your time and this helped me understand the storage of the Pokemon a little more.
    I'm still stuck on how to express something like

    If: pkmn1.speed > pkmn2.speed
    Then: You win!

    Can you use the RPGMaker Conditional branches to handle the "pkmn" variables or would that expression have to be all in script?

    Basically not sure how to compare them against each other once I have them. Very new to this.
     
    Back
    Top