• 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] Access forms' metrics

  • 7
    Posts
    7
    Years
    • Seen Apr 3, 2021
    Hello,

    I want to take into account the metrics to position sprites in battle according to their forms. I have seen in the forums a workaround redefining the way forms are created in MultipleForms. I have already changed adjustBattleSpriteY to get the pokemon not the species and all its appearances but I cannot find a solution to access forms' metrics in getBattleSpriteMetricOffset.

    I have seen that in the development of v18 it is a bug fixed but I'd like to have it before.
    I have checked in the compiler but it is not clear to me how to access the metrics for a form:
    Code:
      metrics[0].fillNils(dexdatas.length,999) # player Y
      metrics[1].fillNils(dexdatas.length,999) # enemy Y
      metrics[2].fillNils(dexdatas.length,999) # altitude
      newmetrics = load_data("Data/metrics.dat")
      mx = [maxValue,metrics[0].length-1,metrics[1].length-1,metrics[2].length-1].max
      for sp in 1..mx
        nsp = pbGetSpeciesFromFSpecies(sp)[0]
        for i in 0..2
          newmetrics[i][sp] = (metrics[i][sp]!=999) ? metrics[i][sp] : newmetrics[i][nsp]
        end
      end
      save_data(newmetrics,"Data/metrics.dat")

    Can anyone help me solve this?

    Thank you
     
    So the problem isn't in getBattleSpriteMetricOffset, but in the code that calls it. Basically, instead of passing the fspecies, it passes the regular species.

    I'm kinda lazy right now, so here's a default Pokebattle_Scene with the necessary changes, plus a new PokeBattle_Battler method
    Code:
      def fSpecies
        return @species if !@pokemon
        return @pokemon.fSpecies
      end
    If you made edits to your own script section, a using a diff checker will show the exact changes made, but it's basically just finding every instance of adjustBattleSpriteY and showShadow? and make it use fspecies.
     

    Attachments

    • fspecies_scene.txt
      112.9 KB · Views: 8
    Back
    Top