# Checks whether any Pokémon in the party knows the given move, and returns
# the index of that Pokémon, or nil if no Pokémon has that move.
def pbCheckMove(move)
move=getID(PBMoves,move)
return nil if !move || move<=0
for i in $Trainer.party
next if i.isEgg?[COLOR="Red"]
return i if isConst?(i.species,PBSpecies,:SCYTHER) && isConst?(move,PBMoves,:CUT)
return i if isConst?(i.species,PBSpecies,:MACHAMP) && isConst?(move,PBMoves,:STRENGTH)[/COLOR]
for j in i.moves
return i if j.id==move
end
end
return nil
end
Is it possible to do something similar to this but instead have it use an item (ie an ax or something)?
I'd like to add this to my game as well, but this seems like a slow way to code it when there are dozens/hundreds of Pokémon that can learn a particular HM. Is there a way to modify this code so it'll check if the given Pokémon is in a text file (say, one that lists the internal names of all Pokémon that can use Cut)?PSystem_Utilities, around line 2845, add in the red lines.
Code:# Checks whether any Pokémon in the party knows the given move, and returns # the index of that Pokémon, or nil if no Pokémon has that move. def pbCheckMove(move) move=getID(PBMoves,move) return nil if !move || move<=0 for i in $Trainer.party next if i.isEgg?[COLOR="Red"] return i if isConst?(i.species,PBSpecies,:SCYTHER) && isConst?(move,PBMoves,:CUT) return i if isConst?(i.species,PBSpecies,:MACHAMP) && isConst?(move,PBMoves,:STRENGTH)[/COLOR] for j in i.moves return i if j.id==move end end return nil end
Note that this will make it so that you can talk to HM triggers (trees for Cut, boulders for Strength), and the HM moves will work. This will not make them appear in the list of moves that you can use from the Party screen.
Such a list already exists: tm.txt. From there, it's simple to use def pbSpeciesCompatible?.I'd like to add this to my game as well, but this seems like a slow way to code it when there are dozens/hundreds of Pokémon that can learn a particular HM. Is there a way to modify this code so it'll check if the given Pokémon is in a text file (say, one that lists the internal names of all Pokémon that can use Cut)?