• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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] Custom Move - Mat Block-type effect

Status
Not open for further replies.

sonicfan7895

Just a dude, I guess
  • 120
    Posts
    14
    Years
    So I've been having a problem with this particular move that I'm creating for a game with my team... and one of the new custom moves we have planned is a move a lot like Mat Block or King's Shield, but on contact it's supposed to raise the user's Special Defense by one stage, kind of like how King's Shield lowers an attacker's Attack by two stages upon contact.

    If it helps, I will provide all codes relating to this move. I will be going down the line in the Scripts. Keep in mind all of these scripts are in my current game, so the lines will differ from the vanilla Essentials 16.2.

    Firstly, in PokeBattle_ActiveSideField (lines 5-7):
    Code:
        def initialize
          @effects = []
          @effects[PBEffects::BlueEagle]          = false
    This is for the script in PokeBattle_Battler and PokeBattle_MoveEffects so those two have somewhere to point to in regards to similarity with Mat Block's code.

    Secondy, in PokeBattle_Battler (lines 2373-2382):
    Code:
      if target.pbOwnSide.effects[PBEffects::BlueEagle] && !thismove.pbIsStatus? &&
           thismove.canProtectAgainst? && !target.effects[PBEffects::ProtectNegation]
          @battle.pbDisplay(_INTL("{1} was blocked by the water wall!",thismove.name))
          @battle.successStates[user.index].protected=true
          PBDebug.log("[Move failed] #{target.pbThis}'s Blue Eagle wall stopped the attack")
          [I][COLOR="Red"]if thismove.isContactMove?
            attacker.pbIncreaseStat(PBStats::SPDEF,1,nil,false)     <---------- Important part
          end[/COLOR][/I]
          return false
        end
    This is the actual code that my effect in PokeBattle_MoveEffects (listed below) is being pointed to. My intention is for the Special Defense of the user to rise by one stage upon contact of the wall.

    Lastly, in PokeBattle_MoveEffects (lines 9709-9720):
    Code:
    class PokeBattle_Move_163 < PokeBattle_Move
      def pbMoveFailed(attacker,opponent)
        return (attacker.turncount>1)
      end
    
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        attacker.pbOwnSide.effects[PBEffects::BlueEagle]=true
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        @battle.pbDisplay(_INTL("{1} intends to raise a wall and block incoming attacks!",attacker.pbThis))
        return 0
      end
    end
    This is the actual effect that Blue Eagle (the move name) is using.

    If you could give me any pointers on what to do, that would be fantastic.

    Thank you very much for any help you can provide!
     
    Last edited:
    So I've been having a problem with this particular move that I'm creating for a game with my team... and one of the new custom moves we have planned is a move a lot like Mat Block or King's Shield, but on contact it's supposed to raise the user's Special Defense by one stage, kind of like how King's Shield lowers an attacker's Attack by two stages upon contact.

    If it helps, I will provide all codes relating to this move. I will be going down the line in the Scripts. Keep in mind all of these scripts are in my current game, so the lines will differ from the vanilla Essentials 16.2.

    Firstly, in PokeBattle_ActiveSideField (lines 5-7):
    Code:
        def initialize
          @effects = []
          @effects[PBEffects::BlueEagle]          = false
    This is for the script in PokeBattle_Battler and PokeBattle_MoveEffects so those two have somewhere to point to in regards to similarity with Mat Block's code.

    Secondy, in PokeBattle_Battler (lines 2373-2382):
    Code:
      if target.pbOwnSide.effects[PBEffects::BlueEagle] && !thismove.pbIsStatus? &&
           thismove.canProtectAgainst? && !target.effects[PBEffects::ProtectNegation]
          @battle.pbDisplay(_INTL("{1} was blocked by the water wall!",thismove.name))
          @battle.successStates[user.index].protected=true
          PBDebug.log("[Move failed] #{target.pbThis}'s Blue Eagle wall stopped the attack")
          [I][COLOR="Red"]if thismove.isContactMove?
            attacker.pbIncreaseStat(PBStats::SPDEF,1,nil,false)     <---------- Important part
          end[/COLOR][/I]
          return false
        end
    This is the actual code that my effect in PokeBattle_MoveEffects (listed below) is being pointed to. My intention is for the Special Defense of the user to rise by one stage upon contact of the wall.

    Lastly, in PokeBattle_MoveEffects (lines 9709-9720):
    Code:
    class PokeBattle_Move_163 < PokeBattle_Move
      def pbMoveFailed(attacker,opponent)
        return (attacker.turncount>1)
      end
    
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        attacker.pbOwnSide.effects[PBEffects::BlueEagle]=true
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        @battle.pbDisplay(_INTL("{1} intends to raise a wall and block incoming attacks!",attacker.pbThis))
        return 0
      end
    end
    This is the actual effect that Blue Eagle (the move name) is using.

    If you could give me any pointers on what to do, that would be fantastic.

    Thank you very much for any help you can provide!

    Remove this part:

    Code:
      def pbMoveFailed(attacker,opponent)
        return (attacker.turncount>1)
      end

    Because if there are these lines, the move will works like Fake Out
     
    Remove this part:

    Code:
      def pbMoveFailed(attacker,opponent)
        return (attacker.turncount>1)
      end

    Because if there are these lines, the move will works like Fake Out

    Firstly, I just used the code for Mat Block as a base, so that's how it looks.

    Secondly, I need help with the important part, which if you read the OP, is highlighted in red.

    Thirdly, I got the code to work, but now I have an even bigger problem... unlike Mat Block, the effect stays active perpetually and does not go away at the next turn. How can I go about this?
     
    Into PokeBattle_Battle script section, in def pbEndOfRoundPhase, after the line:

    Code:
    @battlers[i].effects[PBEffects::SpikyShield]=false

    Add this:

    Code:
    @battlers[i].pbOwnSide.effects[PBEffects::BlueEagle]=false
     
    Into PokeBattle_Battle script section, in def pbEndOfRoundPhase, after the line:

    Code:
    @battlers[i].effects[PBEffects::SpikyShield]=false

    Add this:

    Code:
    @battlers[i].pbOwnSide.effects[PBEffects::BlueEagle]=false

    As far as I know this did absolutely nothing. I did it exactly as you said and it didn't do anything. :/
     
    Never mind. I got it! Basically, I had to make it like King's Shield and change the actual move effect so that it was like King's Shield, not like Mat Block. Apparently the code for Mat Block is buggy anyway, as the actual effect is perpetual, meaning that it's always active.

    Mods, can you close down this thread?
     
    Status
    Not open for further replies.
    Back
    Top