Can't seem to find this on google. How can I add and remove actors on my party during a battle in Javascript. Thanks!
MZ Add/Remove Party Members using Javascript
Javascript/Plugin Support*edit* NVM. I didn't see that you said "during battle". Can you further explain what you're trying to do? Like, are you just wanting to swap a battle member with a reserve member or something?
At the start of the battle, it will be only four actors. Then if I use a skill, a reserve actor will be added to the party. Then at the end of the battle, the reserved actor that was recently added will be removed.
I want to know how to code this in Javascript. Thanks!
I want to know how to code this in Javascript. Thanks!
$gameParty.addActor(id) where id is the slot number in the actor database.You should probably make the skill run a command event which in turn, runs this script call.
The thing is, party limit is 4 by default, which is not made to be changed, there's workarounds to it, though.
About removing the actor, it is
$gameParty.removeActor(id), which you should run as a auto common event to being in the open map for example.The most basic workaround is
$gameParty.maxBattleMembers = function ()
{
return 5;
}
before adding, but this would let player have a fifth char so run it again with a 4 after removing the actor.Make sure these are run through the battle animations, not in the action selection time, or it will crash your game.
Thanks for this. I already figure out how to change the default party limit. Will try this.
Thanks for this! My code is now working.
In general, if you are ever left wondering "I know how to do this thing with event commands, but how do I do it with javascript?", there is this handy dandy spreadsheet to look it up:
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Original thread: https://forums.rpgmakerweb.com/threads/add-remove-party-members-using-javascript.148719/