Background - Trying to make a 'Paper Mario Thousand Year Door' style audience
Ok, so I got just one little problem at the moment, or major issue....I need to add an 'audience' to a battle but not as part of either the Party or Troop or Unit (doing so means that their are multiple copies of 'audience' rather than one)
The 'audience' needs to be able to be referenced by both the Party and the Troop, as it influences TP gain
To make it clear, I just need to know where I need to put the call for initialising the 'audience', not anything on setting up or coding the 'audience' itself, just how to get it to start in a battle, and remove it when the battle ends (coders will understand why)
If this will only happen in some specific encounters, your best course of action is use Battle Events.
On the Database Editor, in the Troops area, select the encounter that will have the Audience.
In the lower area of this window you can set up events. Set one page with the condition to fire at turn 0+0 (start of battle) with a scope of Battle (once per battle). Use this page to initialize the crowd (you can insert script commands in the Event window, use that to call your script that initializes the Audience).
I don't remember right now if there was a Battle End condition for events there too; if there isn't, you may do this in BattleManager.updateBattleEnd
Well, just tried that and got a TypeError "undefined is not a function"
Looking at the error log I don't think the engine/plugins like me calling a function inside the Battle Event window
TypeError: undefined is not a function
at Game_Interpreter.eval (eval at <anonymous> (file:///C:/.../js/rpg_objects.js:10436:10), <anonymous>:1:10)
at Game_Interpreter.command355 (file:///C:/.../js/rpg_objects.js:10436:5)
at Game_Interpreter.executeCommand (file:///C:/.../js/rpg_objects.js:8894:34)
at Game_Interpreter.update (file:///C:/.../js/rpg_objects.js:8802:19)
at Game_Troop.updateInterpreter (file:///C:/.../js/rpg_objects.js:5195:23)
at Function.BattleManager.updateEventMain (file:///C:/.../js/rpg_managers.js:1920:16)
at Function.BattleManager.updateEvent (file:///C:/.../js/plugins/YEP_BattleEngineCore.js:1224:21)
at Function.BattleManager.update (file:///C:/.../js/plugins/YEP_BattleEngineCore.js:1182:33)
at Scene_Battle.updateBattleProcess (file:///C:/.../rpg_scenes.js:2050:23)
at Scene_Battle.update (file:///C:/.../js/rpg_scenes.js:2042:14)
The other problem is it needs to run for every battle, so a coded solution is probably the preferable on, I should note I am a competent coder with some prior experience with js, I'm just not that versed in some of RMs logic
Edit: I'm a dumbie (again) and wrote Audience.initialize when i should have wrote new Audience()
Also, if I use this method I should be able to just use Yanfly's Base Troop Events plugin