I found a plugin that I really like that lets you display the HP bar on the map outside of battles. It fits in super well with my game and I can't find another plugin that works as well as this one does, but the creator of the plugin neglected to add the ability to hide it with an event when it's not needed. If anyone is good at coding, can you please write out the code I would need to add to the plugin to make this feature possible and tell me where in the code to put it? I'm not new to game design, but I am new to coding, so this would really help me out a lot. Thanks a bunch in advance!
This is the author of the plugin:
https://forums.rpgmakerweb.com/index.php?members/mrcopra.66846/
And here's the code I need edited:
/*:
* @plugindesc HealthBar
* @author mrcopra
*
* @Help
*
*/
(function() {
//////////////////////////////////////////////////////////////////////////////////////
var _Scene_Map_start = Scene_Map.prototype.start;
Scene_Map.prototype.start = function() {
_Scene_Map_start.call(this);
this._myWindow = new My_Window(100,100);
this.addWindow(this._myWindow);
};
var _Scene_Map_update = Scene_Map.prototype.update;
Scene_Map.prototype.update = function() {
_Scene_Map_update.call(this);
this._myWindow.refresh();
};
function My_Window() {
this.initialize.apply(this, arguments);
}
My_Window.prototype = Object.create(Window_Base.prototype);
My_Window.prototype.constructor = My_Window;
My_Window.prototype.initialize = function(x, y) {
Window_Base.prototype.initialize.call(this, 0, 0, this.windowWidth(), this.windowHeight());
this._value = -1;
this.refresh();
};
My_Window.prototype.refresh = function(){
this.contents.clear();
this.drawActorHp($gameParty.leader(), 0, 0, 200)
};
My_Window.prototype.windowWidth = function(){
return 240;
};
My_Window.prototype.windowHeight = function(){
return 80;
};
///////////////////////////////////////////////////////////////////////////////////////////////
})();
This is the author of the plugin:
https://forums.rpgmakerweb.com/index.php?members/mrcopra.66846/
And here's the code I need edited:
/*:
* @plugindesc HealthBar
* @author mrcopra
*
* @Help
*
*/
(function() {
//////////////////////////////////////////////////////////////////////////////////////
var _Scene_Map_start = Scene_Map.prototype.start;
Scene_Map.prototype.start = function() {
_Scene_Map_start.call(this);
this._myWindow = new My_Window(100,100);
this.addWindow(this._myWindow);
};
var _Scene_Map_update = Scene_Map.prototype.update;
Scene_Map.prototype.update = function() {
_Scene_Map_update.call(this);
this._myWindow.refresh();
};
function My_Window() {
this.initialize.apply(this, arguments);
}
My_Window.prototype = Object.create(Window_Base.prototype);
My_Window.prototype.constructor = My_Window;
My_Window.prototype.initialize = function(x, y) {
Window_Base.prototype.initialize.call(this, 0, 0, this.windowWidth(), this.windowHeight());
this._value = -1;
this.refresh();
};
My_Window.prototype.refresh = function(){
this.contents.clear();
this.drawActorHp($gameParty.leader(), 0, 0, 200)
};
My_Window.prototype.windowWidth = function(){
return 240;
};
My_Window.prototype.windowHeight = function(){
return 80;
};
///////////////////////////////////////////////////////////////////////////////////////////////
})();