Advertiser Content

Sir_Tman

Overworked game Dev

Non-binary
Australia
Seen 22 Hours Ago
Posted 2 Days Ago
201 posts
4.3 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.

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 2 Hours Ago
Posted 17 Hours Ago
912 posts
1.3 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.
Male
Seen 1 Week Ago
Posted October 20th, 2019
38 posts
341 Days
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
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:
if sendout1<0 # || sendout2<0
  raise _INTL("Player doesn't have two unfainted Pokémon")
end
In the same section, around line 393, find
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:
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.

Sir_Tman

Overworked game Dev

Non-binary
Australia
Seen 22 Hours Ago
Posted 2 Days Ago
201 posts
4.3 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.
check for this
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.
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.
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.
Advertiser Content