Registrarse

[RPG - Otros] Error en Move_Effects

Estado
Cerrado para nuevas respuestas.

Diego Mertens

Dartrix Joven
Bueno... no hay mucho que decir, más que he creado un nuevo movimiento, que tiene 4 efectos dependiendo de la suerte, 2 buenos y 2 malos...
Como sea, el error es este:
Código:
---------------------------
Pokemon Essentials Esp v16.2
---------------------------
Script 'PokeBattle_MoveEffects' line 1754: NameError occurred.

undefined local variable or method `attacker' for PokeBattle_Move_162:Class
---------------------------
Aceptar   
---------------------------
La clase en cuestión es esta:
Código:
class PokeBattle_Move_041 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    if opponent.effects[PBEffects::Substitute]>0 && !ignoresSubstitute?(attacker)
      @battle.pbDisplay(_INTL("¡Falló el ataque de {1}!",attacker.pbThis))
      return -1
    end
    ret=-1
    pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    if opponent.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
      opponent.pbIncreaseStat(PBStats::ATTACK,4,attacker,false,self)
      ret=0
    end
    if opponent.pbCanConfuse?(attacker,true,self)
      opponent.pbConfuse
      @battle.pbDisplay(_INTL("¡{1} se encuentra confuso!",opponent.pbThis))
      ret=0
    end
    return ret
  end
end
Y el nuevo movimiento es este:
Código:
class PokeBattle_Move_162 < PokeBattle_Move
  rnd=rand(3)
  if rnd=0
    if !attacker.isFainted?
      attacker.pbReduceHP(attacker.hp)
      attacker.pbFaint if attacker.isFainted?
    end
  elsif rnd=1
    damage=pbEffectFixedDamage(opponent.totalhp,attacker,opponent,hitnum,alltargets,showanimation)
    if opponent.isFainted?
      @battle.pbDisplay(_INTL("¡K.O. en 1 golpe!"))
    end
  elsif rnd=2
    if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
      !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
      !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
      !attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
      !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self) && 
      @battle.pbDisplay(_INTL("¡Las estadísticas de {1} no van a subir más!",attacker.pbThis))
      return -1
    end
    @battle.pbDisplay(_INTL("¡El azar a mejorado a {1}!",attacker.pbThis))
    pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    showanim=true
    if attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self)
      attacker.pbIncreaseStat(PBStats::ATTACK,4,attacker,false,self,showanim)
      showanim=false
    end
    if attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
      attacker.pbIncreaseStat(PBStats::SPATK,4,attacker,false,self,showanim)
      showanim=true
    end
   if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
      attacker.pbIncreaseStat(PBStats::SPDEF,4,attacker,false,self,showanim)
      showanim=false
    end
   if attacker.pbCanIncreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
      attacker.pbIncreaseStat(PBStats::DEFENSE,4,attacker,false,self,showanim)
      showanim=true
    end
   if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
      attacker.pbIncreaseStat(PBStats::SPEED,4,attacker,false,self,showanim)
      showanim=false
    end
  elsif rnd=3
    if !attacker.pbCanDecreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
      !attacker.pbCanDecreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
      !attacker.pbCanDecreaseStatStage?(PBStats::SPDEF,attacker,false,self) &&
      !attacker.pbCanDecreaseStatStage?(PBStats::DEFENSE,attacker,false,self) &&
      !attacker.pbCanDecreaseStatStage?(PBStats::SPEED,attacker,false,self) && 
      @battle.pbDisplay(_INTL("¡Las estadísticas de {1} no van a bajar más!",attacker.pbThis))
      return -1
    end
    @battle.pbDisplay(_INTL("¡El azar le ha fallado a {1}!",attacker.pbThis))
    pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
    showanim=true
    if attacker.pbCanDecreaseStatStage?(PBStats::ATTACK,attacker,false,self)
      attacker.pbDecreaseStat(PBStats::ATTACK,4,attacker,false,self,showanim)
      showanim=false
    end
    if attacker.pbCanDecreaseStatStage?(PBStats::SPATK,attacker,false,self)
      attacker.pbDecreaseStat(PBStats::SPATK,4,attacker,false,self,showanim)
      showanim=true
    end
   if attacker.pbCanDecreaseStatStage?(PBStats::SPDEF,attacker,false,self)
      attacker.pbDecreaseStat(PBStats::SPDEF,4,attacker,false,self,showanim)
      showanim=false
    end
   if attacker.pbCanDecreaseStatStage?(PBStats::DEFENSE,attacker,false,self)
      attacker.pbDecreaseStat(PBStats::DEFENSE,4,attacker,false,self,showanim)
      showanim=true
    end
   if attacker.pbCanDecreaseStatStage?(PBStats::SPEED,attacker,false,self)
      attacker.pbDecreaseStat(PBStats::SPEED,4,attacker,false,self,showanim)
      showanim=false
    end
  end
end
Espero puedan ayudarme, ya que así no podré probar mis nuevos movimientos.
 
Estado
Cerrado para nuevas respuestas.
Arriba