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

[Custom Feature Question] End-Of-Round Ability Calling a Move

  • 4
    Posts
    4
    Years
    • Seen Nov 26, 2020
    Hello there! I was wondering how to implement a new ability for Vespiquen. This new ability would cause her to use either Attack Order or Defense Order at the end of the round (picked randomly). My main gripe with implementing this, however, is that I can't simply "reuse" preexisting code, as I would ideally like the move to be called as if it was using in battle (with sounds, graphics and all). Initially I thought that I could take a look at something like Future Sight or Bad Dreams, but I can't make much out of it. I'm not really familiar with the scripts of Pokémon Essentials, as this is the first "truly" custom thing I'm making, and I only have basic knowledge of Ruby.

    Therefore, I have two questions:

    1. Is this doable?
    2. (if the reader is having a very good day and is feeling generous) How to implement it?
    Thank you very much for your time :D
     
    Well, luckily there's a method that'll set this up for you pbUseMoveSimple it takes a move id at bare minimum, and if you leave the rest of the arguments alone, should pick a random target and use the move without draining any pp.

    I'm in a code-y mood though so I'll type something up.
    Code:
    BattleHandlers::EOREffectAbility.add(:QUEENSDECREE,
      proc { |ability,battler,battle|
        moveids=[getID(PBMoves,:ATTACKORDER),getID(PBMoves,:DEFENSEORDER)]
        battle.pbShowAbilitySplash(battler)
        battler.pbUseMoveSimple(moveids[rand(2)])
        battle.pbHideAbilitySplash(battler)
      }
    )
    I make the assumption both moves are defined in your game. (I really hope I typed them correctly.)
     
    Do you know how to do something similar, but for using Counter if a physical move is used by the opponent or Mirror Coat if a special move is used by the opponent?
     
    Do you know how to do something similar, but for using Counter if a physical move is used by the opponent or Mirror Coat if a special move is used by the opponent?

    Like an ability that automatically does mirror coat/counter?
    I have to look into it, it would be a different battlehandler.
    EDIT: I didn't test it, but it's similar to cursed body when it comes to the effect, I guess.
    There's a random activation chance.
    Code:
    BattleHandlers::TargetAbilityOnHit.add(:COUNTERBODY,
      proc { |ability,user,target,move,battle|
        next if user.fainted?
        next if target.effects[PBEffects::Counter]<=0
        next if target.effects[PBEffects::CounterTarget]!=user.index # probably won't activate, but just in case
        next if battle.pbRandom(100)>=30
        battle.pbShowAbilitySplash(target)
        target.pbUseMoveSimple(getID(PBMoves,:COUNTER))
        battle.pbHideAbilitySplash(target)
      }
    )
    
    BattleHandlers::TargetAbilityOnHit.add(:MIRRORCOATBODY,
      proc { |ability,user,target,move,battle|
        next if user.fainted?
        next if target.effects[PBEffects::MirrorCoat]<=0
        next if target.effects[PBEffects::MirrorCoatTarget]!=user.index # probably won't activate, but just in case
        next if battle.pbRandom(100)>=30
        battle.pbShowAbilitySplash(target)
        target.pbUseMoveSimple(getID(PBMoves,:MIRRORCOAT))
        battle.pbHideAbilitySplash(target)
      }
    )
     
    Last edited:
    Well, luckily there's a method that'll set this up for you pbUseMoveSimple it takes a move id at bare minimum, and if you leave the rest of the arguments alone, should pick a random target and use the move without draining any pp.

    I'm in a code-y mood though so I'll type something up.
    Code:
    BattleHandlers::EOREffectAbility.add(:QUEENSDECREE,
      proc { |ability,battler,battle|
        moveids=[getID(PBMoves,:ATTACKORDER),getID(PBMoves,:DEFENDORDER)]
        battle.pbShowAbilitySplash(battler)
        battler.pbUseMoveSimple(moveids[rand(2)])
        battle.pbHideAbilitySplash(battler)
      }
    )
    I make the assumption both moves are defined in your game. (I really hope I typed them correctly.)
    It works! Just had to correct Defense Order to Defend Order.
     
    Last edited:
    I combined the Counter/Mirror Coat abilities since they were meant to be one. How does this look?

    Code:
    BattleHandlers::TargetAbilityOnHit.add(:DEFENSEMECHANISM,
      proc { |ability,user,target,move,battle|
        if move.physicalMove?
          next if user.fainted?
          next if target.effects[PBEffects::Counter]<=0
          next if target.effects[PBEffects::CounterTarget]!=user.index # probably won't activate, but just in case
          next if battle.pbRandom(100)>=30
          battle.pbShowAbilitySplash(target)
          target.pbUseMoveSimple(getID(PBMoves,:COUNTER))
          battle.pbHideAbilitySplash(target)
        elsif move.specialMove?
          next if user.fainted?
          next if target.effects[PBEffects::MirrorCoat]<=0
          next if target.effects[PBEffects::MirrorCoatTarget]!=user.index # probably won't activate, but just in case
          next if battle.pbRandom(100)>=30
          battle.pbShowAbilitySplash(target)
          target.pbUseMoveSimple(getID(PBMoves,:MIRRORCOAT))
          battle.pbHideAbilitySplash(target)
        end
      }
    )
     
    Back
    Top