//=============================================================================
// Plugin compatibility for Random Human Enemies - MZ
//=============================================================================
/*:
* @target MZ
* @plugindesc [Rpg Maker MZ] [Version 0.5] This plugin is to use random generated characters as enemy battlers. Visustella BattleCore and MMP_CharacterMake needed.
* @url
https://waldorf.itch.io/
* @target MZ
* @author RPGWaldorf
* @help How to use:
1) Add Visustella BattleCore to your game
--NOTE: CoreEngine is NOT strictly needed--
--On the contrary, it's not compatible with a function you may or may not use of the MMP plugin (Displaying generated characters on map)--
Add MPP_CharacterMake and MPP_CharacterMakeOp1 too -
https://woodpenguin....racterMake.html
Add this plugin under those two.
2) Add the "generator" folder with generation parts in your game folder root
You can copy it from the installation folder of RPG Maker MZ
Playtest the game once (and after every generator folder change) to allow the plugin to elaborate datas
3) Generate Characters:
You need to save them on Actor indexes, keep a few empty.
Method 1:Generate them with MPP_CharacterMake plugin commands:
-First, use the first command to select its category (parameter 1: ActorId. Parameter 2: Gender)
-Then use the last command to randomly generate it (Parameter 1: ActorId)
(But if too many appears in battle at once it might lag while it loads)
Method 2: You can preload them with the plugin command of this plugin.
-It's still suggested you don't preload many of them at once.
NOTE: after closing the game, the character is still saved, but the preloaded one isn't.
So you can use it again, even if it falls under the previous option.
4) Make them appear in battle!
Use the tag on the enemy
Where "ID" is the Actor id where you generated the character.
*
* @command Preload Human Enemies
* @desc Generates characters in actor slots 11+.
* @arg actorSlotId
* @text Actor Slot ID
* @type number
* @default 11
* @desc Actor slot from where start the character generation
* @arg number
* @text Quantity
* @type number
* @default 4
* @desc Number of character battlers to generate
* */
(function() {
const pluginName = "RandomHumanEnemies";
var tempPreloadEnemyHuman = [];
PluginManager.registerCommand(pluginName, "Preload Human Enemies", args => {
var number = parseInt(args["number"]);
var actorId = parseInt(args["actorSlotId"]);
var genderValues = ["Male", "Female", "Kid"/*, "MaleMV", "FemaleMV", "KidMV"*/]; //you can add more categories there and
for (let id = actorId; id < actorId + number; id++) {
//Chooses a random category between Male, Female, Kid.
var randomGender = genderValues[Math.floor(Math.random() * genderValues.length)];
//Calls the MPP plugin
PluginManager.callCommand(
$gameMap._interpreter,
"MPP_CharacterMake",
"setActorKind",
{ actorId: id, kind: randomGender}
);
PluginManager.callCommand(
$gameMap._interpreter,
"MPP_CharacterMake",
"Op1:changePartsRandom",
{ actorId: id }
);
//saves the generated character in a variable
tempPreloadEnemyHuman[id] = ImageManager.loadGeneratorBitmap($gameActors.actor(id)._geneBattlerName, 'SV');
}
});
//feeds the preloaded character into Visustella. Uses aliases, so it doesn't ovverride.
const _ImageManager_loadSvActor = ImageManager.loadSvActor;
ImageManager.loadSvActor = function(filename) {
if(/^MppGeneSV/.test(filename)){
return this.loadGeneratorBitmap(filename, 'SV');
} else{
if(filename.startsWith("&")){
if(tempPreloadEnemyHuman[parseInt(filename.substring(1))] !== undefined){
//method that uses the preloaded characters
return tempPreloadEnemyHuman[parseInt(filename.substring(1))]
} else{
//method that loads them all at onece on battle start, but lags while it loads.
return this.loadGeneratorBitmap($gameActors.actor(parseInt(filename.substring(1)))._geneBattlerName, 'SV');
}
} else {
return _ImageManager_loadSvActor.apply(this, arguments);
}
}
};
})();