Changes happening At Battle Start

Hello again.


What I'm trying to do: I am trying to make events happen after a battle has been initiated but before items are drawn.


I feel like I'm thinking too hard about it. I've gone over the code probably for too long at this point... so I'm going to take a break and wait to see what people say... maybe get a clear look at what I'm doing.


Question: Where would I have to go / or what would I have to do in order to cause events to happen after a battle has started but before the character's appear?


Thank you to anyone who answers this. I'm sorry if this is a completely noob question, I'm still trying to get it.
Telling us what you want those events to do will probably be a big help.
Fair point.


Either I want to change a variables value (I've linked a variable to maxBattleMembers).


Or if this doesn't work I'll want to change the opacity of actors not in the "initial" Battle Party.


The idea behind the plugin I've been working on is to be able to  summon new actors into the battle scene during the course of the battle. I can remove them with a Common Event after combat is completed however I found that I need to initialize their slots in battle otherwise they'll be invisible. So if the battle starts with 4 actors and is reduced to 3 then when I summon the 4th their graphics will appear. However the reverse is not true, If the battle starts with 3 actors and is later raised to 4 the 4th actor becomes a Phantom actor, staying invisible even though he/she can take actions.
There are a couple of approaches to this.


How are your battles called?  Are they random battles set up in the map properties?  Or are you using a Battle Processing event command?  If the latter, you can just change the variable prior to the Battle Processing command, and change it back (if required) in the same event after the Battle Processing command.  If they're random battles in map properties, you would either need to modify the scripts to do the changes, or change the variable by event sometime prior to entering the area where battles can be triggered.  If there's something the player does, or somewhere they go, that would cause the battle party size to change, change the variable there as well.


If the battle starts with 3 and you increase it to 4, I'm sure there will be something you can call that will make the extra character appear.  So that is also an option (and probably a better one than what you're trying to do) - it's just a matter of figuring out what that something is that you need to call.


However, aren't there already summoning tutorials and/or plugins for MV?  Have you looked at them to see what they do?  They've obviously gotten around this problem.
All of my battles are evented with the Event Touch trigger. Though I would like to make that an option in my plugin.


I won't deny that there probably is something to call I'm missing. I could keep searching for it. I just got a little frustrated and wanted to see if anyone would be able to help me locate it. I've only just taught myself Javascript and looking through the web of methods / functions really gets to me after a little while.


I'll check out those tutorials you're speaking of at the very least they can help me think of something I haven't if I don't just change to their method.


EDIT : The more I look the more I see people running into the same issues I had run into prior to trying to write a plugin. Either they need to be able to summon into an empty party slot or they get invisible actors. May I ask if you happen to know of a success? I'll keep looking in the meanwhile.
If you only need to change a variable at the start of each battle, and all your battles are evented, can't you just add a Control Variables command prior to the Battle Processing command in each event?
That's where the trick comes in. See I need the battle to start before I change the variable or I run into the invisible actor issue.


.maxBattleMembers() = Var_1 + $gameVariable.value(Var_2);


In the game itself I can control the Variable Var_2 so I can use the Troop Events but if I do it will wait until the scene is made thus the actors that would fill the extra slots will appear before the commandWindows appear then suddenly disappear when you can select actions. The alternative would be to make extra fighters jump off screen but it would still look weird since I'm not swapping other party members in and rather adding a Summoned Creature in.
So, am I understanding this correctly ...


You have 3 actors in your party.


If you change maxBattleMembers to 4 prior to the Battle Processing command, it shows you 4 slots, but the 4th is blank?


If you change maxBattleMembers to 4 after the start of battle, it won't show the 4th slot at all?


I suspect what you can do is, when you want to summon or remove the summoned character, change the variable for the party size, then call the Window_BattleStatus.refresh() method, which clears the status window (where all the actor info is saved) and redraws it.  That is held in the Scene_Battle's _statusWindow property.  Something like this might suit:

Code:
SceneManager._scene._statusWindow.refresh()

as a script call immediate after changing the variable to add or remove the extra member.


It might still be a good idea to change the variable upon returning to the event after the battle is over, without the above call, as if the extra member is summoned and doesn't go away before the battle ends, the party size will still be the higher number at the end of battle.  But if there is a point where the summoned member leaves during the battle, change the variable and add the above script call at that point too, so you don't have an extra 'blank' party member slot for the remainder of battle.
Unfortunately I believe all that does is refresh the status menu's information. With or without this information the party member appears and disappears from the status menu but never appears as a graphic.


Perhaps I didn't word it properly but what I meant was for the actor's graphic to appear. I am using the sideview system.


I forgot that by default it doesn't show actor graphics my apologies.


---


The test requires me to have more than 3 actors in the party because the end goal of my project is to have a system where you have multiple party members and the ability to have the inBattle characters summon familiar that battle alongside them for example. 


If MaxBattleParty is set to 3 and I have Actors: Ralph, Zack, Alaina, and Haley only the three of them that are in party index 0-2 would be in combat. In this case Ralph, Zack and Alaina.


From here if I increase the battle party to a max size of 4 Haley will automatically fill the slot, however her character graphic will not appear.


Now in the scenario where I said the MaxBattleParty starts as 4 and is moved down to 3 battle begins and you see all four actors but Haley disappears the moment MaxBattleParty's size is reduced to 3. However when the party size is returned to 4 and she fills the slot she will display an actor graphic in combat.


Now it is not my intend to have Haley be the one to fill the slot, but rather another character added to the party for the summon but that's another scenario apart from this one that I believe I've already solved as swapping a character for another already works I just have the issue with the Party Size having to be reduced from a larger value, as this is the only work around I've determined thus far.

Original thread: https://forums.rpgmakerweb.com/threads/changes-happening-at-battle-start.69883/