• 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.

[Scripting Question] Damaging version of Spite?

53
Posts
8
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.
     
    188
    Posts
    9
    Years
    • Seen Jan 21, 2024
    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