Solved Mints Items (SWSH)

WolfPP

Discord Wolf#1235
Member
Posts
98
#1
Am trying to make a script for Mints items (from SWSH). So, what I have so far:
In 'PItem_Items' script, paste this def above 'def pbItemRestoreHP(pokemon,restorehp)':
Code:
#===============================================================================
# Convert a Pokémon's stats
#===============================================================================
def pbConvertStats(pokemon,scene,item,nature,raise,lower)
  if nature==pokemon.nature
    scene.pbDisplay(_INTL("It won't have any effect."))
    return false
  end
  if scene.pbConfirm(_INTL("It might affect {1}'s stats.\nAre you sure you want to use it?",pokemon.name))
    pokemon.stats[raise]+=(pokemon.stats[raise]/100)
    pokemon.stats[lower]-=(pokemon.stats[lower]/100)
    pokemon.calcStats
    scene.pbRefresh
    scene.pbDisplay(_INTL("{1}'s stats may have changed due to the effects of the {2}!",pokemon.name,PBItems.getName(item)))
    return true
  end
end
Then, add inside 'PItem_ItemEffects' script, below Prison Bottle's script:
Code:
ItemHandlers::UseOnPokemon.add(:ADAMANTMINT,proc{|item,pokemon,scene|
   next pbConvertStats(pokemon,scene,item,PBNatures::ADAMANT,PBStats::ATTACK,PBStats::SPATK)
})

The question is, the code doesn't recognize what is 'stats' (even if 'attack', if I write 'pokemon.attack'):
Code:
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `stats' for #<PokeBattle_Pokemon:0x9899b90>
PItem_ItemEffects:1306
PItem_ItemEffects:1300:in `call'
EventHandlers:150:in `trigger'
PItem_Items:232:in `triggerUseOnPokemon'
PItem_Items:659:in `pbUseItem'
PItem_Items:653:in `loop'
PItem_Items:678:in `pbUseItem'
PItem_Items:649:in `pbFadeOutIn'
PItem_Items:649:in `pbUseItem'
PScreen_Bag:486:in `pbStartScreen'
PScreen_Bag:448:in `loop'
PScreen_Bag:563:in `pbStartScreen'
PScreen_PauseMenu:189:in `pbStartPokemonMenu'
PScreen_PauseMenu:186:in `pbFadeOutIn'
PScreen_PauseMenu:186:in `pbStartPokemonMenu'
PScreen_PauseMenu:142:in `loop'
PScreen_PauseMenu:271:in `pbStartPokemonMenu'
Scene_Map:127:in `call_menu'
Scene_Map:213:in `update'
Scene_Map:234:in `main'
Scene_Map:231:in `loop'
Scene_Map:236:in `main'
Main:49:in `mainFunctionDebug'
Main:27:in `mainFunction'
Main:27:in `pbCriticalCode'
Code:
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `attack=' for #<PokeBattle_Pokemon:0x9a57300>
PItem_ItemEffects:1306
PItem_ItemEffects:1300:in `call'
EventHandlers:150:in `trigger'
PItem_Items:232:in `triggerUseOnPokemon'
PItem_Items:659:in `pbUseItem'
PItem_Items:653:in `loop'
PItem_Items:678:in `pbUseItem'
PItem_Items:649:in `pbFadeOutIn'
PItem_Items:649:in `pbUseItem'
PScreen_Bag:486:in `pbStartScreen'
PScreen_Bag:448:in `loop'
PScreen_Bag:563:in `pbStartScreen'
PScreen_PauseMenu:189:in `pbStartPokemonMenu'
PScreen_PauseMenu:186:in `pbFadeOutIn'
PScreen_PauseMenu:186:in `pbStartPokemonMenu'
PScreen_PauseMenu:142:in `loop'
PScreen_PauseMenu:271:in `pbStartPokemonMenu'
Scene_Map:127:in `call_menu'
Scene_Map:213:in `update'
Scene_Map:234:in `main'
Scene_Map:231:in `loop'
Scene_Map:236:in `main'
Main:49:in `mainFunctionDebug'
Main:27:in `mainFunction'
Main:27:in `pbCriticalCode'

IDK if is possible to put some attr_reader or access inside 'PItem_ItemEffects' or 'PItem_Items'...
 
Top