• 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] Help with setting Blank Moves script

  • 10
    Posts
    11
    Years
    • Seen Apr 23, 2022
    I was writing a script to generate custom event encounter (where you can spawn any species with any ability, item or move combination). It works when I pass all four moves but I can't get it to work when I want the Pokemon to learn only 1 move (3 should be blank).

    The event is triggering this
    Code:
     pbCustomWildBattle({'species' => :SNORLAX, 'ability' => :PRESSURE, 'level' => 35, 'item' => :AIRBALLOON})

    The error
    Code:
    Message: Unknown ID 0.
    According to wiki, 0 is supposed to be the ID for no move

    The script
    Code:
    species = GameData::Species.get(hash.fetch('species', :BULBASAUR)).id
    level = hash.fetch('level', 20)
    ability = hash.fetch('ability', :SPEEDBOOST)
    item = hash.fetch('item', :LEFTOVERS)
    # moves is an array containing a list of moves I want it to spawn with
    moves = hash.fetch('moves', [])
    genwildpoke = Pokemon.new(species,level)
    # Customize the generated pokemon
    genwildpoke.ability = ability
    genwildpoke.item = item
    for i in 0..3
        # if a custom move was not mentioned
        if moves[i].nil?
          # and if this is the first move slot
          if i < 1
            # give this pokemon metronome as the first move [COLOR="Cyan"]THIS WORKS FINE[/COLOR]
            genwildpoke.moves[i] = Pokemon::Move.new(:METRONOME)
          else
            # otherwise give all other slots a "no move" [URL="https://essentialsdocs.fandom.com/wiki/Moves"]as defined here[/URL] [COLOR="Red"]THIS DOES NOT WORK[/COLOR]
            genwildpoke.moves[i] = Pokemon::Move.new(0)
          end
        else 
          # otherwise give it whatever moves i want in that slot [COLOR="Cyan"]THIS WORKS FINE[/COLOR]
          genwildpoke.moves[i] = Pokemon::Move.new(moves[i])
        end
      end
     
    Last edited:
    Back
    Top