I have a bit of code here where to turn on a certain function I type for the Plugin Command
WeightSystemOn Actor
This lets me change the TP of the actor with other plugin commands. I then get the error which is TypeError: Cannot property 'IsActor' of null the line is in the else portion if (actor.isActor()) { which refers the line in the second code if (command === 'WeightSystemOn') this.switchWeightSystem(true, args); I believe I am getting the error because the Actors name has spacing its Celina Smokes any help would be great. Would I be able to set it to go by Actor ID instead of the name?
WeightSystemOn Actor
This lets me change the TP of the actor with other plugin commands. I then get the error which is TypeError: Cannot property 'IsActor' of null the line is in the else portion if (actor.isActor()) { which refers the line in the second code if (command === 'WeightSystemOn') this.switchWeightSystem(true, args); I believe I am getting the error because the Actors name has spacing its Celina Smokes any help would be great. Would I be able to set it to go by Actor ID instead of the name?
Code:
Game_Interpreter.prototype.switchWeightSystem = function (flag, args) {
var actorName = args[0];
var actorId = 0;
if (actorName === 'player')
actorId = $gameParty.leader().actorId();
else
actorId = WeightManager.findActorIdByName(actorName);
var actor = $gameActors.actor(actorId);
if (actor.isActor()) {
if (flag) actor.weightSystemOn();
else actor.weightSystemOff();
}
}
Code:
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'SetWeight') this.setWeight(args);
if (command === 'SetWeightType') this.setWeightType(args);
if (command === 'WeightSystemOn') this.switchWeightSystem(true, args);
if (command === 'WeightSystemOff') this.switchWeightSystem(false, args);
};