Last active
June 20, 2018 08:29
-
-
Save rghavlin/338a5f417ccc336a554cedea3322b47d to your computer and use it in GitHub Desktop.
RPG Maker MV plugin which allows you to store an actor id in a variable then allow player to change the name of that actor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//============================================================================= | |
// inputCustomName.js | |
//============================================================================= | |
/*: | |
* @plugindesc Set a variable to any actor Id and allow player to change the name of that actor | |
* @author robhav | |
* | |
* @param Actor Id Variable | |
* @desc Number of Variable where the actor Id is stored for actor to be renamed | |
* @default 1 | |
* | |
* @param Max Name Length | |
* @desc Max length of name entered | |
* @default 1 | |
* | |
* @help | |
* Choose the variable number in the parameters that you will use to store the actor id. | |
* Choose max lenth of name in parameters. | |
* Plugin command to open name input: CustomName | |
* -------------------------------------------------------------------------------- | |
* Terms of Use: | |
* Free for commercial and non-commercial projects. | |
* -------------------------------------------------------------------------------- | |
* Version: 1.0 | |
*/ | |
(function() { | |
var actorVariable = Number(PluginManager.parameters('inputCustomName')['Actor Id Variable']) || 1; | |
var maxLength = Number(PluginManager.parameters('inputCustomName')['Max Name Length']) || 1; | |
var Name_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; | |
Game_Interpreter.prototype.pluginCommand = function(command, args) { | |
Name_Game_Interpreter_pluginCommand.call(this, command, args) | |
if (command === 'CustomName') this.inputCustomName(); | |
}; | |
Game_Interpreter.prototype.inputCustomName = function() { | |
if (!$gameParty.inBattle()) { | |
if ($dataActors[$gameVariables.value(actorVariable)]) { | |
SceneManager.push(Scene_Name); | |
SceneManager.prepareNextScene($gameVariables.value(actorVariable), maxLength); | |
} | |
} | |
return true; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment