A long time ago Dee mentioned that he was writing an article on how to create a health meter. I haven't seen nor heard anything about this article, so I'm not sure if it has been published and I missed the announcement, or if it has been shelved for the time being. Anyways this subject was recently brought up on the #coldstone channel, and here is my thinking on how this could be done:
Short version: Create a timer that loops quickly, and each iteration have it check the player's health/magic/whatever you are wanting to meter. As it decreases/increases either A) change the player icon which has a meter placed on it(which would necessitate a whole lot of pictures) or place a stamp on the character(with a frame offset so it appears on the side of the character).
Long version:
-
Ceate a timer using animations (a detailed explaination can be found on the (url="http://"http://stark.evula.net/plugin_faq.htm")How-to write a PoG plug-in(/url) page that I made under the (url="http://"http://stark.evula.net/plugin_faq.htm#tiptimer")timer tip(/url) section). I would recommend a 3 frame animation, with the 1st frame being a marker and the 3rd frame set to loop back to the first frame. Set each frame to be 1 (or 0 if it is possible). The 2nd frame would call the meter event.
-
Create a number of meter pictures. If you want 4 variations(100%, 75%, 50%, 25%), more, less, different colors... it doesn't matter. Just create the pictures that you want and give them an offset so that if they are placed on the ActualX/Y coordinates of the player then they will appear on the side of the character(or above him) and not over top.
-
Create an event that does the following(using health for illustrative purposes):
- Removes the stamp "health_meter"
- Checks the player's health
- Places a stamp based on the player's health (through a conditional) named "health_meter"
NOTE: Remember that stamp names do not have to be unique. Since stamp's are placed and named "on the fly," you can have 15 "stamp control" event objects in your linked actions event list and everything will be fine. When the stamp control event is called the stamp is placed and given the name you assign to it. And since in the above event we first remove the stamp and then place 1 stamp based on a conditional, we should not run into any problems.
ADDITIONAL NOTE: The continual stamp removal/placement is necessary since otherwise the player would be able to move and the meter would be left behind. The trick would be to make the meter update fast enough so that when the player moves the stamp "moves" with him, unless there is a way to attach a stamp to the icon which I am unaware of...
ALTERNATELY: If you wish to use player icons... The first step is the same, but then:
-
Create a load of player icons. You will need 1 complete set of icons for each meter reading(ie, a walk e full health, an attack e full health, a walk sw quarter health, an attack sw quarter health, etc).
-
Create 2 globals: &&gb;_player_health_icon, &&gb;_player_health_status
-
Create an event that does the following(using health for illustrative purposes):
- Checks the player's health
- Assigns a value to &&gb;_player_health_status based on his health condition(full, half, etc. Whatever your meter readings are going to indicate).
- Check the value of &&gb;_player_health_status against &&gb;_player_health_icon. If they are the same value then end the event. If not, continue.
- Set the player icon to the meter icon based on a conditional check of &&gb;_player_health_status
- Set &&gb;_player_health_icon to be equal to &&gb;_player_health_status
My thinking on the above is that either method would probably be fairly memory/processor intensive. It would mean global checks are constantly being done, and pictures are constantly being modified(either the icon or a stamp). On an older system this would probably run pretty slowly.
Also, if you intended to have more than 1 meter(ie, a health and a magic meter) then the stamp method would be best. Using the player icon method would exponentially increase the amount of pictures you would need(ie. a walk w full health full mana, a walk w full health quarter mana, etc).
Again, I'm not sure what Dee was thinking or planning with his article. But this is what I've come up with. It is all based on theory, not application, but it certainly should work(sounds plausible, heh).
Any questions? Critiques? Ways to make it better?
(edit) Fixed a bad UBB call. Bad UBB! (/edit)
------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) now on (url="http://"http://www.evula.net")EVula.net(/url)
(This message has been edited by Stark Bledfast (edited 10-15-2002).)