• 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!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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] [HELP] Ally Switch's script

WolfPP

Spriter/ Pixel Artist
  • 1,297
    Posts
    6
    Years
    Has anyone managed to fix / update the script for the Ally Switch move?
    After the move animation, the sprites between the user and its ally don't update/ exchange between themselves.
    Here the code:
    Code:
    ################################################################################
    # User switches places with its ally. (Ally Switch)
    ################################################################################
    class PokeBattle_Move_120 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if [email protected] ||
           !attacker.pbPartner || attacker.pbPartner.fainted?
          @battle.pbDisplay(_INTL("But it failed!"))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        [email protected][attacker.index]
        [email protected][attacker.pbPartner.index]
        temp=a; a=b; b=temp
        # Swap effects that point at the position rather than the Pokémon
        # NOT PerishSongUser (no need to swap), Attract, MultiTurnUser
        effectstoswap=[PBEffects::BideTarget,
                       PBEffects::CounterTarget,
                       PBEffects::LeechSeed,
                       PBEffects::LockOnPos,
                       PBEffects::MeanLook,
                       PBEffects::MirrorCoatTarget]
        for i in effectstoswap
          a.effects[i],b.effects[i]=b.effects[i],a.effects[i]
        end
        a.pbUpdate(true)
        b.pbUpdate(true)
        @battle.pbDisplay(_INTL("{1} and {2} switched places!",attacker.pbThis,attacker.pbPartner.pbThis(true)))
      end
    end

    Also, what Reborn did (and is not correct, IMO):
    Code:
    ################################################################################
    # User switches places with its ally.
    ################################################################################
    #### KUROTSUNE - 002 - START
    class PokeBattle_Move_120 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if [email protected]?(attacker.index)
          @battle.pbDisplay(_INTL("But it failed!"))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        @battle.pbDisplay(_INTL("{1} went back to {2}!",attacker.pbThis,@battle.pbGetOwner(attacker.index).name))
        newpoke=0
        [email protected](attacker.index,true,false)
        @battle.pbMessagesOnReplace(attacker.index,newpoke)
        attacker.pbResetForm
        @battle.pbReplace(attacker.index,newpoke,true)
        @battle.pbOnActiveOne(attacker)
        attacker.pbAbilitiesOnSwitchIn(true)
        return 0
      end
    end
    #### KUROTSUNE - 002 - START

    But maybe we need to create a new script like 'pbSwitchInBetween' for that case? Because we need to refresh the battler sprites and the battler box (name and HP) after move animation.

    How can we do that?

    Thank you!
     
    Back
    Top