• 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] Having Trouble with Custom Move

  • 19
    Posts
    4
    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:

    Duck

    🦆 quack quack
  • 5,750
    Posts
    3
    Years
    • he, they
    • Seen Feb 23, 2023
    Hey there!

    This forum (Feedback & Support) is for questions regarding the PokéCommunity boards, not rom hacking or any given engine.

    For those you're probably better off asking on our Discord or on one of the Fan Games forums.
     

    StCooler

    Mayst thou thy peace discover.
  • 9,301
    Posts
    4
    Years
    • Seen May 5, 2024
    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