• The Eevee Expo Game Jam #10 has concluded, congratulations to all participants! Now it's time for the judges to play through the games, and you can play along to vote who deserves the community choice spotlight.
    You can check out the submitted games here!
    Play through the games and provide some feedback to the devs while you're at it!
  • Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

Resource Multiple Protagonists v5.0.0

Black24

Pokemon Fellowship in Kanto
Member
Joined
Jul 29, 2022
Posts
70
For your first question, try adding this line at the end of the battle in the event:
Ruby:
Expand Collapse Copy
getPlayerFromCharacter(partner_id).party = $PokemonGlobal.partner[3]
where partner_id is the partner's character ID (same ID as what goes in pbSwitchCharacter).

For the second question, I haven't edited the AI code in any way. You should try downloading a new copy of Essentials and testing out a double battle with a partner, and if the same issue happens then it's a bug in Essentials.
omg it actually worked, thanks alot
 

Black24

Pokemon Fellowship in Kanto
Member
Joined
Jul 29, 2022
Posts
70
Yes, for the PC storage, you can simply comment out any lines in the script that contain PokemonStorage or PCItemStorage and start a new save.

The Pokedex info is a bit trickier because that is stored within the general $Trainer object, so it can't just be commented out because you'd be sharing a lot more than just the Pokedex. I think you could try this: at the start of the game, save the first player's Pokedex to a Game Variable with this Script:
Ruby:
Expand Collapse Copy
$game_variables[XXX] = $Trainer.pokedex
Then inside this script, find the above line on 502 and place this line below it:

Ruby:
Expand Collapse Copy
newmeta[PBCharacterData::Trainer] = $Trainer # Find this
$Trainer.pokedex = $game_variables[XXX] # Add this below

In script section Player, find this line:
Ruby:
Expand Collapse Copy
attr_reader   :pokedex
and change it to:
Ruby:
Expand Collapse Copy
attr_accessor :pokedex

I haven't tested this, so let me know if it works.
I tried making that work ( shared pokedex ) on essential v20.1 but it seems only works on v19.
I wonder if there is a way to make all protagonists share the same pokedex in v20.1
Thanks again for the great script.
 

NettoHikari

Cooltrainer
Member
Joined
Jan 4, 2019
Posts
242
I tried making that work ( shared pokedex ) on essential v20.1 but it seems only works on v19.
I wonder if there is a way to make all protagonists share the same pokedex in v20.1
Thanks again for the great script.
I think for v20.1:

Save the first player's Pokedex to a Game Variable with this Script:
Ruby:
Expand Collapse Copy
$game_variables[XXX] = $player.pokedex

Then inside this script, find the above line on 436 and place this line below it:
Ruby:
Expand Collapse Copy
newmeta[PBCharacterData::Player] = $player # Find this
$player.pokedex = $game_variables[XXX] # Add this below

In script section Player, find this line:
Ruby:
Expand Collapse Copy
attr_reader   :pokedex
and change it to:
Ruby:
Expand Collapse Copy
attr_accessor :pokedex
 

Black24

Pokemon Fellowship in Kanto
Member
Joined
Jul 29, 2022
Posts
70
I think for v20.1:

Save the first player's Pokedex to a Game Variable with this Script:
Ruby:
Expand Collapse Copy
$game_variables[XXX] = $player.pokedex

Then inside this script, find the above line on 436 and place this line below it:
Ruby:
Expand Collapse Copy
newmeta[PBCharacterData::Player] = $player # Find this
$player.pokedex = $game_variables[XXX] # Add this below

In script section Player, find this line:
Ruby:
Expand Collapse Copy
attr_reader   :pokedex
and change it to:
Ruby:
Expand Collapse Copy
attr_accessor :pokedex
that worked 😁
thanks alot.
 

Black24

Pokemon Fellowship in Kanto
Member
Joined
Jul 29, 2022
Posts
70
Hi again and sorry for the trouble.

So, as you can tell the game I am working on is based on protagonist teaming up in battles, now the problem that i am facing is the partner can't access his\her bag in battle, due to some missing codes in essential scripts

And what makes this crucial for me is without having the mega ring in the partner’s bag, he\she can't mega evolve.

now I managed to fix the problem partially by the help of the community, but it only works on normal trainers, not the different protagonist.

the codes that i edited

Ruby:
Expand Collapse Copy
      ally = NPCTrainer.new($PokemonGlobal.partner[1], $PokemonGlobal.partner[0])
      ally.id    = $PokemonGlobal.partner[2]
      ally.party = $PokemonGlobal.partner[3]
      ally_items[1] = ally.items.clone

to

Ruby:
Expand Collapse Copy
      ally = NPCTrainer.new($PokemonGlobal.partner[1], $PokemonGlobal.partner[0])
      ally.id    = $PokemonGlobal.partner[2]
      ally.party = $PokemonGlobal.partner[3]
      ally.items = $PokemonGlobal.partner[4]
      ally_items[1] = ally.items.clone

aslo i added trainer.items here

Ruby:
Expand Collapse Copy
  $PokemonGlobal.partner = [tr_type, tr_name, trainer.id, trainer.party, trainer.items]

any help is appreciated.
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
Well, I took the code I'm going to share from the script Save File Calls so credits to him, I guess?

This is part of a code to pass all data from a player to a trainer to fight against but maybe it'll help?
Ruby:
Expand Collapse Copy
      oldbag = bag.clone
      items = []
      for i in 0...oldbag.pockets.length
        pocket = oldbag.pockets[i]
        for j in 0...pocket.length
          item = pocket[j]
          item[1].times do |k|
            items.push(item[0])
          end
        end
      end
      trainer.items = items
    end
 

Black24

Pokemon Fellowship in Kanto
Member
Joined
Jul 29, 2022
Posts
70
Well, I took the code I'm going to share from the script Save File Calls so credits to him, I guess?

This is part of a code to pass all data from a player to a trainer to fight against but maybe it'll help?
Ruby:
Expand Collapse Copy
      oldbag = bag.clone
      items = []
      for i in 0...oldbag.pockets.length
        pocket = oldbag.pockets[i]
        for j in 0...pocket.length
          item = pocket[j]
          item[1].times do |k|
            items.push(item[0])
          end
        end
      end
      trainer.items = items
    end
Thanks for your replay, just not sure where should i add that, and if it can copy the partner's bag not the player's one.
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
663
You should use that before switching between characters so the bag stored is from the last character. Maybe combine it with conditionals to see which character the player was using to store the bags on different variables? It should be something similar to the way the partner's pokemon are selected.

As for the place, I haven't looked at the script but probably around the same place where the script stores the character's pokemon.
 

tammyclaydon

Novice
Member
Joined
Mar 21, 2022
Posts
35
this looks like its what ive been looking for just a couple of questions
1) how complicated will it be to convert to 21.1 ive done a couple but i know some are harder than others
2) is there a way to battle an inactive protaganist
3) i see that theres ways to share the pokedex but can this be done after a certain point and does it work with storage
 

NettoHikari

Cooltrainer
Member
Joined
Jan 4, 2019
Posts
242
this looks like its what ive been looking for just a couple of questions
1) how complicated will it be to convert to 21.1 ive done a couple but i know some are harder than others
2) is there a way to battle an inactive protaganist
3) i see that theres ways to share the pokedex but can this be done after a certain point and does it work with storage
1) I'm planning to update this in the next couple of weeks.
2) Can you clarify your question? You can battle any protagonist that has been switched to at least once. You can also modify the data of any character once the character has been initialized, if you want to give a custom party, items, etc.
3) To share the pokedex only after a certain point, you can probably use the same code I posted above (https://eeveeexpo.com/threads/2056/post-59010), but instead of doing this part:
Ruby:
Expand Collapse Copy
newmeta[PBCharacterData::Player] = $player # Find this
$player.pokedex = $game_variables[XXX] # Add this below
You replace it with this:
Ruby:
Expand Collapse Copy
newmeta[PBCharacterData::Player] = $player # Find this
$player.pokedex = $game_variables[XXX] if $game_switches[YYY] # Add this below
And then create a new Game Switch that you turn on at the point you want to enable pokedex sharing. One issue with this is that it will only use the first character's pokedex data, not merge the data between all the characters. Some extra code would be required if you want the data to be merged the first time the sharing is enabled.
You should be able to apply a very similar method to the pokedex sharing code to any object, such as the bag, pokemon storage, or item storage.
 

NettoHikari

Cooltrainer
Member
Joined
Jan 4, 2019
Posts
242

NettoHikari

Cooltrainer
Member
Joined
Jan 4, 2019
Posts
242
Well, I've actually updated it to Essentials v21.1 now.

At some point in the next one or two weeks, I'm planning to refactor the script. As part of the new version, I'll add a feature to allow sharing of resources (such as bag, item storage, pokemon storage, dex, etc.) between characters, given that there have been several people asking for it.
 

NettoHikari

Cooltrainer
Member
Joined
Jan 4, 2019
Posts
242
NettoHikari updated Multiple Protagonists with a new update entry:

v5.0.0 Update: Added resource sharing and other refactoring

WARNING! v5.0.0 is not compatible with the previous versions. This means that you MUST start a new save for testing if you update this script.
In other words, if you've already released a game using an earlier version of this script, then you cannot update to v5.0.0 without ruining players' old saves.
  • Added settings to enable or disable sharing of Pokedex, bag, Pokemon storage, and item storage between all characters
  • Refactored script into multiple sections and replaced enum...

Read the rest of this update entry...
 

Andrronicus

Rookie
Member
Joined
Oct 26, 2023
Posts
3
Hey there, this is a really cool resource and the work you put into it shows in the code! I was wondering if you might have any advice for adapting this script to swap with a follower, like a temporary trainer or even a follower pokemon? Unless it just make sense to designate a second player that looks like the follower pokemon and sometimes take control of it?
 

M-PowerMint

Rookie
Member
Joined
Mar 20, 2023
Posts
5
Good morning. What can I do with this error?:
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: TypeError
Message: instance of IO needed

Backtrace:
<internal:marshal>:34:in `load'
104:GameData:131:in `load'
104:GameData:131:in `load_data'
104:GameData:131:in `load'
104:GameData:233:in `load_all'
[ZUD Mechanics] Data_PowerMove.rb:387:in `load_all'
032:StartGame:12:in `initialize'
389:Main:30:in `mainFunctionDebug'
389:Main:18:in `block in mainFunction'
015:Errors:80:in `pbCriticalCode'
 

M-PowerMint

Rookie
Member
Joined
Mar 20, 2023
Posts
5
Good morning. What can I do with this error?:
[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Exception: TypeError
Message: instance of IO needed

Backtrace:
<internal:marshal>:34:in `load'
104:GameData:131:in `load'
104:GameData:131:in `load_data'
104:GameData:131:in `load'
104:GameData:233:in `load_all'
[ZUD Mechanics] Data_PowerMove.rb:387:in `load_all'
032:StartGame:12:in `initialize'
389:Main:30:in `mainFunctionDebug'
389:Main:18:in `block in mainFunction'
015:Errors:80:in `pbCriticalCode'
Never mind. This is too hard for me to fix.
 

UnknownSoldier77

Rookie
Member
Joined
Nov 10, 2023
Posts
1
NettoHikari submitted a new resource:

Multiple Protagonists - Plug-and-play script to add multiple player characters



Read more about this resource...
Hello. I see this has been recently been updated on GitHub. Does this plug-in work for having the play having two trainers at once? I'm thinking of a game where the player uses partners to get through. I have done a quick overview of the scripts, but I am new to RPGM and Essentials.
 

NettoHikari

Cooltrainer
Member
Joined
Jan 4, 2019
Posts
242
Hey there, this is a really cool resource and the work you put into it shows in the code! I was wondering if you might have any advice for adapting this script to swap with a follower, like a temporary trainer or even a follower pokemon? Unless it just make sense to designate a second player that looks like the follower pokemon and sometimes take control of it?
That second option is probably the easiest approach. You'll need to have some code in pbSwitchCharacter to set the correct location upon switch. You might even be able to make it a smooth transition by having some code to shift the camera to the follower's location, then perform the switch without the default fade transition.
 

NettoHikari

Cooltrainer
Member
Joined
Jan 4, 2019
Posts
242
Hello. I see this has been recently been updated on GitHub. Does this plug-in work for having the play having two trainers at once? I'm thinking of a game where the player uses partners to get through. I have done a quick overview of the scripts, but I am new to RPGM and Essentials.
If you mean that the player should have the ability to control two characters simultaneously (i.e. side-by-side screens), then this plugin will not provide that. If you mean that the player can switch between two characters at any given time, then this plugin does provide that.
 

Ryuushedo

Developer of Pokemon Lost World
Member
Joined
Jun 13, 2023
Posts
18
im sorry for bothering you sir, do you mind help me fix it as when im using Essentials Deluxe its caused an error when change character red into leaf
btw its on essentials version 20.1
 
Last edited:
Back
Top