• 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.

Storing movedata in a global variable?

  • 7
    Posts
    10
    Years
    • Seen Feb 16, 2016
    Hi... I'm kind of new here, picked up RPGMXP about a month back and recently started playing around in Essentials.

    So what I'm trying to do is store multiple moves learned by a storyline event into a seperate variable that can be accessed by a modified move relearner script and taught to a pokemon that way, with each event happening at different times.

    To do that, I edited the script for the pbgetRelearnableMoves to call its movelist from a global variable $transcriberglobal rather than using the pokemon.getMoves method.

    But my question is, how do I store movedata in the variable $transcriberglobal? I tried making an on-map event with the following script as a proof of concept:

    Code:
    $transcriberglobal = []
    $transcriberglobal=$transcriberglobal.push(PBMoves::VINEWHIP)
    print "#{$transcriberglobal}

    But the displayed dialogue box is empty. Am I doing something wrong?
     
    Last edited:
    I can't help but... Maybe looking at Secret Power / Natural Gift /other of those item or environment reliant moves might help you figure it out.
     
    Changed the Question.
    Don't do that. You're allowed to make as many posts as you want, so if you have a different question, ask it in a different post. Any responses made to the original question will just be nonsensical if you completely rewrite it (which you did).

    Here's the original post for reference:

    Need help with custom Sketch-like move

    Hi... I'm kind of new here, picked up RPGMXP about a month back and recently started playing around in Essentials.

    I have a move I'd like to create, and I'd like some help in doing it. The idea is for the move to check for the enemy Pokemon's ID, then replace itself with a new move based on the enemy it's facing. So assuming I'm up against a Venosaur, the move would check that opponent.species is PBSpecies :: VENUSAUR, then replace itself with the move VINEWHIP.

    Since the concept is similar to what Sketch does, I used Sketch as a base and came up with this:

    Code:
    ################################################################################
    # This move permanently turns into a new move based on the ID of the target.
    ################################################################################
    class PokeBattle_Move_XXX < PokeBattle_Move    ### NOTE: change func code indicator
    
    
    
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
       
    
    ################################################################################
    # defines variables to check species of opponent and move to learn
    ################################################################################
      transcribe = 0
      speciesCheck = opponent.species
    ################################################################################
    # Case statement when SpeciesCheck = a, Transcribe = b
    ################################################################################
      case speciesCheck
        when 1     #BULBASAUR
            transcribe = 208 ##VINEWHIP
            return 0
        when 2     #IVYSAUR
            transcribe = 208
            return 0
        when 3    #VENOSAUR
            transcribe = 208
            return 0
        else
            @battle.pbDisplay(_INTL("But it failed!"))
            return -1
        end
    
    ################################################################################
    # Checks if the battler already has the move attempting to be learned.
    ################################################################################
        for i in attacker.moves
          if i.id==transcribe
            @battle.pbDisplay(_INTL("But it failed!"))
            return -1 
          end
        end
    
        pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
        for i in 0...attacker.moves.length             ## check each move known by attacker ##
          if attacker.moves[i].id==@id                 ## if current move being selected is this move ##
            newmove=PBMove.new(transcribe)                ## gets movedata from PBMove, stores in variable newmove ##
            attacker.moves[i]=PokeBattle_Move.pbFromPBMove(@battle,newmove)                    ## changes this move in-battle to newmove ##
            [email protected](attacker.index)                                              ## identifies the move user within out-of-battle  party, designates it as party ##
            party[attacker.pokemonIndex].moves[i]=newmove                                      ## changes the move with the same name as this move of  the actor in the party with same name as attacker to newmove ## 
            movename=PBMoves.getName(transcribe)                             ## checks name of copied move ##
            @battle.pbDisplay(_INTL("{1} sketched  {2}!",attacker.pbThis,movename))            ## displays text {1} = name  of this attacker, {2} = movename of copied move ##
            return 0                   ## returns 0: move successful ##
          end
        end
        @battle.pbDisplay(_INTL("But it failed!"))       ## generic Else  statement. If for some reason no other conditionals fulfilled, this will  display. (each for counts as an elsif statement I guess) ##
        return -1
      end
    end
    So what I'd like is if anyone could take a look at this chunk and tell me if there's anything I did horribly wrong...?

    EDIT: Tested and failed. No error message, not "But it failed!" Just that nothing happened at all. Anyone can point out where I went wrong?

    RESOLVED: Issue was that I returned 0 prematurely.
    Now lolandbeer's comment makes sense.
     
    Ah okay. I was under the impression that it was bad manners to post up multiple Question threads. Okay, will note this for future.
     
    Back
    Top