What I want is a plugin for MV that generates an encounter using data from nearby events. Each event will reference a particular enemy ID. When the encounter is generated, each referenced enemy ID should be added to the encounter, and keep the event in memory so a self switch can be triggered when the enemy is killed during the encounter.
MV System to generate encounters
JS Plugin RequestsSo you can't easily do what you're describing, as the default battle system relies heavily on the troops defined in your database. Even the existing plugins for adding enemy reinforcements to battles do it by including enemies from other troops, you can't just willy-nilly choose an enemy ID.
You could try using Hime's Enemy Reinforcements and when an event is triggered, shove all of that information into game variables. Set up your troops to be, like, one per enemy ID or whatever. Make the default troop be empty, and use the IDs stored in the variables to see which troops you grab reinforcements from to construct your battle.
You could try using Hime's Enemy Reinforcements and when an event is triggered, shove all of that information into game variables. Set up your troops to be, like, one per enemy ID or whatever. Make the default troop be empty, and use the IDs stored in the variables to see which troops you grab reinforcements from to construct your battle.
That's not really a thing - you don't need to "keep something in memory" in order to reference it...and anyway, self switches are actually just a big list, completely independent of the actual events. So you can do that any time with troop events, when an enemy is dying, set a switch based on its ID.
The base troop that the encounters are generated from could include 8 placeholder enemies to act as slots for the enemies to be plugged into.
As for the self switches: How then would I tell the game to update which enemy correlates to which event in order to access the self switch? To define it by the troop event would reference a specific event ID, and not a separate variable that keeps track of which events are being used.
You'd have to write it out, either in event commands or a JavaScript function that you call via a plugin. At the beginning of the battle, you make all enemies immortal, then have a troop event that checks for any to have <= 0 HP. Example pseudo-code:
If enemy HP <= 0
-is enemy ID A?
--toggle event ID B self-switch
--else is enemy ID C?
--toggle event ID D self-switch
...
...all the possible enemies
...
-remove immortal state
If you know some JavaScript, it could be done much more efficiently in a switch statement, but it's possible just in an event.
Sorry, I'm not following you here.
What OP requested was similar to what I did in my VXAce game (although slightly different). Although I probably can't help with MV related, let me help to explain.
The OP wanted to use a visual encounter.
If the player triggers a VE, it checks the surrounding event that is labeled as VE.
The troop members are generated based on many VE in the vicinity.
So if you have 2 goblins events and one wolf event near your position when triggering the battle, you get that exact troop composition during the battle. After the battle, the OP expects to flip the self-switch on those VE events.
Thanks. You might have better ideas than I do, but I don't know how well all this will integrate into MV's battle system.
One can write code that scans a certain radius around the player on the map, sees any events that have (I would suggest) a notetag for encounter and the ID of the enemy, add those IDs to an array.
Then use that list of IDs to generate your enemies in the troop in the battle scene.
The trick (aside from writing the code for all of that) is that adding the enemies to the troop would be done via troop events, and that happens after the battle appears. So you'd load into an empty battle screen, then the enemies pop in, which is very possibly undesirable.
I don't know if there's a way to work around that aside from re-coding the battle scene also.
What I meant was if I simply put it in the troop event, that troop event would only ever call a particular event defined by hand, rather than whatever event is actually being used in the encounter.
I think the solution I mention earlier of placeholder enemies would solve this one too. Since its loading the encounter with dummy enemies first, before replacing them with the actual encounter enemies, it wouldn't be loading a blank encounter. The only issue then is having some solution to erase excess placeholders.
I don't really see the difference between blank and placeholder. Are all of your enemies shapeshifters, so it makes sense to see one set of monsters appear, then they change into something else?
I imagine that might look worse, as with a blank field you could at least do it Pokémon-style and be, like, "These monsters appear!" But whatever style you like for your game is, of course, fine for you.
They are not shapeshifters, they are "placeholders". Look at YEP enemy swapper or my version in MZ.
Based on your explanation, you already know the concept.
That is why this belongs in the JS request. This is a very customized request.
Although I could probably try to make an MZ version of this request. Sounds interesting.
Ah, I was unfamiliar with those plugins, and the OP didn't reference using it. I was assuming they were saying they'd put some default enemy in there and then change it through troop events. That seems like it would work.
Original thread: https://forums.rpgmakerweb.com/threads/system-to-generate-encounters.142141/