I'm trying to use setTimeOut to do a countdown to change an actors face after a short period. It seems to work if I put in stuff that isn't a variable, for instance if the actor id is 1 - it will work for 1, when I try to make an actor name as a variable I'm greeted with this.
This is the bit of the code that runs the script:
Not sure why it isn't picking them up when they're right inside it. Any help would be appreciated.
This is the bit of the code that runs the script:
Code:
const performDamageFaceChange = Game_Actor.prototype.performDamage
Game_Actor.prototype.performDamage = function() {
Game_Battler.prototype.performDamage.call(this);
performDamageFaceChange.call(this)
actor = this._actorId;
name = (this._faceName + '' + 'Hurt');
index = this._faceIndex;
$gameActors.actor(actor).setFaceImage(name,index);
setTimeout(this.revertFaceImage,500);
};
Game_Actor.prototype.revertFaceImage = function() {
actor = this._actorId;
name = (this._originalFaceName);
index = this._originalFaceIndex;
$gameActors.actor(actor).setFaceImage(name,index);
};
Not sure why it isn't picking them up when they're right inside it. Any help would be appreciated.