• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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.

[Custom Feature Question] Limiting the Player's party size based on number of Gym Badges

15
Posts
7
Years
  • Age 24
  • Seen Aug 29, 2020
Hello all!

I'm quietly working on my own fan game and one of the mechanics I'd love to implement would be to limit the Player's party size limit based on how many gym badges they have - it would look something like this:
0 badges - 2 Pokémon
1 badge - 3 Pokémon
2 badges - 4 Pokémon
3 badges - 5 Pokémon
4 badges - 6 Pokémon
(since I'm working alone on this game, I'll have a limit of 5 badges, but I'm sure the exact logistics might change a little for difficulty scaling)

Now, I'll be honest: I have no idea how I could do that.
On one hand, I could create a parallel even on every map doing this, which would be an absolute pain and might not even work properly.
OR
I create a script which does this (like for the following Pokémon script) - and this is where I really don't know what to do.

Any help would be highly appreciated, from suggestions to even saying what parts I should edit/point me to where I could find the information I need.
Thank you all :P

==========SOLVED==========
Solution is at reply n20!
 
Last edited:
295
Posts
5
Years
  • Age 28
  • Seen Aug 15, 2022
Hello all!

I'm quietly working on my own fan game and one of the mechanics I'd love to implement would be to limit the Player's party size limit based on how many gym badges they have - it would look something like this:
0 badges - 2 Pokémon
1 badge - 3 Pokémon
2 badges - 4 Pokémon
3 badges - 5 Pokémon
4 badges - 6 Pokémon
(since I'm working alone on this game, I'll have a limit of 5 badges, but I'm sure the exact logistics might change a little for difficulty scaling)

Now, I'll be honest: I have no idea how I could do that.
On one hand, I could create a parallel even on every map doing this, which would be an absolute pain and might not even work properly.
OR
I create a script which does this (like for the following Pokémon script) - and this is where I really don't know what to do.

Any help would be highly appreciated, from suggestions to even saying what parts I should edit/point me to where I could find the information I need.
Thank you all :P

You can use this method.
First, you find
Code:
MAXPARTYSIZE = 6
, it's in class PokeBattle_Battle
Second, you replace MAXPARTYSIZE = 6 into something like this
Code:
case $Trainer.numbadges
  when 0: MAXPARTYSIZE = 1
  when 1: MAXPARTYSIZE = 2
  when 8: MAXPARTYSIZE = 6
end
or
Code:
if $Trainer.numbadges >= 0 && $Trainer.numbadges < 2
  MAXPARTYSIZE = 3
elsif $Trainer.numbadges >= 2 && $Trainer.numbadges < 5
  MAXPARTYSIZE = 4
else
  MAXPARTYSIZE = 6
end

Have fun!
 
15
Posts
7
Years
  • Age 24
  • Seen Aug 29, 2020
You can use this method.
First, you find
Code:
MAXPARTYSIZE = 6
, it's in class PokeBattle_Battle
Second, you replace MAXPARTYSIZE = 6 into something like this
Code:
case $Trainer.numbadges
  when 0: MAXPARTYSIZE = 1
  when 1: MAXPARTYSIZE = 2
  when 8: MAXPARTYSIZE = 6
end
or
Code:
if $Trainer.numbadges >= 0 && $Trainer.numbadges < 2
  MAXPARTYSIZE = 3
elsif $Trainer.numbadges >= 2 && $Trainer.numbadges < 5
  MAXPARTYSIZE = 4
else
  MAXPARTYSIZE = 6
end

Have fun!

Hiya,
Thank you so much for responding - I've tried the two codes but got this error in both cases when I playtest the game:

Script 'PokeBattle_Battle' line 223: NoMethodError occurred.
undefined method 'numbadges' for nil:NilClass

Hopefully this is just a small mistype or easy fix, because I don't know what this error even means :o
 
1,405
Posts
9
Years
  • Seen Mar 1, 2024
Problem is that $Trainer doesn't exist until the game has started (i.e. you choose "New Game" or "Continue"), but MAXPARTYSIZE is defined as Essentials starts.

I think you will need to do something a bit more like:

Code:
[color=red]-MAXPARTYSIZE = 6[/color]
[color=green]+def maxPartySize
+  case $Trainer.numbadges
+  when 0: return 1
+  when 1: return 2
+  when 2: return 3
+  when 3: return 4
+  when 4: return 5
+  when 5: return 6
+  end
+end[/color]

Then you can replace all the MAXPARTYSIZE in PokeBattle_Battle with maxPartySize.

TBH I'm confused that I can't see any of the Box code (i.e. deposit/withdraw/move) checking for MAXPARTYSIZE which makes me think there is another variable you will need to change too.

EDIT: I searched for "6" in Pokemon_Storage, and I expect you'll need to change at least these lines:

Code:
    return (box<0) ? 6 : self[box].length

      return false if self.party.nitems>=6

    return false if self.party.nitems>=6
 
Last edited:
295
Posts
5
Years
  • Age 28
  • Seen Aug 15, 2022
Hiya,
Thank you so much for responding - I've tried the two codes but got this error in both cases when I playtest the game:

Script 'PokeBattle_Battle' line 223: NoMethodError occurred.
undefined method 'numbadges' for nil:NilClass

Hopefully this is just a small mistype or easy fix, because I don't know what this error even means :o

Sorry! I haven't test this method. So, you can test mgriffin's method, I see it's better.
 
15
Posts
7
Years
  • Age 24
  • Seen Aug 29, 2020
EDIT: I searched for "6" in Pokemon_Storage, and I expect you'll need to change at least these lines:

Code:
    return (box<0) ? 6 : self[box].length

      return false if self.party.nitems>=6

    return false if self.party.nitems>=6

Hiya, I tried to do this (by adding underneath those lines of code the code you gave before), and there are a couple things I've found:

- The player can still add more Pokémon to their party from the PC than would be allowed.
- A player can have a full team (ex: 1 badge - 2 Pokémon), and when catches a new wild Pokémon, it isn't automatically transferred to the PC.
- When a player has one too many Pokémon in their party (see previous point), when a battle starts, the game stops running and this pops up.


---------------------------
Pokemon Essentials
---------------------------
[Pokémon Essentials version 17]

Exception: ArgumentError

Message: Party 1 has more than 2 Pokémon.

PokeBattle_Battle:2360:in `pbStartBattleCore'

PokeBattle_Battle:2350:in `pbStartBattle'

PField_Battles:98:in `pbWildBattle'

PField_Battles:97:in `pbSceneStandby'

PField_Battles:99:in `pbWildBattle'

PField_Battles:96:in `pbBattleAnimation'

PField_Battles:96:in `pbWildBattle'

PField_Field:387:in `pbBattleOnStepTaken'

PField_Field:368:in `pbOnStepTaken'

Game_Player:461:in `update_old'


so yeah, not entirely sure what this is. I'll do a bit of scratching around, but if you can help (again) that would be fantastic :)
 
Last edited:
1,405
Posts
9
Years
  • Seen Mar 1, 2024
- The player can still add more Pokémon to their party from the PC than would be allowed.
- A player can have a full team (ex: 1 badge - 2 Pokémon), and when catches a new wild Pokémon, it isn't automatically transferred to the PC.
These two I expect are related to those "6"s I found in Pokemon_Storage, what did you change for those ones? Perhaps there are others that need to change in that code (or maybe somewhere else).

- When a player has one too many Pokémon in their party (see previous point), when a battle starts, the game stops running and this pops up.

Spoiler:
Oh! This is interesting, Essentials checks that all players' parties have fewer than maxPartySize. I suspect that this means you'll want to have maxPartySize always return 6 (or completely go back to MAXPARTYSIZE) so that you're able to give the AI trainers more Pokémon than the player is allowed. Limiting the party size via the PC/captures should be enough.
 
15
Posts
7
Years
  • Age 24
  • Seen Aug 29, 2020
Oh! This is interesting, Essentials checks that all players' parties have fewer than maxPartySize. I suspect that this means you'll want to have maxPartySize always return 6 (or completely go back to MAXPARTYSIZE) so that you're able to give the AI trainers more Pokémon than the player is allowed. Limiting the party size via the PC/captures should be enough.

Alright.. not entirely sure what to do with this information, I must admit.
So far, this is what I did, as an example (I did the exact same thing for the other two lines you recommended I edit):

def pbMoveCaughtToParty(pkmn)
return false if self.party.nitems>=6
def maxPartySize
case $Trainer.numbadges
when 0: return 1
when 1: return 2
when 2: return 3
when 3: return 4
when 4: return 5
when 5: return 6
end
end


I've also found this line which could solve one of the issues, in PScreen_PC:
if command==1 # Withdraw
if $PokemonStorage.party.length>=6
Kernel.pbMessage(_INTL("Your party is full!"))
next
end

So yeah, not really sure what to do now..
 
1,405
Posts
9
Years
  • Seen Mar 1, 2024
Alright.. not entirely sure what to do with this information, I must admit.
So far, this is what I did, as an example (I did the exact same thing for the other two lines you recommended I edit):

def pbMoveCaughtToParty(pkmn)
return false if self.party.nitems>=6
def maxPartySize
case $Trainer.numbadges
when 0: return 1
when 1: return 2
when 2: return 3
when 3: return 4
when 4: return 5
when 5: return 6
end
end


I've also found this line which could solve one of the issues, in PScreen_PC:
if command==1 # Withdraw
if $PokemonStorage.party.length>=6
Kernel.pbMessage(_INTL("Your party is full!"))
next
end

So yeah, not really sure what to do now..

Right, okay. So for that first case I was expecting something a bit more like this:

Code:
def pbMoveCaughtToParty(pkmn)
  return false if self.party.nitems>=maxPartySize
end

def maxPartySize
  case $Trainer.numbadges
  when 0: return 1
  when 1: return 2
  when 2: return 3
  when 3: return 4
  when 4: return 5
  when 5: return 6
  end
end

And then in PScreen_PC you'll need to reference the maxPartySize, possibly like this (I'm not sure if you'll be allowed to say $PokemonStorage.maxPartySize, it's unclear where the def I suggested above will put the function without me reading through the Essentials codebase):

Code:
if command==1 # Withdraw
  if $PokemonStorage.party.length>=$PokemonStorage.maxPartySize
    Kernel.pbMessage(_INTL("Your party is full!"))
    next
  end
 
Last edited:
15
Posts
7
Years
  • Age 24
  • Seen Aug 29, 2020
And then in PScreen_PC you'll need to reference the maxPartySize, possibly like this (I'm not sure if you'll be allowed to say $PokemonStorage.maxPartySize, it's unclear where the def I suggested above will put the function without me reading through the Essentials codebase):

Code:
if command==1 # Withdraw
  if $PokemonStorage.party.length>=$PokemonStorage.maxPartySize
    Kernel.pbMessage(_INTL("Your party is full!"))
    next
  end

That bit there was great as now I can no longer use the Withdraw option when accessing the PC if the party is full (however I can still add more Pokémon to the party through the Move Pokémon option).

I was wondering though, wouldn't it be possible to have a separate program/script that can put the excess Pokémon into the PC automatically if you don't have enough gym badges, without messing around with the MAXPARTYSIZE stuff? creating something along the lines of (and take this with a grain of salt considering I can't code for crap:

if player has 0 badges
send Pokémon 6 - 5 - 4 - 3 to PC
say "you have too many Pokémon in your party! Sending the excess amount to your PC"
end

(Pokémon 6 through 3 being the excess amount of Pokémon because the trainer has 0 badges)

I don't know, but this seems to be simpler (if possible)m and would allow NPCs to have more Pokémon on them than the player can at the time, as well as not have the argument errors when battling a wild Pokémon with too many Pokémon in the party

Once again, thank you soooooo much for your help. This would be 500% impossible without you!
 
1,405
Posts
9
Years
  • Seen Mar 1, 2024
I was wondering though, wouldn't it be possible to have a separate program/script that can put the excess Pokémon into the PC automatically if you don't have enough gym badges, without messing around with the MAXPARTYSIZE stuff? creating something along the lines of (and take this with a grain of salt considering I can't code for crap:

if player has 0 badges
send Pokémon 6 - 5 - 4 - 3 to PC
say "you have too many Pokémon in your party! Sending the excess amount to your PC"
end

(Pokémon 6 through 3 being the excess amount of Pokémon because the trainer has 0 badges)

I don't know, but this seems to be simpler (if possible)m and would allow NPCs to have more Pokémon on them than the player can at the time, as well as not have the argument errors when battling a wild Pokémon with too many Pokémon in the party

I like the way you think! My guess is that the changes to pbMoveCaughtToParty will make this work the way you suggest even if you put the MAXPARTYSIZE stuff in PokeBattle_Battle back to how it was before you made any changes.

Well, sort-of, it should make it so that Pokémon that would be added to your party are instead sent to the PC if you don't have enough space taking into account the $PokemonStorage.maxPartySize.

Btw, I noticed that the last line of pbMoveCaughtToParty disappeared somewhere along the way. Just to be clear, I would expect it to look something like this:

Code:
def pbMoveCaughtToParty(pkmn)
  return false if self.party.nitems>=maxPartySize
  self.party[self.party.length] = pkmn
end

That bit there was great as now I can no longer use the Withdraw option when accessing the PC if the party is full (however I can still add more Pokémon to the party through the Move Pokémon option).

As for the move option, try and find where the code that runs when you put a Pokémon into the party is, and see if you can find a 6 that can be replaced with maxPartySize.
 
15
Posts
7
Years
  • Age 24
  • Seen Aug 29, 2020
Oki-doki
I did a bit of messing around, and I've created this code using bits and pieces I've found online

Code:
def pbMoveCaughtToParty
  if $Trainer.numbadges<=1
   then $PokemonStorage.maxPartySize=2
   $PokemonStorage.pbStoreCaught($Trainer.party[3])
   $Trainer.party[3]=nil
   $Trainer.party.compact!
 end
end

Now this does absolutely nothing right now: I can have 0 or 1 badges and 3 Pokémon on my team and nothing happens (not even a game crash)..
So yeah, if you know what is wrong here, that would be awesome.
Note that this is in a fresh new script - it's not part of PScreen_PC or PokeBattle_Battle or anything like that.
In fact it's called "Team_Limit"
 
Last edited:
1,405
Posts
9
Years
  • Seen Mar 1, 2024
Note that this is in a fresh new script - it's not part of PScreen_PC or PokeBattle_Battle or anything like that.
In fact it's called "Team_Limit"
Right-o. So if you want to put your script into a different section then you'll have to make sure that it overrides the original behavior. That means doing something a bit like this:

Code:
class PokemonStorage
  alias original_pbMoveCaughtToParty pbMoveCaughtToParty
  def pbMoveCaughtToParty(pkmn)
    # your code goes here. it can call original_pbMoveCaughtToParty(pkmn) to do whatever the normal logic is.
  end
end

And then I think you'll be able to see the game crash.

Just to check that we're on the same page here, the logic you're trying to write is "if the party is at its limit then put the Pokémon in the PC rather than in the party?"

I had a scan through the code for capturing Pokémon in-battle, and it turns out that pbMoveCaughtToParty doesn't seem to be necessary—it's only called from pbWithdraw (but after the party size check), and from the debug menu. It looks like the code you want to change for modifying how capturing wild Pokémon works is in PokeBattle_BattlePeer, specifically the second pbStorePokemon (in PokeBattle_RealBattlePeer).

I could definitely be wrong, but that's what my reading of the code suggests. I think it should be relatively clear how to take the ideas from the other messages in this thread and apply them to pbStorePokemon, I think you should only need a very small change.

I think you said that withdraw works now too? So if this one works out, then you'll only have to track down the problem with the "move" menu item.

Maybe pbMoveCaughtToParty is used in those events that give the player a Pokémon and you'll still need to make it behave itself? If that is the case I think you'll be best off starting from what I suggested it would look like in my last message, replacing the original code in Pokemon_Storage with my idea.

EDIT: Also, Merry Christmas and/or Happy Holidays, depending on what you prefer.
 
Last edited:
15
Posts
7
Years
  • Age 24
  • Seen Aug 29, 2020
Just to check that we're on the same page here, the logic you're trying to write is "if the party is at its limit then put the Pokémon in the PC rather than in the party?"

I had a scan through the code for capturing Pokémon in-battle, and it turns out that pbMoveCaughtToParty doesn't seem to be necessary—it's only called from pbWithdraw (but after the party size check), and from the debug menu. It looks like the code you want to change for modifying how capturing wild Pokémon works is in PokeBattle_BattlePeer, specifically the second pbStorePokemon (in PokeBattle_RealBattlePeer).

Alrighty, first of all, late Merry Christmas to you too! Hope you enjoyed it
So.
I did a bit of messing around, and created this:

Code:
class PokeBattle_BattlePeer
  alias original_pbStorePokemon pbStorePokemon
  def pbStorePokemon(player,pokemon)
    if $Trainer.numbadges<=1
      then player.party.length<3
      player.party[player.party.length]=pokemon
      return -1
    else
      pokemon.heal
      oldcurbox=$PokemonStorage.currentBox
      storedbox=$PokemonStorage.pbStoreCaught(pokemon)
      if storedbox<0
        pbDisplayPaused(_INTL("Can't catch any more..."))
        return oldcurbox
      else
        return storedbox
      end
    end
  end
end

Yeah, I pretty much just copied a chunk from the PokeBattle_BattlePeer bit you recommended I have a look at..
While this doesn't make the game crash, it doesn't stop the player from catching more Pokémon and keeping them on the team than they should.

Also, the logic is the following:
If a player has a full party based on how many gym badges they have (say a full party of 2 pkm with 1 badge), then all caught Pokémon would be sent to the PC (as if they had 6 Pokémon in the original games)

As a quick reminder, that would be:
0 badges - 2pkm max
1 badge - 3 pkm max
2 badges - 4 pkm max
3 badges - 5 pkm max
4 badges - 6 pkm max
5 badges - 6 pkm max

So yeah, not sure what's wrong with the code, and the plan was to repeat the code but replace the number of gym badges and Pokémon party limit for each copy

Thank youuuu so much once again!
 
Last edited:
1,405
Posts
9
Years
  • Seen Mar 1, 2024
I think your big problem is how you're trying to use "then", see the highlighted changes below (green=added, red=removed):

Code:
class PokeBattle_BattlePeer
  alias original_pbStorePokemon pbStorePokemon
  def pbStorePokemon(player,pokemon)
    if $Trainer.numbadges<=1 [color=green]&& player.party.length<3[/color]
      [color=red]then player.party.length<3[/color]
      player.party[player.party.length]=pokemon
      return -1
    else
      pokemon.heal
      oldcurbox=$PokemonStorage.currentBox
      storedbox=$PokemonStorage.pbStoreCaught(pokemon)
      if storedbox<0
        pbDisplayPaused(_INTL("Can't catch any more..."))
        return oldcurbox
      else
        return storedbox
      end
    end
  end
end

I think you would have been able to work out that "then" doesn't do what you want ("&&" means and) because I think your original code would allow you to catch more than 6 Pokémon if you don't have enough badges!

Also, the logic is the following:
If a player has a full party based on how many gym badges they have (say a full party of 2 pkm with 1 badge), then all caught Pokémon would be sent to the PC (as if they had 6 Pokémon in the original games)

As a quick reminder, that would be:
0 badges - 2pkm max
1 badge - 3 pkm max
2 badges - 4 pkm max
3 badges - 5 pkm max
4 badges - 6 pkm max
5 badges - 6 pkm max

Right. My hint for this step is instead of "$Trainer.numbadges<=1 && player.party.length<N" use "player.party.length<$PokemonStorage.maxPartySize", assuming that you still have the change to maxPartySize in PokemonStorage. Note that the maxPartySize earlier in the thread doesn't quite line up with the numbers you want, but it should be relatively obvious how to adapt it.
 
Last edited:
15
Posts
7
Years
  • Age 24
  • Seen Aug 29, 2020
Soooo, as you might have guessed, did a bit more messing around.
Somehow managed to un-work the Withdraw function bit, but I'll just copy paste the code from a backup to everything to make it work again.
However, once I edited the code in PokeBattle_BattlePeer and the rest, when I catch one Pokémon too many, I get this error
Spoiler:


Oh, and the Pokémon isn't sent to the PC, even though it does show as being caught when I encounter the same Pokémon later on, interestingly enough.

And when I deposit a Pokémon through the Deposit function, I get this error
Spoiler:


So all in all, yeaaahhhhhh…. dunno really what to do at this point
:/
 
1,405
Posts
9
Years
  • Seen Mar 1, 2024
However, once I edited the code in PokeBattle_BattlePeer and the rest, when I catch one Pokémon too many, I get this error
Spoiler:
Looks like you've deleted the pbCurrentBox method that used to exist on RealBattlePeer. It used to be defined as:
Code:
def pbCurrentBox
  return $PokemonStorage.currentBox
end

And when I deposit a Pokémon through the Deposit function, I get this error
Spoiler:
This one looks like you might have accidentally deleted the pbDelete method that's supposed to be defined in Pokemon_Storage. If it is still there, then I guess you've misplaced an "end" and have it after pbDelete when it's supposed to come before (this goes for the other error too).
 
Last edited:
15
Posts
7
Years
  • Age 24
  • Seen Aug 29, 2020
Oki doki then!

First things first, since I'm basically trying to make a plug & play script (which makes it simpler to keep track of the code since the original scripts don't get edited), and made this using the llogic you provided earlier:
Spoiler:


However, I get the following error when I launch the game:
Script 'Team_Limit' line 34: NameError occurred.
undefined local variable or method `command' for Pokemon_Storage::PScreen_PC:Class
I'm guessing that has something to do with the "alias original_pbStorePokemon pbStorePokemon" line since I wasn't sure how to edit that.


Next, I did a bit of digging and found more code for the Withdraw/Move functions for the PC, in PScreen_PokemonStorage:
line 1448 - Move
line 1527 - Withdraw
However, there's a lot of code there, and so far I can't tell what on earth does what, sooooo…. yeah, I'll try to read through it, but it's doubtful I'll understand anything.

(also, from earlier, while if you already have a max party then you can't use the Withdraw function, if you have a small enough party to use the withdraw function then you can withdraw more Pokémon out than the party limit would allow - exactly the same way the Move function would do)


Finally, I found this bit of code on Relic Castle:
$PokemonStorage[box][place in the box] = $Trainer.party[place in the party]
$Trainer.party.delete_at(place in the party)
Apparently this duplicates the chosen Pokémon in the party and places it in the PC at a given spot then deletes the chosen Pokémon from the party. Problem is that this overwrites the placed Pokémon in the PC apparently, so I wonder if there's an alternative to this where it automatically places the Pokémon into the PC in an empty stop.
Here's the link to the thread if you wanna have a closer look: https://reliccastle.com/threads/321/

Once again, thank you soooooo much, and I really hope that we're reaching the end of this road of coding and whatnot!
 
1,405
Posts
9
Years
  • Seen Mar 1, 2024
and made this using the logic you provided earlier:
Code:
# This fixes the Withdraw function on PCs.
  class PScreen_PC
    alias original_pbStorePokemon pbStorePokemon
    if command==1 # Withdraw
      if $PokemonStorage.party.length>=$PokemonStorage.maxPartySize
        Kernel.pbMessage(_INTL("Your party is full!"))
        next
      end
    end
  end

However, I get the following error when I launch the game:

I'm guessing that has something to do with the "alias original_pbStorePokemon pbStorePokemon" line since I wasn't sure how to edit that.
So the alias line basically says "create a backup of the original pbStorePokemon function called original_pbStorePokemon" and only really makes sense if you're going to write your own replacement pbStorePokemon (with "def pbStorePokemon") and you plan on calling the original code. Your first alias line could say "alias original_pbMoveCaughtToParty pbMoveCaughtToParty", but there's no need to have it all because you never want to call the original code. The problem with your second set of code is what I was talking about it not being possible to make selective changes to the code—you can only overwrite entire "def ... end" blocks of code, but "if command==1" isn't a def (and you're getting an error because Ruby doesn't understand what you've written—it's just trying to run that code).

Next, I did a bit of digging and found more code for the Withdraw/Move functions for the PC, in PScreen_PokemonStorage:
line 1448 - Move
line 1527 - Withdraw
However, there's a lot of code there, and so far I can't tell what on earth does what, sooooo…. yeah, I'll try to read through it, but it's doubtful I'll understand anything.

(also, from earlier, while if you already have a max party then you can't use the Withdraw function, if you have a small enough party to use the withdraw function then you can withdraw more Pokémon out than the party limit would allow - exactly the same way the Move function would do)
Those bits look a good place to start, yeah. I think you can probably work out what's going on there, here's a hint: "command" contains the option chosen (0 is the first, 1 is the second, etc). So the code that comes after "if command==0" is what runs when the first option is chosen, see if you can follow the logic to find the function that runs when you try to move a Pokémon into your party. Based on the code you posted earlier I think you've already found the code that checks if the party is full, and therefore which function you need to override.

Finally, I found this bit of code on Relic Castle:

Code:
$PokemonStorage[box][place in the box] = $Trainer.party[place in the party]
$Trainer.party.delete_at(place in the party)

Apparently this duplicates the chosen Pokémon in the party and places it in the PC at a given spot then deletes the chosen Pokémon from the party. Problem is that this overwrites the placed Pokémon in the PC apparently, so I wonder if there's an alternative to this where it automatically places the Pokémon into the PC in an empty stop.
Here's the link to the thread if you wanna have a closer look: https://reliccastle.com/threads/321/

Yep that looks like it does what you say. You'd probably be better off using the code that runs when a Pokémon is caught, because that ought to stick the Pokémon in the first free slot available (have a read of pbStoreCaught, it looks like it loops over the boxes):
Code:
$PokemonStorage.pbStoreCaught($Trainer.party[place in the party])
$Trainer.party.delete_at(place in the party)

BTW if you use either Discord or Google Hangouts feel free to send me a PM here with your details. It's much easier to explain things in a conversation rather than a post every other day :)
 
15
Posts
7
Years
  • Age 24
  • Seen Aug 29, 2020
=====SOLUTION======
Many thanks to both MGriff and Vendily for finding this solution - couldn't have done it without you!
This is achieved using in game script events, here are the bare bones of the script!

Basic Script:
Code:
$PokemonStorage.pbStorCaught($Trainer.party[0])
$Trainer.party.delete_at(0)
Just these 2 lines of code

Although if for some reason extendtext.exe doesn't work for you, then you'll need to do three script lines:
Code:
$PokemonStorage.pbStorCaught(
$Trainer.party[0])
$Trainer.party.delete_at(0)
it is imperative that the middle script line doesn't start with a parenthesis!

In this case, this code
  1. sends the 1st Pokémon from you part (0) to the storage box
  2. Deletes the first Pokémon (0) in your party
Since the party is coded as 0 for the first, 1 for the second … and 5 for the sixth.

There we go - just modify the number in both lines, and that Pokémon will be sent to the PC as if by magic without the player being notified - so putting a small text like "a party member was sent to the PC" could be good too :D
 
Back
Top