Hello,
This is my first post so I hope it will be helpful.
I'm hoping to make a battle plugin that permits a character to summon another character into a blank slot in the party. Imagine something to the effect of: Summoner Casts 'Goblin with Visible Nips' -> an empty slot in the party is filled with a character named Goblin with Visible Nips. There are other factors I want involved such as removing these summons at the end of battle but I'll cross the bridge later once this part works. Baby steps, you know?
Basically in very crude pseudocode I would figure it would play out something like this:
When summon spell is cast, check if party is full.
If Full- Spell fails.
If Not Full- Continue
Get level of summoner
Create character of appropriate type in first open slot, at level of summoner.
Now I would assume that based on what little I know, I'd have to create a character for each potential summon, with it's own growths and stuff, but is it possible to populate the party during battle through scripting? Is it possible to instantiate characters into the database on the fly like that (in case there's two slots open and say the summoner wants to summon two of the same thing). I'm assuming if there's a way to populate the database in script there would also be a way to depopulate it to avoid tons of junk characters clotting up the memory.
In terms of skill level I've only done some plugin tutorials but I have a background in other languages and a JS reference so I was hoping to use this as a learning experience.
Anyhow any help would be appreciated. I'm very new to programming RPGMMV. Than
'Summoning' Characters in Script
● ARCHIVED · READ-ONLY
-
-
the biggest problem here is also the reason why there are so few summoning scripts: compatibility with other battle-plugins.
As long as you stay with the default system, you don't even need a script or plugin for summoning, you could summon any existing actor by eventing alone, absolutely no need for javascript. And most people do that for non-battle-summonings as well.
However that changes as soon as people begin to use plugins to change their battlesystems. You usually get a lot of errors if you try to summon during battles.
The reason for this is that a lot of battlesystem-plugins need additional data on the battlers to function correctly, and they usually set and define that data at battlestart only.
So if you try to add an actor during battle (no matter if by events or by script), that battler is missing the required additional data the other battleplugins need -> "UNDEFINED" errors or similiar effects are the result.
To get the summoning working, you need to be able to add that non-default data at the moment you summon your additional actor into battle. And that is only possible if you know what data the other battleplugins need and define.
So you can write a summoning plugin that will work for a specific battlesystem, but it will usually fail to work for a different combination of battleplugins.
To write a summoning plugin that works with everything, you would have to include code to identify every other battleplugin and make the correct additions for each other battleplugin. -
Ah I see, thanks! I wasn't even aware the in-game engine could add characters during battle. I guess I need to look into that. As for making plugins I'm not too worried about carking up the battle system because I'm only using plugins I make myself (mostly to add UI) as a learning experience. I'm leaving the battle engine wholly untouched.
I guess then my last question before this ventures out of the area of JS into scripting is if it's possible for the engine to be instructed to have multiple copies of the same character in the party at the same time and if so does it create junk data (keeping track of that character forever even though it's gone at the end of battle). The only thing I could think of to be sure was rather inelegant: having 3 copies of every potential summon and using logic in the script to have it pick each one in sequence. It seemed like a safe way to ensure the game isn't trying to remember data for the last 120 spoopy skeletons the character has summoned in old battles.
Thanks again for your reply, it really helps! -
actors need a unique ID, so yes you'll need a copy for each possible summon.
However, you can reset data on adding, that is what the initialisation checkbox on the event command to add an actor stands for. So you'll only need one actor per slot per different summoning.
How to handle different summons depends on what exectly you want - the way you mentioned is the easiest one but not the only one. -
I see, thank you this is really helpful! Sorry it ended up not being very JS related but I didn't know it could be handled outside of JS going in! Thanks a ton!