• 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] Setting up this move in PokeBattle_MoveEffects

15
Posts
4
Years
  • Hello!
    I've set up a couple of moves myself for a game I'm working on, but this one is proving more difficult.

    I'm trying to sort of merge Geomancy and Relic Song. My goal is to have a move that takes two turns, but instead of giving stat buffs on the second turn, it changes the Pokemon's form. (Also- for clarity, the form change is the Pokemon being joined by a group of them, kind of like Wishiwashi's ability)

    Code:
    class PokeBattle_Move_644 < PokeBattle_Move
      def pbTwoTurnAttack(attacker)
        @immediate=false
        if !@immediate && attacker.hasWorkingItem(:POWERHERB)
          @immediate=true
        end
        return false if @immediate
        return attacker.effects[PBEffects::TwoTurnAttack]==0
      end
    
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
          pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
          @battle.pbDisplay(_INTL("{1} is preparing something!",attacker.pbThis))
        end
        if @immediate
          @battle.pbCommonAnimation("UseItem",attacker,nil)
          @battle.pbDisplay(_INTL("{1} is ready due to its Power Herb!",attacker.pbThis))
          attacker.pbConsumeItem
        end
        return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
        if !attacker.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self) &&
           !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,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.pbCanIncreaseStatStage?(PBStats::SPATK,attacker,false,self)
          attacker.pbIncreaseStat(PBStats::SPATK,2,attacker,false,self,showanim)
          showanim=false
        end
        if attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,attacker,false,self)
          attacker.pbIncreaseStat(PBStats::SPDEF,2,attacker,false,self,showanim)
          showanim=false
        end
        if attacker.pbCanIncreaseStatStage?(PBStats::SPEED,attacker,false,self)
          attacker.pbIncreaseStat(PBStats::SPEED,2,attacker,false,self,showanim)
          showanim=false
        end
        return 0
      end
    end

    Code:
    class PokeBattle_Move_644 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if pbIsDamaging?
          return super(attacker,opponent,hitnum,alltargets,showanimation)
        else
          @battle.pbDisplay("But it failed!")
          return -1
        end
      end
      
        def pbEffectAfterHit(attacker,opponent,turneffects)
        if isConst?(@id,PBMoves,:CALLTOARMS)
          if isConst?(attacker.species,PBSpecies,:TAENL) &&
             !attacker.effects[PBEffects::Transform] &&
             !(attacker.hasWorkingAbility(:SHEERFORCE) && self.addlEffect>0) &&
             !attacker.fainted?
            attacker.form=1
            attacker.pbUpdate(true)
            @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
            @battle.pbDisplay(_INTL("{1} called its posse!",attacker.pbThis))
            PBDebug.log("[Form changed] #{attacker.pbThis} changed to form #{attacker.form}")
          end
        end
      end
    end

    (Also, for a little extra information, I think an additional problem I was having was that in the moves.pbs, Status moves have a power of 0, which was making the Relic Song after effect fail. While trying to replace it as the main effect was causing the two turn aspect of the move to break.)

    I've tried this in a number of ways, but I figured it would be more helpful to just post the original code here (With the text changed), as mine was getting pretty messy and convoluted. Would anybody be able to help me merge these? I would be very thankful.
     
    1,682
    Posts
    8
    Years
    • Online now
    I find it easiest to just make a new code if I need to make sweeping changes. This fails if it's used by any mon but a Taenl, because it's so specific and does no damage anyway (though you can remove the first if and change the elsif into if isConst?(attacker.species,PBSpecies,:TAENL) && attacker.form==1 to fail if a taenl tries to call it when in it's new form.)

    I left in the power herb stuff that turns 2 turn moves into single turn moves, but you can remove that by removing every instance of @immediate and the block that uses it as it's only condition.
    The transforming code is basically the same as the relic song stuff, sans the id check, because relic song just uses the normal sleep dealing code (a small change, not sweeping)

    Well, I've rambled long enough, tah dah. Mind I only made sure there's no syntax errors, but it should work as intended.
    Code:
    class PokeBattle_Move_XXX < PokeBattle_Move
      def pbTwoTurnAttack(attacker)
        @immediate=false
        if !@immediate && attacker.hasWorkingItem(:POWERHERB)
          @immediate=true
        end
        return false if @immediate
        return attacker.effects[PBEffects::TwoTurnAttack]==0
      end
    
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if !isConst?(attacker.species,PBSpecies,:TAENL)
          @battle.pbDisplay("But it failed!")
          return -1
        elsif attacker.form==1
          @battle.pbDisplay(_INTL("{1}'s call has already been answered!",attacker.pbThis))
          return -1
        end
        if @immediate || attacker.effects[PBEffects::TwoTurnAttack]>0
          pbShowAnimation(@id,attacker,opponent,1,alltargets,showanimation) # Charging anim
          @battle.pbDisplay(_INTL("{1} calls for aid!",attacker.pbThis))
        end
        if @immediate
          @battle.pbCommonAnimation("UseItem",attacker,nil)
          @battle.pbDisplay(_INTL("{1} is ready due to its Power Herb!",attacker.pbThis))
          attacker.pbConsumeItem
        end
        return 0 if attacker.effects[PBEffects::TwoTurnAttack]>0
        if isConst?(attacker.species,PBSpecies,:TAENL) &&
           !attacker.effects[PBEffects::Transform] &&
           !attacker.hasWorkingAbility(:SHEERFORCE) &&
           !attacker.fainted?
          attacker.form=1
          attacker.pbUpdate(true)
          @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
          @battle.pbDisplay(_INTL("{1} called its posse!",attacker.pbThis))
          PBDebug.log("[Form changed] #{attacker.pbThis} changed to form #{attacker.form}")
        end
        return 0
      end
    end
     
    15
    Posts
    4
    Years
  • Sorry for my delayed response :) Thank you for the help! This was all so easy to understand and works perfectly. I appreciate you so much!! :)
     
    Back
    Top