• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Scottie, Todd, Serena, Kris - 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] Getting move data from a TM

Franzo

Developing something...
  • 94
    Posts
    17
    Years
    So as far as I know with Essentials you can get the move name of a TM like this.
    Code:
    machine=$ItemData[PBItems::TM01][9]
    movename=PBMoves.getName(machine)
    How would I go about getting other move data (type, category, power) for a TM?
     
    Digging a bit in the code I found this, maybe it can help you:
    Code:
    def initialize(battle,move)
        @id = move.id
        @battle = battle
        @name = PBMoves.getName(id)   # Get the move's name
        # Get data on the move
        [COLOR="Blue"]movedata = PBMoveData.new(id)[/COLOR]
        [COLOR="Red"]@function   = movedata.function
        @basedamage = movedata.basedamage
        @type       = movedata.type
        @accuracy   = movedata.accuracy
        @addlEffect = movedata.addlEffect
        @target     = movedata.target
        @priority   = movedata.priority
        @flags      = movedata.flags
        @category   = movedata.category
        @thismove   = move
        @pp         = move.pp[/COLOR]   # Can be changed with Mimic/Transform
        @powerboost = false   # For Aerilate, Pixilate, Refrigerate
      end
     
    Yeah, I saw that code but I'm not sure how I'd get the moves ID number.
     
    If using:

    Code:
    machine=$ItemData[PBItems::TM01][9]
    movename=PBMoves.getName(machine)

    you get the TM's name, you can also try for example:

    Code:
    machine=$ItemData[PBItems::TM01][9]
    movedata = PBMoveData.new(machine)
    type       = movedata.type

    If you add
    Code:
    p type
    it prints 17 which I assume is the type of the move Hone Claws "Dark".

    If you open your pbs file "tm" you can see how hone claws is the first TM.
     
    Last edited:
    Yep that did it! Thanks for your help.
     
    Back
    Top