(function() {
  namepopplus_scpi = Sprite_Character.prototype.initialize;
  Sprite_Character.prototype.initialize = function(character) {
  namepopplus_scpi.call(this, character);
  this._tempCharacter = character;
  this._tempIsBigCharacter = ImageManager.isBigCharacter(character._characterName);
  if (character instanceof Game_Event) {
    matchreg = /namepop\s*(?:<\s*(\-)?(\d+)\s*,\s*(\-)?(\d+)\s*>)?/i;
    matchres = character.event().note.match(matchreg);
    if (matchres != null) {
      xoffs = (matchres[1] === void 0 ? 1 : -1) * (matchres[2] || 0);
      yoffs = (matchres[3] === void 0 ? 1 : -1) * (matchres[4] || 0);
      this.createNamepopSet(xoffs, yoffs);
    };
  };
};

Sprite_Character.prototype.createNamepopSet = function() {
  var height = this._tempIsBigCharacter ? 2 : 1;
  this._namepopSprite = new Sprite();
  this._namepopSprite.bitmap = new Bitmap(100, 20);
  this._namepopSprite.bitmap.fontSize = 18;
  this._namepopSprite.bitmap.drawText(this._tempCharacter.event().name, 0, 0, 100, 20, 'center');
  this._namepopSprite.anchor.x = 0.5;
  this._namepopSprite.anchor.y = 1;
  this._namepopSprite.x = this.x + arguments[0];
  this._namepopSprite.y = this.y + arguments[1] - height * 48;
  this.addChild(this._namepopSprite);
};

}());