Hime-Works / Requests

Bug reports and requests that may require longer discussions and is not suitable to leave on the blog
http://himeworks.com/
GNU General Public License v2.0
7 stars 9 forks source link

Battler health bars #121

Open HimeWorks opened 10 years ago

HimeWorks commented 10 years ago

Simple idea: draw a sprite that represents a health bar. You can do this by drawing two rectangles: one for the bar, the other for the HP. This is trivial since drawing rectangles is built-in functionality (see the Bitmap docs)

Add maybe 5 more lines to Sprite_Battler and Game_Battler hierarchy to enable/disable health bars for specific types of battlers (eg: actors might not need them). You might even enable it for specific enemies only (eg: bosses).

Now, a naive implementation would simply update the health bar on every frame. This has been done in several HP bar implementations.

First, we know that HP doesn't change all the time. If you're waiting for command input, HP doesn't change. If you didn't get hit and is not suffering from poison, HP doesn't change.

Therefore, the battler sprite does not need to update the HP bar if it doesn't change. However, one would need to determine whether your HP has changed or not. This can be done in many ways.

One way is to make alias the hp= method and toggle a flag that will tell the sprite that the HP has changed. However, many people (including the default scripts) access @hp directly to change the value, making it infeasible.

Another way is to determine when HP might change. For example, item_apply might be a good place. You'd have to find all the possible ways that would change a battler's HP, if you don't want to update every single frame. refresh might be a good place as well, since that is called regularly.

Basically, you want to minimize how frequent the calls are made.

rubydragon44 commented 10 years ago

Here is one. http://yanflychannel.wordpress.com/rmvxa/battle-scripts/ace-battle-engine/enemy-hp-bars/ However it requires Yanfly's Battle System. Something that may also be taken into consideration is showing MP and TP or being able to view in detail what states a battler has. http://rmrk.net/index.php?topic=41992.0 Modern Algebra has a state viewer but this is for explaining states, not for going into battle and showing detail of what states the enemy or party member has and then explaining them. Part of strategy is knowing what you're dealing with, be it, knowing as much as you can to outsmart the opponent, or finding ways to guess. Once you learn how much HP an enemy has using like a Beastiary, you can tell what to expect the next time. Visual ques can be used, for example, Victor's State Graphics http://victorscripts.wordpress.com/rpg-maker-vx-ace/utility-scripts/state-graphics/ to know when an enemy is powered up or so, or maybe your enemy change graphic for when they're down. I babble.