ego Posted June 3, 2017 Share Posted June 3, 2017 Hi there, so here's a little mystery: I wanted to add a new move for my game. I looked at the move Curse first and decided to copy it and modify it later. Copy, paste, change the function code from 10D to 159, define a new move with code 159 -> Check! Everything should work since the only thing I changed so far was the function code. Then I went into the game (debug mode) and taught a Pokemon the new move, went into a battle, used it and got the following error message: Spoiler --------------------------- Exception: NoMethodError Message: undefined method `pbEffects' for #<PokeBattle_Move_159:0xd452b88> PokeBattle_Battler:3149:in `pbUseMove' PokeBattle_Battler:3148:in `logonerr' PokeBattle_Battler:3148:in `pbUseMove' PokeBattle_Battler:3381:in `pbProcessTurn' PokeBattle_Battler:3380:in `logonerr' PokeBattle_Battler:3380:in `pbProcessTurn' PokeBattle_Battle:2897:in `pbAttackPhase' PokeBattle_Battle:2894:in `each' PokeBattle_Battle:2894:in `pbAttackPhase' PokeBattle_Battle:2882:in `times' I researched a lot and couldn't find anyone else with the same problem. There were some similar ones, but that didn't help me fixing my problem. I also tried to make an "empty" move effect by just putting the class and an end line, but it gave me the same effect. It's really weird that, even though I only copied and paste the whole move effect it gives me this error. Does anyone have an idea what could be going wrong here? Or does anyone have eperience with adding new move effects? Here's what my copied code looks like now Spoiler ################################################################################ # Voodoo Curse ################################################################################ class PokeBattle_Move_159 < PokeBattle_Move def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true) failed=false if attacker.pbHasType?(:GHOST) if opponent.effects[PBEffects::Curse] || opponent.pbOwnSide.effects[PBEffects::CraftyShield] failed=true else pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation) @battle.pbDisplay(_INTL("{1} cut its own HP and laid a curse on {2}!",attacker.pbThis,opponent.pbThis(true))) opponent.effects[PBEffects::Curse]=true attacker.pbReduceHP((attacker.totalhp/2).floor) end else lowerspeed=attacker.pbCanReduceStatStage?(PBStats::SPEED,attacker,false,self) raiseatk=attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) raisedef=attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) if !lowerspeed && !raiseatk && !raisedef failed=true else pbShowAnimation(@id,attacker,nil,1,alltargets,showanimation) # Non-Ghost move animation if lowerspeed attacker.pbReduceStat(PBStats::SPEED,1,attacker,false,self) end showanim=true if raiseatk attacker.pbIncreaseStat(PBStats::ATTACK,1,attacker,false,self,showanim) showanim=false end if raisedef attacker.pbIncreaseStat(PBStats::DEFENSE,1,attacker,false,self,showanim) showanim=false end end end if failed @battle.pbDisplay(_INTL("But it failed!")) end return failed ? -1 : 0 end end Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.