MV Sending Captured Monsters to Storage (DreamX_CaptureEnemies)

Hi everyone! I’m working on a monster-catching game in RPG Maker MV, and I’m running into an issue combining two plugins via an event:

[DreamX_CaptureEnemies.js]
Allows capturing enemies and converting them into party members using <capture_actor_id:x> notetag.

[MonsterStorageBox.js]
Adds a PC-style monster storage box where you can deposit and withdraw actors.

They actually work fine, DreamXs plugin creates copies of actors and I can deposit and withdraw those copies without trouble. What I want is when I capture a monster during battle, I want the game to check if the party already has 6 members (which is the maximum) and if it's full, send the next captured monster to the storage box. This is exactly what games like Pokemon do when you reach maximum capacity in your party.

DreamXs plugin has the notetag <capturedSwitch:x> ( with x as the switch ID as an enemy notetag to set the switch to true when the enemy is captured) so I think I can use this in an event, but I think that is too complicated, and I don't even know how to start this event.

Can someone help me with this? That's a core mechanic in my game!

Thank you in advance for your help!
Let me know if you need screenshots or a demo.
DreamXs plugin has the notetag <capturedSwitch:x> ( with x as the switch ID as an enemy notetag to set the switch to true when the enemy is captured) so I think I can use this in an event, but I think that is too complicated, and I don't even know how to start this event.
This will depend entirely on what you intend to do, I imagine you understand what a Switch is for in RPG Maker, so the easiest example I'll give you is if you need to catch a creature as a simple challenge proposed by an NPC, like, catch a somewhat rare monster, then you discover that there is a difficult-to-access region where it can appear and capture it, then you can create ways as you prefer in the dialogue:
1745543591526.png


After the award, simply use a local Switch instead of a standard Switch, so the dialogue will only occur once in the game:
1745543654581.png


If your RMMV is configured in Portuguese, the events will be like this:
Spoiler: PORTUGUESE - BR
Página 1:
Code:
◆Texto:People1(4), Janela, Inferior
:     :Se você conseguir capturar um monstro XYZ
:     :eu te darei um prêmio
◆Se:Switch41 XYZ Monster é ON
  ◆Texto:People1(4), Janela, Inferior
  :     :Ei! Você já tem um, tome está Água Mágica
  ◆Mudar Itens:Magic Water + 1
  ◆Controlar Switches Locais:A = ON
  ◆
:Fim

Página 2: Ativado pela Switch Local "A"
Code:
◆Texto:People1(4), Janela, Inferior
:     :Você realmente é um grande treinador
Thanks for the response and for the Portuguese event page!

Sorry if I wasn't enough clear, my main intention with this event is to send monsters to the box automatically when my party is full. For the storage, I'm using [MonsterStorageBox.js] plugin, but I don't know how to create an event (or maybe I need a script) that could do this.

I can store monsters manually, but I intend to also do it automatically in this specific condition.
Maybe I didn't understand something, but I focused exactly where what seemed to be a second question was about how to use the DreamX Plugin, which is the purpose of this function that automatically activates the Switch by the selected ID.
Mm, so it sounds like you need to do two things; after catching a monster (with the first plugin), check to see if the party has more than 6 members, and if it does automatically trigger the second plugin to store the most recently caught monster.

Looking at the thread for the second plugin, people have said that the script call
$gameSystem.depositedActors.push(X);
(where X is the ID of the actor in question from the database) will store that actor. (Possibly you also need to use
$gameParty.removeActor(X);
to remove them from your current party? Not sure, I haven't tested).

So, what we need to do is run some code after you catch an enemy to check the number of people in the party - I believe the script call for that is
if($gameParty.members().length > 6)
and then grab the actor ID of the last member:
$gameParty.members()[6].actorId()
and then use the
$gameSystem.depositedActors.push(X);
to deposit them.

Put it all together, I think it would look like this (though again, this is untested!):

Code:
 if($gameParty.members().length > 6) {
var actor = $gameParty.members()[6].actorId();
$gameSystem.depositedActors.push(actor);
}

Run that snippet after every time you catch a monster, and hopefully it will work. Like I said, you might need to use

Code:
 if($gameParty.members().length > 6) {
var actor = $gameParty.members()[6].actorId();
$gameSystem.depositedActors.push(actor);
$gameParty.removeActor(actor);
}

if it's storing them but not also removing a version from the party.
Mm, so it sounds like you need to do two things; after catching a monster (with the first plugin), check to see if the party has more than 6 members, and if it does automatically trigger the second plugin to store the most recently caught monster.

Looking at the thread for the second plugin, people have said that the script call
$gameSystem.depositedActors.push(X);
(where X is the ID of the actor in question from the database) will store that actor. (Possibly you also need to use
$gameParty.removeActor(X);
to remove them from your current party? Not sure, I haven't tested).

So, what we need to do is run some code after you catch an enemy to check the number of people in the party - I believe the script call for that is
if($gameParty.members().length > 6)
and then grab the actor ID of the last member:
$gameParty.members()[6].actorId()
and then use the
$gameSystem.depositedActors.push(X);
to deposit them.

Put it all together, I think it would look like this (though again, this is untested!):

Code:
 if($gameParty.members().length > 6) {
var actor = $gameParty.members()[6].actorId();
$gameSystem.depositedActors.push(actor);
}

Run that snippet after every time you catch a monster, and hopefully it will work. Like I said, you might need to use

Code:
 if($gameParty.members().length > 6) {
var actor = $gameParty.members()[6].actorId();
$gameSystem.depositedActors.push(actor);
$gameParty.removeActor(actor);
}

if it's storing them but not also removing a version from the party.
Interesting. I'm going to try this! Where should I put dos lines of code? I'm not that familiar with eventing yet. That should be a common event or a battle event?
Yeah, I'd imagine you can put it in as a script call in a battle event with the span of running once per Turn, and a condition at the end of Turn. Try it for a single battle to test it out, anyway. If it does work, you might want to use something like Yanfly's "Base Troop Events" plugin so you don't need to copy the code into every single troop. (I'm assuming you can't catch more than one monster per turn). I don't know exactly how the catching works, if it only works after a fight you might need to instead run it as a common event that gets called after each fight.
Ok, that's what I tried to do, but it didn't work:

DreamXs plugin has the notetag <capturedSwitch:x> (with x as the switch ID as an enemy notetag to set the switch to true when the enemy is captured) so I created that switch and added to the enemy:
teste 3.png


This is the battle event with the code that you mentioned:
teste 1.png


teste 2.png


Again, I'm not that familiar with eventing, but that was what I thought would make sense 😅
did capturing the enemy by chance end the battle? the engine prioritizes ending the battle over running any active troop events pages. youd need a plugin like Hime's end phase triggers to bypass that if its an issue
did capturing the enemy by chance end the battle? the engine prioritizes ending the battle over running any active troop events pages. youd need a plugin like Hime's end phase triggers to bypass that if its an issue
Yes. The plugin that's responsible by capturing drops the enemy HP to zero and then captures it (that's not what I really intend it to be, but it works for now) and then adds the new actor to the party.

(I'm assuming you can't catch more than one monster per turn).
Actually the player can, but that's also not what I want it to be, but I'm focusing on this problem that I'm having right now.

Well, if someone could check this event that I created, if there is any chance that this will work.
I didn't understand the purpose of this Switch in the battle event, what I believe is that the event triggering method is also wrong, the correct thing would be to check this at the end of each turn.

Span should be changed to Turn because if it stays in Battle mode it will only happen once:
1745822066919.png

it should just be the switch name, no? all switches inside a troop event page have curly braces around them. i think OP just named it capture(id1) because that enemy gets tied to actor 1
Edit:
The $gameParty.members() method only returns the number of Party members in battle, only 4, only on the map it returns the total, so the best option would be to use $gameParty._actors which returns an Array with the IDs directly.
1745821782486.png

I also wouldn't use IF inside the Script command, as this would prevent the dev from including other event commands, such as a simple warning message.

Another thing, let's say that by chance you decide to have the option of capturing two or more monsters in the same battle, then in this case you will need to use a cycle (repeat until completed):
Code:
◆Loop
  ◆If:Script:$gameParty._actors.length > 6
    ◆Script:let actor = $gameParty._actors[6];
    :      :alert(actor);
    :      :$gameSystem.depositedActors.push(actor);
    :      :$gameParty.removeActor(actor);
    ◆Text:None, None, Dim, Top
    :    :Este monstro foi enviado para o depósito...
    ◆
  :Else
    ◆Break Loop
    ◆
  :End
  ◆
:Repeat Above
It is not possible to capture all the event fields, so I put the code directly
it should just be the switch name, no? all switches inside a troop event page have curly braces around them. i think OP just named it capture(id1) because that enemy gets tied to actor 1
That's what I thought, this is the same switch that I used in the enemy/monster notetag, as the plugin text suggests.
The $gameParty.members() method only returns the number of Party members in battle, only 4, only on the map it returns the total, so the best option would be to use $gameParty._actors which returns an Array with the IDs directly.
I just tested the script that you proposed, both of them. The enemy is captured and send to the party and no text is shown. So, it didn't work.

I checked a AI code assistant to tell me how DreamX plugin capture system works, I hope that it can help:

DreamX_CaptureEnemies uses two ways to add captured monsters:

Sometimes it adds during the battle ($gameParty.addActor(newId)).

Sometimes only after the battle (BattleManager._capturedEnemies → added in updateBattleEnd).

I don't know, but maybe Before adding the monster (or immediately after), we need to calculate how many actors were there before. If the party already had 6 members before adding, the capture should go straight to storage.
I tested it here and it worked perfectly. To make sure, I joined the party with 7, executed the caputara and waited for the end of the turn.

It removed the item in position [7] and automatically the item in position [8] replaced it and because of the loop the event repeated itself until there were only 6 members in the Party.
I made a tested with 7 party members and this happened:

I enter in the battle scene and this message appears, I clicked in OK and then the captured massage played ("this monster was sent to the storage...")

Screenshot 2025-04-28 174916.png


I checked in the deposit and the 7th member was there, but when I captured another monster it was not sent to deposit:
Screenshot 2025-04-28 175004.png


here is the event:
Screenshot 2025-04-28 174718.png


the screenshot didn't show, but the event ended like this:
Code:
:End
  ◆
:Repeat Above
The alert is just for testing, you shouldn't put it in the script. The value 18 is the ID of the member that was found at [6]
You will need to analyze the console to see if there is an error due to the dialog message not appearing.
The alert is just for testing, you shouldn't put it in the script. The value 18 is the ID of the member that was found at [6]
You will need to analyze the console to see if there is an error due to the dialog message not appearing.
Thanks for the help so far!

I made a test with 6 party members and then capturing the 7th in battle. The new actor is added in the party normally, which is something I don't want. But when I try to start another battle, the message is shown and then the seventh member is immediately sent to the deposit.

What I was looking for is when I captured the seventh enemy, he is sent to the deposit after the battle ends. But I think he is being sent to deposit when a new battle is started.
Very strange, if the first one happens it means that the loop event has started... and from the screenshot you sent your event is correct.

It is not necessary to send the project, today or tomorrow I will send the test I did and you can analyze the difference.
Thanks for the help so far!

I made a test with 6 party members and then capturing the 7th in battle. The new actor is added in the party normally, which is something I don't want. But when I try to start another battle, the message is shown and then the seventh member is immediately sent to the deposit.

What I was looking for is when I captured the seventh enemy, he is sent to the deposit after the battle ends. But I think he is being sent to deposit when a new battle is started.

Feels like the code works, the issue is with the timing. It seems the in battle timing isn't working well; you could try changing the Span to "Moment" instead of Turn, with Conditions of "Turn 0 + 1*X". That's a bit risky, because it will try to run constantly, and could slow your game down; so you'd want to add a "Wait 2" command somewhere in the loop to give your game a little chance to breathe.

Original thread: https://forums.rpgmakerweb.com/threads/sending-captured-monsters-to-storage-dreamx_captureenemies.177210/