• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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.

[Scripting Question] Damaging version of Spite?

  • 53
    Posts
    9
    Years
    I'd like to make a damaging version of Spite.
    I tried using this:
    class PokeBattle_Move_188 < PokeBattle_Move
    def pbAdditionalEffect(attacker,opponent)
    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))
    return 0
    end
    end
    @battle.pbDisplay(_INTL("But it failed!"))
    return -1
    end
    end
    But I just get an error message upon using the move.
     
    Try this code:
    Code:
    class PokeBattle_Move_188 < PokeBattle_Move
     def pbAdditionalEffect(attacker,opponent)
       [COLOR=Red]ret=-1[/COLOR]
       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))
    [COLOR=Red]        ret=([/COLOR][COLOR=Red][COLOR=Red]@basedamage>0[/COLOR]) ? super(attacker,opponent,hitnum,alltargets,showanimation) : 0[/COLOR]
          end
        end
        [COLOR=Red]@battle.pbDisplay(_INTL("But it failed!")) if ret==-1[/COLOR]
        [COLOR=Red]return ret[/COLOR]
      end
    end
     
    Back
    Top