RPG Maker Forums

In games like Pokemon, Megami Tensei, Dragon Quest, SaGa, Final Fantasy, etc., battle actors are created from an unchanging, precreated template. So although your Black Mage can level up, there are stats for a template Black Mage- the "Parent"- within the game, and as many unique clones or "children" can be created as you want.


It seems as though RMMV needs all its actors to be defined in the Actors Database, so there's no built-in functionality for these instances. There are currently a few available plugins that allow you to create these instances (HimeWorks' Instance Actors and DreamX's Capture Enemies being the main ones) , but they are severely limited, lacking the ability to remove actors added to the Actors Database. Without a method for the deletion of actors inserted, you run into several problems: players end up with having every captured enemy they've ever encountered dumped into their inventory. This is sometimes desirable, but in cases like Pokemon or Dragon Quest, being able to release/fire/delete these extraneous party members is important from a management standpoint. Though you could simply hide them in another party (using Yanfly's Party Manager or something), there is also an issue of memory management. Many of these plugins add to the Actors database endlessly with no method of managing when it's too "full." While, admittedly, you're unlikely to ever hit the upper limit of the array's length, it's also a bad idea to keep around discarded or otherwise pointless data no longer in use.


Perhaps you could do something like the following:


Parameters:

  • Starting Index Number for Instance Actors in Actor Database [int]
  • Maximum Number of Slots [int]



Internal Variables:

  • Is Initialized [bool]


    Whether the plugin has been run before
  • False by default.

[*]Empty Slots Array [Array of Ints]

  • stores the index number of Slots flagged as not in use, in order.

[*]Previous Starting Index Number for Instance Actors in Actor Database [int]

[*]Previous Maximum Number of Slots [int]

  • When saving, these two values should probably also be saved, to check if the bounds in the plugin options have increased or decreased between saves, and handle any issues accordingly.




Functions:

  • Initialize Plugin


    Run on first startup, when not loading from save
  • Check if Is Initialized is true. If not:

    Initialize "Removed Actors Array" by Pushing numbers from "Starting Index Number for Instance Actors in Actor Database" to ("Starting Index Number for Instance Actors in Actor Database + Maximum Number of Slots) - 1

    This means that if you set your Starting Index to 5 and Max Slots to 5, you'd have an array of [ 5, 6, 7, 8, 9]

[*]set "Is Initialized" to true.
 



[*]Add Actor (Parent ID Number)

  • If there are values in the Empty Slots Array:

    Pop the first value from Removed Actors to a variable called "Insertion Point."
  • Call: Insert Actor (Parent ID Number, Insertion Point)

[*]If not, return some value so you can handle this (for instance, telling users that they have no available spaces in their party.)




  • Remove Actor (Actor ID Number)


    Do whatever functions are required to remove the actor from UIs
  • Push the Actor ID Number into the Empty Slots Array,
  • Notice that you don't actually DELETE the actor. You're just flagging it to be overwritten.



  • Insert Actor (Parent ID Number, Insertion Point)


    Copy the data from the Actors Database at the Parent ID Number, creating a duplicate of our Template Actor
  • Insert the duplicate data into the Actors Database at the Insertion Point.
  • By splitting this from Add Actor checks, you can allow for things like Pokemon-style evolution.




Then some kind of Plugin Commands for each of the three functions, and save the Internal Variables somewhere. You would also probably need some functionality in the Load/Save functions to perform cleanup in case the Starting Index/Maximum Slots change, such as looping through the Empty Slots and splicing out those that no longer exist, or adding them if the bounds have increased.


The concept being that you will be overwriting the same set of slots by the oldest "Removed" actor, recycling the same slots in the database. Since you'd never be deleting any values from the built-in Actor Database, only overwriting, you might not run into issues of deleted things still being needed, especially since only actors long since removed from play are overwritten. You would also have a controlled selection of available slots, so you wouldn't run into any issues with memory storage growing out of control. And since the slots that are "removed" are controlled by the plugin, that would mean that Parent actors would never be deleted accidentally, as well.


The plugin commands would also allow for you to easily create menu options to release party members, or even options to sell them. The idea of removed actors still being in memory might open up some other interesting ideas, too, such as having monsters you released show up as NPCs or as ghosts, or being able to buy them back, depending on what further extension plugins were created.

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,049
Messages
1,018,547
Members
137,835
Latest member
yetisteven
Top