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

Help Making Attack with changing Effects

148
Posts
11
Years
  • Alright, so this turned out to be a bit over my head. Wanted to make a move based on the Infinity Gauntlet from Marvel Comics. Basically the effect of the move varies depending on which held item you have. I looked at Techno Blast/Judgment, but it was little help and are the only moves I could think of that make changes based on held item. I'm just not sure how to write it since the effects very from raising your own stat, to lowering your opponents, to switching out. These are all the function codes of the effects I'd like to use. I just have no idea on how to put them into one, if that makes sense. So if anyone could point me in the right direction to finishing this I would be very grateful.

    Is it possible for an Item to just change which function code a move uses?


    The move itself:
    Code:
    625,KINGSGAUNTLET,King's Gauntlet,139,90,DARK,Physical,100,5,0,00,0,abef,Cool,The moves effects depend on the pokemon's held item.

    All the items and the effects they cause.

    Time Gem = Lower opponents Speed
    Spoiler:


    Space Gem = You switch out after attack.
    Spoiler:


    Soul Gem = Absorb 50% of damage delt.
    Spoiler:


    Reality Gem = "spdef = defense": Reverse of Psyshock. Physical attack use Special defense. Not sure how this one would work. Threw this in because it's all i figured out.
    Spoiler:


    Power Gem = lowers opponents attack
    Spoiler:


    Mind Gem = raise your special defense.
    Spoiler:
     
    Last edited:
    19
    Posts
    9
    Years
    • Seen Aug 23, 2015
    Couldn't you make it so each time one of the items is equipped it would change the Pokemon's form and give them an ability that would change the effects of the one move?
     
    148
    Posts
    11
    Years
  • That's what I decided to do. I couldn't get it so the abilities added bonus effects to the attack I wanted, so I made it a little different. Instead of the attack itself lowering the opponents stats or raising mine I just made the new abilities raise or lower stats whenever the pokemon got hit. So far everything works fine. I just have no Idea how to make abilities that would add absorbing damage, retreating after doing damage, and Using Special defense to calculate Physical damage. Hope someone ends up helping me with it :/

    Opponent's Attack goes down whenever you are hit
    Code:
    def pbAbilityEffect(move,user,target,damage,finalhit=false)
      if (move.flags&0x02)!=0 && damage>0 # flag B: Every Attack
        if isConst?(target.ability,PBAbilities,:POWERGEMABILITY) && 
          user.pbCanReduceStatStage?(PBStats::ATTACK)
            user.pbReduceStat(PBStats::ATTACK,1,true)
            pbDisplay(_INTL("{1}'s {2} lowered {3}'s Attack!",target.pbThis,
            PBAbilities.getName(target.ability),user.pbThis(true)))
          end

    Opponent's Speed goes down whenever you are hit. Right under "POWERGEMABILITY".
    Code:
                  #Time Gem Effect
        if isConst?(target.ability,PBAbilities,:TIMEGEM) && 
          user.pbCanReduceStatStage?(PBStats::SPEED)
            user.pbReduceStat(PBStats::SPEED,1,true)
            pbDisplay(_INTL("{1}'s {2} lowered {3}'s Speed!",target.pbThis,
            PBAbilities.getName(target.ability),user.pbThis(true)))
          end
        end 
      end

    Raise your Special Defense whenever you get hit.
    Code:
     if isConst?(opponent.ability,PBAbilities,:MINDGEM) && pbIsPhysical?(movetype)
              if opponent.pbCanIncreaseStatStage?(PBStats::SPDEF)
                opponent.pbIncreaseStatBasic(PBStats::DEFENSE,1)
                @battle.pbCommonAnimation("StatUp",opponent,nil)
                @battle.pbDisplay(_INTL("{1}'s {2} raised its Special Defense!",
                   opponent.pbThis,PBAbilities.getName(opponent.ability)))
                 end
                  end
             if isConst?(opponent.ability,PBAbilities,:MINDGEM) && pbIsSpecial?(movetype)
              if opponent.pbCanIncreaseStatStage?(PBStats::SPDEF)
                opponent.pbIncreaseStatBasic(PBStats::SPDEF,1)
                @battle.pbCommonAnimation("StatUp",opponent,nil)
                @battle.pbDisplay(_INTL("{1}'s {2} raised its Special Defense!",
                   opponent.pbThis,PBAbilities.getName(opponent.ability)))
                 end
                   end
     
    1,224
    Posts
    10
    Years
  • You could do your original thing. Just make the move effect dependent on what item you're holding with
    Code:
    if isConst?(attacker.item,PBItems,:TIMEGEM)
    #do things
    elsif isConst?(attacker.item,PBItems,:MINDGEM)
    #etc
    end
     
    148
    Posts
    11
    Years
  • You could do your original thing. Just make the move effect dependent on what item you're holding with
    Code:
    if isConst?(attacker.item,PBItems,:TIMEGEM)
    #do things
    elsif isConst?(attacker.item,PBItems,:MINDGEM)
    #etc
    end

    That's what I wanted to do first, but had no idea how it would it be set up.

    If the first item would lower the foe's speed, where in the function would

    "if isConst?(attacker.item,PBItems,:TIMEGEM)" go? Anything like this?

    Code:
    ################################################################################
    # Effect depends on the user's held item.
    ################################################################################
    class PokeBattle_Move_141 < PokeBattle_Move # Decreases the target's Speed by 1 stage.
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if isConst?(@id,PBMoves,:KINGSGAUNTLET) && isConst?(attacker.item,PBItems,:TIMEGEM)
        return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
        return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,true)
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        ret=opponent.pbReduceStat(PBStats::SPEED,1,false)
        return ret ? 0 : -1
      end
    
      def pbAdditionalEffect(attacker,opponent)
        if opponent.pbCanReduceStatStage?(PBStats::SPEED,false)
          opponent.pbReduceStat(PBStats::SPEED,1,false)
        end
        return true
       end
      end
    end

    And then just put the next ones under that? And so on?
     
    1,224
    Posts
    10
    Years
  • That's what I wanted to do first, but had no idea how it would it be set up.

    If the first item would lower the foe's speed, where in the function would

    "if isConst?(attacker.item,PBItems,:TIMEGEM)" go? Anything like this?

    Code:
    ################################################################################
    # Effect depends on the user's held item.
    ################################################################################
    class PokeBattle_Move_141 < PokeBattle_Move # Decreases the target's Speed by 1 stage.
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if isConst?(@id,PBMoves,:KINGSGAUNTLET) && isConst?(attacker.item,PBItems,:TIMEGEM)
        return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
        return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,true)
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        ret=opponent.pbReduceStat(PBStats::SPEED,1,false)
        return ret ? 0 : -1
      end
    
      def pbAdditionalEffect(attacker,opponent)
        if opponent.pbCanReduceStatStage?(PBStats::SPEED,false)
          opponent.pbReduceStat(PBStats::SPEED,1,false)
        end
        return true
       end
      end
    end

    And then just put the next ones under that? And so on?


    Code:
    class PokeBattle_Move_XXX < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
       if isConst?(attacker.item,PBItems,:TIMEGEM)
        return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
        return -1 if !opponent.pbCanReduceStatStage?(PBStats::SPEED,true)
        pbShowAnimation(@id,opponent,nil,hitnum,alltargets,showanimation)
        ret=opponent.pbReduceStat(PBStats::SPEED,1,false)
        return ret ? 0 : -1
      elsif  isConst?(attacker.item,PBItems,:MINDGEM)
         return super(attacker,attacker,hitnum,alltargets,showanimation) if @basedamage>0
        return -1 if !attacker.pbCanIncreaseStatStage?(PBStats::SPDEF,true)
        pbShowAnimation(@id,opponent,nil,hitnum,alltargets,showanimation)
        ret=attacker.pbIncreaseStat(PBStats::SPDEF,1,false)
      return ret ? 0 : -1
      elsif isConst?(attacker.item,PBItems,:SPACEGEM)
        ret=super(attacker,opponent,hitnum,alltargets,showanimation)
        if attacker.hp>0 && @battle.pbCanChooseNonActive?(attacker.index) &&
           [email protected]?(@battle.pbParty(opponent.index))
          # TODO: Pursuit should go here, and negate this effect if it KO's attacker
          @battle.pbDisplay(_INTL("{1} went back to    {2}!",attacker.pbThis,@battle.pbGetOwner(attacker.index).name))
          newpoke=0
          [email protected](attacker.index,true,false)
          @battle.pbMessagesOnReplace(attacker.index,newpoke)
          attacker.pbResetForm
          @battle.pbReplace(attacker.index,newpoke,true)
          @battle.pbOnActiveOne(attacker)
          attacker.pbAbilitiesOnSwitchIn(true)
        end
      return ret
     elsif isConst?(attacker.item,PBItems,:SOULGEM)
        ret=super(attacker,opponent,hitnum,alltargets,showanimation)
        if opponent.damagestate.calcdamage>0
          hpgain=((opponent.damagestate.hplost+1)/2).floor
          if isConst?(opponent.ability,PBAbilities,:LIQUIDOOZE)
            attacker.pbReduceHP(hpgain,true)
            @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
          elsif attacker.effects[PBEffects::HealBlock]==0
            hpgain=(hpgain*1.3).floor if isConst?(attacker.item,PBItems,:BIGROOT)
            attacker.pbRecoverHP(hpgain,true)
            @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
          end
        end
        return ret
     elsif isConst?(attacker.item,PBItems,:POWERGEM)
    return super(attacker,opponent,hitnum,alltargets,showanimation) if @basedamage>0
        return -1 if !opponent.pbCanReduceStatStage?(PBStats::ATTACK,true)
        pbShowAnimation(@id,opponent,nil,hitnum,alltargets,showanimation)
        ret=opponent.pbReduceStat(PBStats::ATTACK,1,false)
        return ret ? 0 : -1
      end
      end
    
    end

    We don't need an additional effect because you're guaranteeing these will happen with your move.
    For the Reality gem, just find this
    Code:
     if type>=0 && pbIsSpecial?(type)
          atk=spatk
          defense=spdef if @function!=0x122 # Psyshock
        end

    change to this
    Code:
     if type>=0 && pbIsSpecial?(type)
          atk=spatk
          defense=spdef if @function!=0x122 # Psyshock
          spdef=defense if @function==0xXXX && isConst?(attacker.item,PBItems,:REALITYGEM)  #where XXX is the function code you gave it
        end
     
    Last edited:
    Back
    Top