Enemy Hp Guage

EnemyBars.js V1.1
Jeremy Cannady


I know that Yanfly is making a script like this but this has been over in the plugins in development board
for weeks and thought I would put it on this forum for feedback.



Introduction
Adds an hp bar to enemies during battle.

Features
Decide which colors you want to represent the hp.

The hp bars will be below the sprites.

Works with Rexal animated battlers.


Screenshots

Spoiler
barsenemy_zpsdomscdqt.png
How to Use
Download the script place in plugins folder.

Make sure the script is named EnemyBars.js
Place the correct note tag in the enemy.

Note tag:

 * Put <hpBar> in the enemy note tag to activate the hp bar for that enemy

 during battle.

 *Put <hpBarSelectionOnly> to actiavte the hp bar only during selection.

 *Put<hpBarTurnASelection> to actiavet he bar during selection and attack.

 *Put <hpBarTurnOnly> to only show the bar during the attack phase.

 *PLEASE PUT ONLY ONE NOTETAG.

Script

http://pastebin.com/mQmZ5Jy0


Credit and Thanks
-Jeremy Cannady

Terms:

Free and unrestricted access for anyone for any purpose.

No credits necessary.
please add terms of use
Nice!  Is it possible to have the bar only visible for a short time when the enemy is taking damage or visible when in target mode?
I can make that a option in the plugin menu.
Great plugin, Jeremy!


I use the custom stuff from Yanfly's plugin; specifically wherein the enemy approaches the heroes when they attack. Is there a way to have the bar move along with the enemy itself whenever the enemy moves anywhere?


Thanks!
Which plugin name is that exactly? I should be able to make it track it easily.
Which plugin name is that exactly? I should be able to make it track it easily.
The commands in either of the three "YEP_ActSeqPack"s has something to do with movement both in heroes and enemies. They contain notetags that when used in the Skills would make either the heroes or enemies move away from their initial position. 🙂
This version doesn't seem to be compatible with Rexal's stable version (v1.12.11) with the YEP corengine attached. I tried it and I got the following: 

TypeError: Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': float parameter 1 is non-finite.    at TypeError (native)    at Bitmap.gradientFillRect (file:///C:/Users/Merryjest/Documents/Games/Grinners%20&%20Losers%20Working/js/rpg_core.js:781:24)    at Enemy_Bars.Window_Base.drawGauge (file:///C:/Users/Merryjest/Documents/Games/Grinners%20&%20Losers%20Working/js/plugins/YEP_CoreEngine.js:1208:19)    at Enemy_Bars.drawBar (file:///C:/Users/Merryjest/Documents/Games/Grinners%20&%20Losers%20Working/js/plugins/EnemyBars.js:110:9)    at Enemy_Bars.update (file:///C:/Users/Merryjest/Documents/Games/Grinners%20&%20Losers%20Working/js/plugins/EnemyBars.js:73:10)    at file:///C:/Users/Merryjest/Documents/Games/Grinners%20&%20Losers%20Working/js/rpg_scenes.js:112:19    at Array.forEach (native)    at Scene_Battle.Scene_Base.updateChildren (file:///C:/Users/Merryjest/Documents/Games/Grinners%20&%20Losers%20Working/js/rpg_scenes.js:110:19)    at Scene_Battle.Scene_Base.update (file:///C:/Users/Merryjest/Documents/Games/Grinners%20&%20Losers%20Working/js/rpg_scenes.js:42:10)    at Scene_Battle.Scene_Base.update (file:///C:/Users/Merryjest/Documents/Games/Grinners%20&%20Losers%20Working/js/plugins/gametime.js:433:30)rpg_managers.js:1618 SceneManager.catchExceptionrpg_managers.js:1579 SceneManager.updateTurning off Rexal's animated battlers v1.12.11 makes everything flow smoothly. I haven't moved up to version 1.15.5.1 because it has a lot of crashing bugs and I'm waiting for the next stable release, but I wanted to let you know that it's currently not compatible with the current stable release. I did some double-checking and ran the HP gauge with just the animated battlers plugin active and the same error ("Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': float parameter 1 is non-finite.") popped up. 

It does works with only the YEP engine   and this plugin active, so the incompatibility occurs when Rexal's v1.12.11 release is present (YEP patch included)
I have been using the unstable current version. I will make a patch for the current stable one if I can.
I'm a big fan of this plugin! Adds a lot of quality to battles, especially boss battles or high HP enemies overall.

My only suggestion would be to add an option between having the bar above or below the enemy sprite. This seems achievable enough by having the choice as a parameter in the plugin menu or as a different notetag like <hpBar2>
Nice!  Is it possible to have the bar only visible for a short time when the enemy is taking damage or visible when in target mode?

I can make that a option in the plugin menu.
I was wondering if you still planned on making this an option?
Oh yeah I just got caught up in making my shop script. 1200 lines of code was not a fun project. I am going to try to look at it today but I think Yanfly is going to release enemy hp bars this weekend. Everyone will use that one so IDK. If anything I will do it just because it is a feature I want as well. I will update later this afternoon. 

Edit: Actually I just tested it and it was really easy to do so I will update it after lunch, that is making it visible during selection. Not sure if you want only visible when selecting the enemy or when damage is being done.
Oh yeah I just got caught up in making my shop script. 1200 lines of code was not a fun project. I am going to try to look at it today but I think Yanfly is going to release enemy hp bars this weekend. Everyone will use that one so IDK. If anything I will do it just because it is a feature I want as well. I will update later this afternoon. 

Edit: Actually I just tested it and it was really easy to do so I will update it after lunch, that is making it visible during selection. Not sure if you want only visible when selecting the enemy or when damage is being done.
Definitely when selecting the enemy, but if it can also be while damage is being done big plus.
Updated to 4 options:

hp bar always visible

hp visible during selecting enemy

hp visible during selection and attack phase

hp only visible during attack phase

Please only put in one note tag.

Let me know if you experience any bugs!
Great! I'll try it out when I get home.  Thanks for circling back around to that.
So I downloaded your current version and the updates from what I was using before are awesome. However I still get issues with Rexals Animated Battlers. I have a fight where I am using a party member as an animated battler. I have them on the other side of the screen, working an everything, but when I turn this plugin on, I get the same error I did with the old version: Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': float parameter 1 is not infinite.

http://imgur.com/A9eogeM

here is my console output.

Didn't scroll through all the posts sorry. Looks like this is a similar report to the one above. I guess I'll just confirm that it does indeed not work with the most stable version of Rexal's.
I think it is because with the party member as an enemy means its not an actual enemy per how the game decides. 
I will have to test it to figure out how to draw the bars on actors or enemies. 

Can you clarify, the enemy is an actor sprite correct? And not the default enemy pictures.
As far as the game is concerned, it's an enemy. You just take an enemy image and rename it to match the actor icon name and the plugin pulls the sprite data. Shouldn't have any other data associated with it.
I would love the option for choosing HP bar above or below enemies, and slightly slimmer bars, because they are very large when compared to your screenshot. Otherwise, love the plugin a lot! 🙂
@ 10kk Those options would be easy to do, at first I had the bars on top but everyone didn't like that. I will just make that an option.

I am just working on getting it to work with the animated battlers script first.

@jungle

It seems to work fine with me:

Spoiler
enemy_zpsy1jrtdr0.png

Original thread: https://forums.rpgmakerweb.com/threads/enemy-hp-guage.50599/