• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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] Double Battle 1v2 (Player Punishment)

Sir_Tman

Overworked game Dev
201
Posts
8
Years
So I have a mandatory battle in my game where the player has to do a double battle with two evil grunts. Instead of turning the player around and telling them to come back when they get more than two pokemon or making the trainer fight each grunt individually a alpha tester of mine suggested making it a 1v2 fight.

So the player has to do a double battle with just one Pokemon IF they only have one pokemon with them OR they have multiple pokemon, but all but one is fainted, to still initiate the double battle.

How would I go about doing this?

NOTE: I saw a thread about this, however it was never answered.
 
153
Posts
4
Years
  • Age 36
  • Seen Feb 4, 2020
check for this
Code:
pbDoubleBattleAllowed?
in the script. It's checking the conditions for a double battle to start, you could add a line with a global switch for example saying if this switch is not on then do what it's normally done but then when it's on, ignore the fact that the trainer needs 2 pokes
 
Last edited:

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
It's not easy to make this kind of change in v17.2 or less. However I believe that in v18 will be much easier.
Also, Pokémon La Joya de Arceus, they added the script for this case. Check the game AND check if they (the team/scripter) want to share their script to you.
 
233
Posts
5
Years
  • Age 33
  • Seen Oct 9, 2023
I've done this for my game as well. You just need to edit 2 sections like so:

In PokeBattle_Battle, around line 2469, find
Code:
if sendout1<0 || sendout2<0
  raise _INTL("Player doesn't have two unfainted Pokémon")
end
and just comment or delete the last part in the if statement:
Code:
if sendout1<0 # || sendout2<0
  raise _INTL("Player doesn't have two unfainted Pokémon")
end

In the same section, around line 393, find
Code:
if _player.is_a?(Array)
  sendout1=pbFindNextUnfainted(@party1,0,pbSecondPartyBegin(0))
  sendout2=pbFindNextUnfainted(@party1,pbSecondPartyBegin(0))
  return false if sendout1<0 || sendout2<0
else
  sendout1=pbFindNextUnfainted(@party1,0)
  sendout2=pbFindNextUnfainted(@party1,sendout1+1)
  return false if sendout1<0 || sendout2<0
end
and comment out or delete two of the lines in the else statement, like so:
Code:
if _player.is_a?(Array)
  sendout1=pbFindNextUnfainted(@party1,0,pbSecondPartyBegin(0))
  sendout2=pbFindNextUnfainted(@party1,pbSecondPartyBegin(0))
  return false if sendout1<0 || sendout2<0
else
  sendout1=pbFindNextUnfainted(@party1,0)
  # sendout2=pbFindNextUnfainted(@party1,sendout1+1)
  return false if sendout1<0 # || sendout2<0
end

I think that's all you need to do, so hopefully that solves your issue.
 
Last edited:

Sir_Tman

Overworked game Dev
201
Posts
8
Years
Thank you, this was a good place to start and play around it, but yes the script needing for 2 pokemon is a bit of a problem.
Tsuina said:
check for this
Code:
pbDoubleBattleAllowed?
in the script. It's checking the conditions for a double battle to start, you could add a line with a global switch for example saying if this switch is not on then do what it's normally done but then when it's on, ignore the fact that the trainer needs 2 pokes
---

Your work around is alright, however it does have a few problems, if the player has 1 pokemon this is fine, however if the player has two pokemon and one is fainted then you send out a fainted pokemon and that causes a loop where the ai can't do anything, and the battle can't do anything, plus it is distracting and disjointing with your unconscious pokemon just on the battlefield.
NettoHikari said:
I've done this for my game as well. You just need to edit 2 sections iirc like so:
...
...
---

I downloaded Pokemon La Koya de Arceus and found they actually left all the essential flies and rpgmaker xp project file in the demo, so I had a fish around in their code and found that they have the 2v1 set up for opponents but not from players from my understanding of reading through their code.(I haven't had a chance to play the game, but I might play it later seems intresting)
However I am going to have to agree with you here, in that it seems possible in v17.2 however there are a lot of things that I would have to rewrite and reclass, and with v18 lurking somewhere with promise of better battle code, I feel that I might just be better off waiting until v18 comes out.
WolfPP said:
It's not easy to make this kind of change in v17.2 or less. However I believe that in v18 will be much easier.
Also, Pokémon La Joya de Arceus, they added the script for this case. Check the game AND check if they (the team/scripter) want to share their script to you.
---

Thank you all for your responses, however I feel I can not get my answer that I need at this time and I am much better off waiting for v18.
 
233
Posts
5
Years
  • Age 33
  • Seen Oct 9, 2023
Actually, I realize I made a mistake in my solution, so I edited my earlier post with the right code. Let me know if it causes any other problems.
 
Last edited:
Back
Top