Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old 3 Weeks Ago (9:54 PM).
Wraymastr Wraymastr is offline
     
    Join Date: Jan 2019
    Posts: 3
    Hi guys i'm trying to make a double battle were you and an ally face off against 1 powerful Pokemon but im having trouble altering the scripts (the game doesn't allow for doubles battles if the opponent has 1 Pokemon)

    I was wondering if anyone had successfully implemented this, or perhaps had some advice?
    Reply With Quote
      #2   Link to this post, but load the entire thread.  
    Old 3 Weeks Ago (3:00 AM). Edited 3 Weeks Ago by WolfPP.
    WolfPP's Avatar
    WolfPP WolfPP is online now
    Discord: Wolf#1235
       
      Join Date: Aug 2018
      Location: Brazil
      Gender: Male
      Nature: Jolly
      Posts: 347
      Work hard to do that. I was thinkin to do SOS Battle Script. Maybe you just need to copy how every doublebattle script works and edit to a new type battle (like bossbattle).
      Reply With Quote
        #3   Link to this post, but load the entire thread.  
      Old 3 Weeks Ago (3:26 AM). Edited 3 Weeks Ago by Wraymastr.
      Wraymastr Wraymastr is offline
         
        Join Date: Jan 2019
        Posts: 3
        I actually seem to have it working, I found a script from an earlier thread (Sorry can't link it, forum rules), but it was outdated so i had to alter it a little.

        Heres what i used, that part i changed starts is highlighted in red.

        Spoiler:

        This is in the Pokebattle_battle section
        #=======================================
        # Initialize opponents in double battles
        #=======================================

        elsif @doublebattle
        if @opponent.is_a?(Array)
        if @opponent.length==1
        @opponent=@opponent[0]
        elsif @opponent.length!=2
        raise _INTL("Opponents with zero or more than two people are not allowed")
        end
        end
        if @player.is_a?(Array)
        if @player.length==1
        @player=@player[0]
        elsif @player.length!=2
        raise _INTL("Player trainers with zero or more than two people are not allowed")
        end
        end
        @scene.pbStartBattle(self)
        if @opponent.is_a?(Array)
        pbDisplayPaused(_INTL("{1} and {2} want to battle!",@opponent[0].fullname,@opponent[1].fullname))
        sendout1=pbFindNextUnfainted(@party2,0,pbSecondPartyBegin(1))
        raise _INTL("Opponent 1 has no unfainted Pokémon") if sendout1<0
        sendout2=pbFindNextUnfainted(@party2,pbSecondPartyBegin(1))
        raise _INTL("Opponent 2 has no unfainted Pokémon") if sendout2<0
        @battlers[1].pbInitialize(@party2[sendout1],sendout1,false)
        pbDisplayBrief(_INTL("{1} sent\r\nout {2}!",@opponent[0].fullname,@battlers[1].name))
        pbSendOut(1,@party2[sendout1])
        @battlers[3].pbInitialize(@party2[sendout2],sendout2,false)
        pbDisplayBrief(_INTL("{1} sent\r\nout {2}!",@opponent[1].fullname,@battlers[3].name))
        pbSendOut(3,@party2[sendout2])
        else
        pbDisplayPaused(_INTL("{1}\r\nwould like to battle!",@opponent.fullname))
        sendout1=pbFindNextUnfainted(@party2,0)
        sendout2=pbFindNextUnfainted(@party2,sendout1+1)

        if sendout1<0

        raise _INTL("Opponent doesn't have one unfainted Pokémon")

        elsif sendout2<0

        pbDisplayBrief(_INTL("{1} sent\r\nout {2}!",@opponent.fullname,@party2[sendout1].name))
        @battlers[1].pbInitialize(@party2[sendout1],sendout1,false)
        @battlers[3].pbInitBlank
        @battlers[3].fainted = true
        pbSendOut(1,@party2[sendout1])

        else

        @battlers[1].pbInitialize(@party2[sendout1],sendout1,false)
        @battlers[3].pbInitialize(@party2[sendout2],sendout2,false)
        pbDisplayBrief(_INTL("{1} sent\r\nout {2} and {3}!",
        @opponent.fullname,@battlers[1].name,@battlers[3].name))
        pbSendOut(1,@party2[sendout1])
        pbSendOut(3,@party2[sendout2])
        end
        end



        I think i changed something else somewhere too, but im tired and i can't remember. This seems to work fine, but i'll admit im not familiar with Ruby at all so if anyone has a more elegant solution i would be love to see it.
        Reply With Quote
          #4   Link to this post, but load the entire thread.  
        Old 3 Weeks Ago (5:34 AM).
        WolfPP's Avatar
        WolfPP WolfPP is online now
        Discord: Wolf#1235
           
          Join Date: Aug 2018
          Location: Brazil
          Gender: Male
          Nature: Jolly
          Posts: 347
          Hmm, i mean, you need to script a new code for this new battle scene. Like:
          Spoiler:

          Code:
          #===============================================================================
          # Start a double wild battle
          #===============================================================================
          def pbDoubleWildBattle(species1,level1,species2,level2,variable=nil,canescape=true,canlose=false)
            if (Input.press?(Input::CTRL) && $DEBUG) || $Trainer.pokemonCount==0
              if $Trainer.pokemonCount>0
                Kernel.pbMessage(_INTL("SKIPPING BATTLE..."))
              end
              pbSet(variable,1)
              $PokemonGlobal.nextBattleBGM  = nil
              $PokemonGlobal.nextBattleME   = nil
              $PokemonGlobal.nextBattleBack = nil
              return true
            end
            if species1.is_a?(String) || species1.is_a?(Symbol)
              species1 = getID(PBSpecies,species1)
            end
            if species2.is_a?(String) || species2.is_a?(Symbol)
              species2 = getID(PBSpecies,species2)
            end
            currentlevels = []
            for i in $Trainer.party
              currentlevels.push(i.level)
            end
            genwildpoke  = pbGenerateWildPokemon(species1,level1)
            genwildpoke2 = pbGenerateWildPokemon(species2,level2)
            Events.onStartBattle.trigger(nil,genwildpoke)
            scene = pbNewBattleScene
            if $PokemonGlobal.partner
              othertrainer = PokeBattle_Trainer.new($PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
              othertrainer.id    = $PokemonGlobal.partner[2]
              othertrainer.party = $PokemonGlobal.partner[3]
              combinedParty = []
              for i in 0...$Trainer.party.length
                combinedParty[i] = $Trainer.party[i]
              end
              for i in 0...othertrainer.party.length
                combinedParty[6+i] = othertrainer.party[i]
              end
              battle = PokeBattle_Battle.new(scene,combinedParty,[genwildpoke,genwildpoke2],[$Trainer,othertrainer],nil)
              battle.fullparty1 = true
            else
              battle = PokeBattle_Battle.new(scene,$Trainer.party,[genwildpoke,genwildpoke2],$Trainer,nil)
              battle.fullparty1 = false
            end
            battle.internalbattle = true
            battle.doublebattle   = battle.pbDoubleBattleAllowed?()
            battle.cantescape     = !canescape
            pbPrepareBattle(battle)
            decision = 0
            pbBattleAnimation(pbGetWildBattleBGM(species1),2,[genwildpoke,genwildpoke2]) { 
              pbSceneStandby {
                decision = battle.pbStartBattle(canlose)
              }
              pbAfterBattle(decision,canlose)
            }
            Input.update
            pbSet(variable,decision)
            return (decision!=2 && decision!=5)
          end


          It is script for double battle, in 'PField_Battles'. When you fight against a double battle in field area, the game always will call that script before fight begins.
          So, edit that script to 2v1 and search all code than have that 'pbDoubleWildBattle' inside them.
          Reply With Quote
            #5   Link to this post, but load the entire thread.  
          Old 3 Weeks Ago (6:05 AM).
          Wraymastr Wraymastr is offline
             
            Join Date: Jan 2019
            Posts: 3
            Yeh good catch. I was looking at some of the other double battle scripts but i really just needed the code for one battle against a trainer, seemed a little unfair to bully wild pokemon by forcing 2v1s. Appreciate the help though.
            Reply With Quote
              #6   Link to this post, but load the entire thread.  
            Old 3 Weeks Ago (6:40 AM).
            WolfPP's Avatar
            WolfPP WolfPP is online now
            Discord: Wolf#1235
               
              Join Date: Aug 2018
              Location: Brazil
              Gender: Male
              Nature: Jolly
              Posts: 347
              So, check how 'pbTrainerBattle' works and create a elsif to 2vs1 or copy, paste and edit to a new script.
              Good Luck.
              Reply With Quote
              Reply

              Quick Reply

              Join the conversation!

              Create an account to post a reply in this thread, participate in other discussions, and more!

              Create a PokéCommunity Account
              Ad Content
              Thread Tools

              Posting Rules
              You may not post new threads
              You may not post replies
              You may not post attachments
              You may not edit your posts

              BB code is On
              Smilies are On
              [IMG] code is On
              HTML code is Off

              Forum Jump


              All times are GMT -8. The time now is 8:33 AM.