• 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!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Need help updating Destiny Bond

  • 68
    Posts
    5
    Years
    • Seen Nov 9, 2023
    Does anyone know how to make it so Destiny Bond will fail when it's used twice in a row (like in Gen 7)?
    I've tried scripting it myself, but I ran into an issue where once it failed, it would fail for the rest of the battle.
    If anyone could help me, that would be great.

    By the way, here's my failed attempt at scripting it.

    Code:
    class PokeBattle_Move_0E7 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if id==attacker.lastMoveUsed && id=186
          @battle.pbDisplay(_INTL("But it failed!"))
          return -1
        end  
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        attacker.effects[PBEffects::DestinyBond]=true
        @battle.pbDisplay(_INTL("{1} is trying to take its foe down with it!",attacker.pbThis))
        return 0 
      end  
    end
     
    id=186 you're setting id to 186, shouldn't you compare it? … not that I think that should make a difference, since PokeBattle_Move_0E7 probably only runs when id==186 anyway (assuming 186 is Destiny Bond's ID).
     
    Yeah, Destiny Bond's ID is 186, but I wanna know how I can make it so the move will fail if it was used successfully in the previous turn.
     
    That won't really help, since Protect moves have a decreased chance of success each turn, while Destiny Bond should always fail if used twice in a row.
     
    In theory it could help. You'd just have to make it decrease the chance by 100% instead of by 50%.
     
    I think what I made is good:

    Into 'PokeBattle_Battler' script, inside 'def pbBeginTurn(choice)', remove:
    Code:
    @effects[PBEffects::DestinyBond]=false

    Then, inside 'PokeBattle_MoveEffects', replace Destiny Bond's code for:
    Code:
    ################################################################################
    # If user is KO'd before it next moves, the battler that caused it also faints.
    # (Destiny Bond)
    ################################################################################
    class PokeBattle_Move_0E7 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.effects[PBEffects::DestinyBond]==true
          @battle.pbDisplay(_INTL("But it failed!"))
          return -1
        else
          pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
          attacker.effects[PBEffects::DestinyBond]=true
          @battle.pbDisplay(_INTL("{1} is trying to take its foe down with it!",attacker.pbThis))
          return 0
        end
      end

    And I think is done. But need make a upgrade about double battle: if first pokémon uses and then the second one too, will fail. Need to fix that variation.
     
    Last edited:
    Unfortunately, it still fails for the rest of the battle. Thanks for helping though, and I would appreciate it if you could try again. I'm kind of new to this scripting thing.
     
    Am using v17.2 and works fine to me (double battle included). Check all the steps again. Delete your save file, compile your game while start in debug mode (holding CTRL) and start a new game.

    EDIT: TBH IDK how its work lol. If I use and won't die, and try to use again, will fail, right? But if into next turn I die, then the opponent dies too, because I use Destiny Bond previously, right? Or only if I die into the same turn than I use?
    Give me right variations/probabilities for that move, please.
     
    Last edited:
    It's ok, i found a way to fix it. What I did was take your script and add [PBEffects::DestinyBond]=false under the "But it failed!" message. Here's what it looks like, in case anyone wants to use it.

    Code:
    class PokeBattle_Move_0E7 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.effects[PBEffects::DestinyBond]==true
          @battle.pbDisplay(_INTL("But it failed!"))
          attacker.effects[PBEffects::DestinyBond]=false
          return -1
        else
          pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
          attacker.effects[PBEffects::DestinyBond]=true
          @battle.pbDisplay(_INTL("{1} is trying to take its foe down with it!",attacker.pbThis))
          return 0
        end
      end
    end
     
    Back
    Top