• 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] Trying to edit Move Effects

  • 19
    Posts
    4
    Years
    • Seen Jul 21, 2022
    So I'm trying to make a move that lowers the enemy's accuracy by 1 stage, but also lowers your defense by one stage. I thought I made it good enough, but when I try to run it, it gives my a syntax error. If anyone could help, I'd appreciate it! I have the new move at the very bottom and thats where it says the error is coming from. I attached a copy of my scripts file.
     

    Attachments

    • script.txt
      369.1 KB · Views: 1
    Last edited:
    So I'm trying to make a move that lowers the enemy's accuracy by 1 stage, but also lowers your defense by one stage. I thought I made it good enough, but when I try to run it, it gives my a syntax error. If anyone could help, I'd appreciate it! I have the new move at the very bottom and thats where it says the error is coming from. I attached a copy of my scripts file.

    I think you're missing an "end". Should be fixed here:
    Code:
    ################################################################################
    # Lowers your defense and opponents accuracy.  (Sweet Bomb)
    ################################################################################
    
    class PokeBattle_Move_159 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if !attacker.pbCanIncreaseStatStage?(PBStats::ATTACK,attacker,false,self) &&
           !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
           !attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
          @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis))
          return -1
        end
        pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
        showanim=true
        if attacker.pbCanReduceStatStage?(PBStats::DEFENSE,attacker,false,self)
          attacker.pbReduceStat(PBStats::DEFENSE,1,attacker,false,self,showanim)
          showanim=false
        end
        if attacker.pbCanReduceStatStage?(PBStats::SPDEF,attacker,false,self)
          attacker.pbReduceStat(PBStats::SPDEF,1,attacker,false,self,showanim)
          showanim=false
        end
      end
    
      def pbAdditionalEffect(attacker,opponent)
        return if opponent.damagestate.substitute
        if opponent.pbCanReduceStatStage?(PBStats::ACCURACY,attacker,false,self)
          opponent.pbReduceStat(PBStats::ACCURACY,1,attacker,false,self)
        end
        return !attacker.pokemon || !attacker.pokemon.sweetbomb
      end
    end
     
    Now it says that pbUseMove is undefined

    [PokeCommunity.com] Trying to edit Move Effects


    I'll link the script for pokebattle clauses
     
    #===============================================================================
    # This script modifies the battle system to implement battle rules.
    #===============================================================================

    class PokeBattle_Battle
    unless @__clauses__aliased
    alias __clauses__pbDecisionOnDraw pbDecisionOnDraw
    alias __clauses__pbEndOfRoundPhase pbEndOfRoundPhase
    @__clauses__aliased=true
    end

    def pbDecisionOnDraw()
    if @rules["selfkoclause"]
    if self.lastMoveUser<0
    # in extreme cases there may be no last move user
    return 5 # game is a draw
    elsif pbIsOpposing?(self.lastMoveUser)
    return 2 # loss
    else
    return 1 # win
    end
    end
    return __clauses__pbDecisionOnDraw()
    end

    def pbJudgeCheckpoint(attacker,move=nil)
    if @rules["drawclause"] # Note: Also includes Life Orb (not implemented)
    if !(move && move.function==0xDD) # Not a draw if fainting occurred due to Liquid Ooze
    if pbAllFainted?(@party1) && pbAllFainted?(@party2)
    @decision=pbIsOpposing?(@attacker.index) ? 1 : 2
    end
    end
    elsif @rules["modifiedselfdestructclause"] && move &&
    move.function==0xE0 # Selfdestruct
    if pbAllFainted?(@party1) && pbAllFainted?(@party2)
    @decision=pbIsOpposing?(@attacker.index) ? 1 : 2
    end
    end
    end

    def pbEndOfRoundPhase()
    __clauses__pbEndOfRoundPhase()
    if @rules["suddendeath"] && @decision==0
    if pbPokemonCount(@party1)>pbPokemonCount(@party2)
    @decision=1 # loss
    elsif pbPokemonCount(@party1)<pbPokemonCount(@party2)
    @decision=2 # win
    end
    end
    end
    end



    class PokeBattle_Battler
    unless @__clauses__aliased
    alias __clauses__pbCanSleep? pbCanSleep?
    alias __clauses__pbCanSleepYawn? pbCanSleepYawn?
    alias __clauses__pbCanFreeze? pbCanFreeze?
    alias __clauses__pbUseMove pbUseMove
    @__clauses__aliased=true
    end

    def pbHasStatusPokemon?(status)
    count=0
    [email protected](self.index)
    for i in 0...party.length
    if party && !party.egg? &&
    party.status==status
    count+=1
    end
    end
    return (count>0)
    end

    def pbCanSleepYawn?()
    if (@battle.rules["sleepclause"] || @battle.rules["modifiedsleepclause"]) &&
    pbHasStatusPokemon?(PBStatuses::SLEEP)
    return false
    end
    return __clauses__pbCanSleepYawn?()
    end

    def pbCanFreeze?(*arg)
    if @battle.rules["freezeclause"] && pbHasStatusPokemon?(PBStatuses::FROZEN)
    return false
    end
    return __clauses__pbCanFreeze?(*arg)
    end

    def pbCanSleep?(attacker,showMessages,move=nil,ignorestatus=false)
    selfsleep=(attacker && attacker.index==self.index)
    if ((@battle.rules["modifiedsleepclause"]) || (!selfsleep && @battle.rules["sleepclause"])) &&
    pbHasStatusPokemon?(PBStatuses::SLEEP)
    if showMessages
    @battle.pbDisplay(_INTL("But {1} couldn't sleep!",self.pbThis(true)))
    end
    return false
    end
    return __clauses__pbCanSleep?(attacker,showMessages,move,ignorestatus)
    end
    end



    class PokeBattle_Move_022 # Double Team
    def pbMoveFailed(attacker,opponent)
    return true if @battle.rules["evasionclause"]
    return false
    end
    end



    class PokeBattle_Move_034 # Minimize
    def pbMoveFailed(attacker,opponent)
    return true if @battle.rules["evasionclause"]
    return false
    end
    end



    class PokeBattle_Move_067 # Skill Swap
    def pbMoveFailed(attacker,opponent)
    return true if @battle.rules["skillswapclause"]
    return false
    end
    end



    class PokeBattle_Move_06A # Sonicboom
    def pbMoveFailed(attacker,opponent)
    return true if @battle.rules["sonicboomclause"]
    return false
    end
    end



    class PokeBattle_Move_06B # Dragon Rage
    def pbMoveFailed(attacker,opponent)
    return true if @battle.rules["sonicboomclause"]
    return false
    end
    end



    class PokeBattle_Move_070 # OHKO moves
    def pbMoveFailed(attacker,opponent)
    return true if @battle.rules["ohkoclause"]
    return false
    end
    end



    class PokeBattle_Move_0E0 # Selfdestruct
    unless @__clauses__aliased
    alias __clauses__pbOnStartUse pbOnStartUse
    @__clauses__aliased=true
    end

    def pbOnStartUse(attacker)
    if @battle.rules["selfkoclause"]
    # Check whether no unfainted Pokemon remain in either party
    count=attacker.pbNonActivePokemonCount()
    count+=attacker.pbOppositeOpposing.pbNonActivePokemonCount()
    if count==0
    @battle.pbDisplay("But it failed!")
    return false
    end
    end
    if @battle.rules["selfdestructclause"]
    # Check whether no unfainted Pokemon remain in either party
    count=attacker.pbNonActivePokemonCount()
    count+=attacker.pbOppositeOpposing.pbNonActivePokemonCount()
    if count==0
    @battle.pbDisplay(_INTL("{1}'s team was disqualified!",attacker.pbThis))
    @[email protected]?(attacker.index) ? 1 : 2
    return false
    end
    end
    __clauses__pbOnStartUse(attacker)
    end
    end



    class PokeBattle_Move_0E5 # Perish Song
    def pbMoveFailed(attacker,opponent)
    if @battle.rules["perishsongclause"] && attacker.pbNonActivePokemonCount()==0
    return true
    end
    return false
    end
    end



    class PokeBattle_Move_0E7 # Destiny Bond
    def pbMoveFailed(attacker,opponent)
    if @battle.rules["perishsongclause"] && attacker.pbNonActivePokemonCount()==0
    return true
    end
    return false
    end
    end
     
    Back
    Top