• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

Making a Damaging version of Spite

SoulfulLex

Empiricist-at-Large
10
Posts
10
Years
  • Seen Aug 19, 2019
So I'm trying to make a damaging version of Spite. I worked on this once before when I was making my game in Essentials v13. I never got it to work, primarily because I couldn't understand much of the MoveEffects code back then (and I didn't know that moves that did damage AND had primary effects, like Clear Smog, had to have ret=super or return super to do damage and its intended effect).

Since then, I studied the Syntax of MoveEffects some more, and I have the basics down. I'm now testing the moves I made for my game in Essentials v14. The problem now is this effect isn't working at all.

This is the code that I came up with:

Code:
################################################################################
# Target's last move used loses 4 PP. (As part of Attack)
################################################################################
class PokeBattle_Move_141 < PokeBattle_Move
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    ret=super(attacker,opponent,hitnum,alltargets,showanimation)
    if !opponent.isFainted? && opponent.damagestate.calcdamage>0 &&
       !opponent.damagestate.substitute && opponent.lastMoveUsed<=0
      for i in opponent.moves
        if i.id==opponent.lastMoveUsed && i.id>0 && i.pp>0
          pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
          reduction=[4,i.pp].min
          i.pp-=reduction
          @battle.pbDisplay(_INTL("It reduced the PP of {1}'s {2} by {3}!",opponent.pbThis(true),i.name,reduction))
        end
      end
    end
    return ret
  end
end
The Pokemon attacks, but nothing else happens. I tested this before and after the opposing Pokemon made a move. I've also tested this in Vanilla Essentials v14 while I had the Internal Flag set, but nothing came up in the Debug Log (or in the errorlog.txt) Can someone tell me what I'm doing wrong (or a possible fix)?
 
Back
Top