Request: Actor Clone from Template

Hi,

The plan I had in mind was to populate my database with a few template characters, then have a way to create copies of them which can be added to the party several times, sort of like a generic mercenary hiring system. Currently it seems only one of any actor may exist at any given time which works fine for more important characters but less so for that disposable grunt you want to drag around with you. I suppose the concept works well for a variety of means as being able to clone a template means you can also personalise your copy with a bit of variety for stats or names. Though no doubt this will inspire some monster taming themes, an army of your favourite pest collection is always a fun goal.

Here is how far I got with my approach using the console:

  • Located $gameActors._data, picked an actor to use as a template such as $gameActors._data[2]
  • Attempted to copy this information to a new entry by $gameActors._data[$gameActors._data.length] = $gameActors._data[2]
  • Took a look at $gameActor._data[5] to see if it worked, with 5 being the newly created Actor.
  • Then I try to add the actor to the party by $gameParty.addActors(5).
  • Suddenly confronted with TypeError: Cannot read property 'isAlive' of null, the console then proceeds to throw various location of js files to read.
  • I try again with a pre-existing actor, $gameParty.addActor(4) which worked fine, suggesting the problem is the new actor not how I was trying to add to party.
I've been trying my hand at working this out myself but frankly it's a bit beyond my current experience. Only been trying out JS for a few weeks so I'm still very inefficient with it, hopefully someone a bit more fluent can create something functional that others would be able to use too.

Thanks for taking the time to read!

Original thread: https://forums.rpgmakerweb.com/threads/request-actor-clone-from-template.47042/