Hi,
iv'e implemented a health bar that reflects the players health whenever fighting an opponent. I use this same health bar when fighting each opponent.
However, I need for the health bar to retain it's level for each opponent.
EG Fighting Daddy D and losing some health if I go to the next opponent my health is returned to full. Now, if I go back to Daddy D I need to have my health bar restored to where it was before I left Daddy D previously and for each opponent.
Although I may stick to what I have....
Solutions appreciated though.
cheers
I don't know much about health bars, but how did you code it?
You probably want a global int variable that you can add/subtract point from, and then display it's value as the player's health.
I also seem to remember to ave read about health bars here in the forum in the last six months, so I would suggest a search for it. ;)
Do you mean a separate health bar level for each opponent? In that case, have an array in a custom/global script and export it for global access (if you need it) - each array entry starts with the player's max health, but you can call it to set a health bar value.
So:
In GlobalScript (or another custome script).asc
#define MaxHP 100 //The player's initial HP for each fight
int HP[30]; //if you have say 30 opponents
function game_start(){ //Assign each array value to the max HP
int i;
while(i<30){
HP[i] = MaxHP;
i++
}
}
//At the end of the script:
export HP;
In GlobalScript (or your own script).ash:
import int HP[30];
Then whenever you want to assign your health bar value at the (re)start of a fight:
HealthBarValue = HP[X]; //Where X is whatever 'slot' you want that particular enemy to take up
There are ways of automating this a bit more - if your enemies have a character ID of 1-30 (with the player having an ID of 0) then the above line could be:
//somewhere
Character *challenger = cDaddyD
//elsewhere
HealthBarValue = HP[challenger.ID-1]; //Subtract 1 since the array indexes go from 0-29
Hope that helps :)
Cheers geork,
I will bear that in mind for reference (nod)
cheers