• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking 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] Deleting moves with a certain ID on levelup.

  • 1
    Posts
    3
    Years
    • Seen Dec 25, 2021
    Hi, so I am currently trying to get moves with a certain id of 850 or higher to be deleted upon evolution (since they are supposed to be moves unique to each species). The game crashes in debug whenever I try to get there, though. My code is as follows (edited from UI_Evolution (v.19.1), new additions highlighted).

    Code:
      def pbEvolutionSuccess
        # Play cry of evolved species
        frames = GameData::Species.cry_length(@newspecies, @pokemon.form)
        pbBGMStop
        Pokemon.play_cry(@newspecies, @pokemon.form)
        frames.times do
          Graphics.update
          pbUpdate
        end
        # Success jingle/message
        pbMEPlay("Evolution success")
        newspeciesname = GameData::Species.get(@newspecies).name
        pbMessageDisplay(@sprites["msgwindow"],
           _INTL("\\se[]Congratulations! Your {1} evolved into {2}!\\wt[80]",
           @pokemon.name,newspeciesname)) { pbUpdate }
        @sprites["msgwindow"].text = ""
        # Check for consumed item and check if Pokémon should be duplicated
        pbEvolutionMethodAfterEvolution
        # Modify Pokémon to make it evolved
        @pokemon.species = @newspecies
        @pokemon.form    = 0 if @pokemon.isSpecies?(:MOTHIM)
        @pokemon.calc_stats
        # See and own evolved species
        $Trainer.pokedex.register(@pokemon)
        $Trainer.pokedex.set_owned(@newspecies)
        # Learn moves upon evolution for evolved species
    		[B]movesknownevo = @pokemon.moves
    		for i in movesknownevo
    			next if i.id>=850
    			pbDeleteMove(i[1]) { pbUpdate }
    		end[/B]
        movelist = @pokemon.getMoveList
        for i in movelist
          next if i[0]!=0 && i[0][email protected]   # 0 is "learn upon evolution"
          pbLearnMove(@pokemon,i[1],true) { pbUpdate }
        end
      end
     
    Back
    Top