• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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] Having Trouble with Custom Move

  • 19
    Posts
    5
    Years
    • Seen Jul 21, 2022
    I am hoping to create a move that is two-turned. On the first turn, it waits. On the second turn, only if the pokemon using the move is not hit, it hits with a high damage. I am very bad at coding stuff, but I attempted to combine two existing moves; Solar Beam and Focus Punch:
    ---
    class PokeBattle_Move_19C < PokeBattle_TwoTurnMove
    def pbChargingTurnMessage(user,targets)
    @battle.pbDisplay(_INTL("{1} tucked in its head!",user.pbThis))
    end

    def pbChargingTurnEffect(user,target)
    super if !user.effects[PBEffects::FocusPunch] || user.lastHPLost==0
    end

    def pbMoveFailed?(user,targets)
    if user.effects[PBEffects::FocusPunch] && user.lastHPLost>0
    @battle.pbDisplay(_INTL("{1} lost its focus and couldn't move!",user.pbThis))
    return true
    end
    return false
    end
    end
    end

    742,GLADIATOR,19C,200,FIGHTING,Physical,100,10,0,NearOther,0,abef,"Testing."
    ---
    The move is applyable in game while playtesting, and it is fighting type, but it is just doing a one turn move with no effects, sort of like tackle. If anyone knows what could be wrong with my methods (I'm sure that there are a lot of problems), any help would be greately appreciated!
     
    Last edited by a moderator:
    I am hoping to create a move that is two-turned. On the first turn, it waits. On the second turn, only if the pokemon using the move is not hit, it hits with a high damage. I am very bad at coding stuff, but I attempted to combine two existing moves; Solar Beam and Focus Punch:
    ---
    class PokeBattle_Move_19C < PokeBattle_TwoTurnMove
    def pbChargingTurnMessage(user,targets)
    @battle.pbDisplay(_INTL("{1} tucked in its head!",user.pbThis))
    end

    def pbChargingTurnEffect(user,target)
    super if !user.effects[PBEffects::FocusPunch] || user.lastHPLost==0
    end

    def pbMoveFailed?(user,targets)
    if user.effects[PBEffects::FocusPunch] && user.lastHPLost>0
    @battle.pbDisplay(_INTL("{1} lost its focus and couldn't move!",user.pbThis))
    return true
    end
    return false
    end
    end
    end

    742,GLADIATOR,19C,200,FIGHTING,Physical,100,10,0,NearOther,0,abef,"Testing."
    ---
    The move is applyable in game while playtesting, and it is fighting type, but it is just doing a one turn move with no effects, sort of like tackle. If anyone knows what could be wrong with my methods (I'm sure that there are a lot of problems), any help would be greately appreciated!

    The problem is that you're checking user.effects[PBEffects::FocusPunch] but you don't set it to true anywhere. You should set it in pbChargingTurnEffect():
    Code:
      def pbChargingTurnEffect(user,target)
        user.effects[PBEffects::FocusPunch] = true 
      end
    However, if you check around how FocusPunch is handled, you will note that this effect is inevitably set to false at the end of the turn. That's not what you want.
    You should track how FocusPunch is handled, and adapt that code for a new effect. But this time, make it a counter, set the counter to 2, and at the end of the first turn, decrement the counter by 1, and if the counter is equal to 1, then it signals to the move that it can deal damage.
    (Also, make backups if you're going to mess with the code as I suggested)
     
    Back
    Top