maxman
Well-known member
I have an MP that has its max value of 114 for a specific character, and 3 images for MP parts that are for filling to its max. I'd like to fill the diamonds from 0 to 3 as max MP every time the bar increases via King of Fighters 98, but in the way the bar increases like A-ISM that's within 3 levels from the Street Fighter Alpha series, especially part 3. It's a combination of both for a 3-level bar increment. Plus, I use
First, I was using the image 1 (with one diamond) for iconmplow, image 2 (2 diamonds) for iconmphalf, and image 3 (3 full diamonds) for iconmphigh. The good thing was that it displayed image 3 when I started in the beginning. But it turned out when I used all the MP from its max, it reached to image 1 (but not the one without all diamonds) which I didn't realize that its max is the reach of 1/3 of its MP. So, it displayed image 1 when MP is 0. Not only that, but also when you reached 1/3 as its max, image 2 started to display (iconmphalf). When you reach to 2/3 of its max,
In the end, I started not to trust these kinds of setups, so I started to arrange the icon MP setup into this for a better one.
I already created a separate diamond from one of the 3 images and placed it in the sprites folder for reaching its true max number of MP that the player uses. I made one update.c for this MP. What I want is for the last image to display as it reaches to its max, so that it will look like it's filled with all 3 diamonds.
The reason I put the time variant over its MP in the beginning of the game, is that the last diamond image should appear every time the end of the MP bar reaches to its max.
I'm using only a default MP bar for this. If it doesn't work, should I use a scripted MP bar for this? I started to play @Kratus's SOR2X for searching for the way of how the MP is used with stars and when it's all consumed, it disappears until you keep attacking to fill.
Here's a character header just in case.
iconmplow, iconmphalf, and iconmphigh, for increasing to certain parts depending on the max number of MP the player uses.First, I was using the image 1 (with one diamond) for iconmplow, image 2 (2 diamonds) for iconmphalf, and image 3 (3 full diamonds) for iconmphigh. The good thing was that it displayed image 3 when I started in the beginning. But it turned out when I used all the MP from its max, it reached to image 1 (but not the one without all diamonds) which I didn't realize that its max is the reach of 1/3 of its MP. So, it displayed image 1 when MP is 0. Not only that, but also when you reached 1/3 as its max, image 2 started to display (iconmphalf). When you reach to 2/3 of its max,
iconmphigh image displayed. This is the MP setup I tried using.
Code:
icon data/chars/haggar/icon.gif 1
icondie data/chars/haggar/icond.gif 1
iconmplow data/chars/haggar/33.png 1
iconmphalf data/chars/haggar/66.gif 1
iconmphigh data/chars/haggar/full_bar.gif 1
In the end, I started not to trust these kinds of setups, so I started to arrange the icon MP setup into this for a better one.
Code:
icon data/chars/haggar/icon.gif 1
icondie data/chars/haggar/icond.gif 1
iconmplow data/chars/haggar/icon.gif 1 # From level 0 to 1
iconmphalf data/chars/haggar/33.png 1 # From level 1 to 2
iconmphigh data/chars/haggar/66.gif 1 # From level 2 and on
I already created a separate diamond from one of the 3 images and placed it in the sprites folder for reaching its true max number of MP that the player uses. I made one update.c for this MP. What I want is for the last image to display as it reaches to its max, so that it will look like it's filled with all 3 diamonds.
C:
void main(){
playerMP();
}
void playerMP()
{
if(openborvariant("in_level")==1){
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
int P3 = getplayerproperty(2, "entity");
void Diamond = getglobalvar("Diamond");
float time = openborvariant("elapsed_time"); // Current time
float delay = 30;
if(!Diamond){
Diamond = loadsprite("data/sprites/diamond.gif");
setglobalvar("Diamond", Diamond);
}
if(P1){
int MP = getentityproperty(P1, "mp");
int maxMP = getentityproperty(P1, "maxmp");
void ani = getentityproperty(P1, "animationid");
int frame = getentityproperty(P1, "animpos");
if(getentityvar(P1, "playerOne") == NULL()){setentityvar(P1, "playerOne", MP);}
drawstring(20, 190, 1, "Time:_"+time);
if(MP < getentityvar(P1, "playerOne")){ //If HP box smaller than damage box
if(getentityvar(P1, 1) == NULL()){
setentityvar(P1, 1, 0); //Set entity var 1 to zero if null this is a timer
}
setentityvar(P1, 1, getentityvar(P1, 1)+1); //Add 1 to timer; this will run every game tick
if(getentityvar(P1, 1) > 2){ //If timer over 7
setentityvar(P1, "playerOne", getentityvar(P1, "playerOne")-1); //Reduce displayed damage by 1
setentityvar(P1, 1, 0); //Reset timer to zero; this will cause a loop until damage is the same as hp
}
}
drawbox(26, 170, getentityvar(P1, "playerOne")-27, 10, 3999, rgbcolor(100,100,255), 0);
if(time >= 0 && time < 100){
if(MP == maxMP){
setglobalvar("Diamond", NULL());
}
}
if(time >= 100){
if(MP == maxMP){
drawsprite(Diamond, 97, 24, 5000);
}
}
if(ani == openborconstant("ANI_PAIN99")){
if(time >= 0 && time < 300){
if(MP == 76 && MP == maxMP){
setglobalvar("Diamond", NULL());
}
}
if(time >= 300){
if(MP == maxMP){
drawsprite(Diamond, 97, 24, 5000);
}
}
}
/*if(MP == maxMP){ // If MP reaches its max
drawsprite(Diamond, 97, 24, 5000);
}*/
if(MP < maxMP){ // If MP is less than its max MP
setglobalvar("Diamond", NULL());
}
}
if(P2){
int MP2 = getentityproperty(P2, "mp");
int maxMP2 = getentityproperty(P2, "maxmp");
if(MP2 == maxMP2){ // If MP reaches its max
drawsprite(Diamond, 212, 24, 5000);
}
if(MP2 < maxMP2){ // If MP is less than its max MP
setglobalvar("Diamond", NULL());
}
}
if(P3){
int MP3 = getentityproperty(P3, "mp");
int maxMP3 = getentityproperty(P3, "maxmp");
if(MP3 == maxMP3){ // If MP reaches its max
drawsprite(Diamond, 328, 24, 5000);
}
if(MP3 < maxMP3){ // If MP is less than its max MP
setglobalvar("Diamond", NULL());
}
}
}
}
void oncreate()
{
void Diamond;
if(!Diamond){
Diamond = loadsprite("data/sprites/diamond.gif");
setglobalvar("Diamond", Diamond);
}
}
void ondestroy(){
void Diamond = getglobalvar("Diamond");
if(Diamond){
free(Diamond);
setglobalvar("Diamond", NULL());
}
}
The reason I put the time variant over its MP in the beginning of the game, is that the last diamond image should appear every time the end of the MP bar reaches to its max.
I'm using only a default MP bar for this. If it doesn't work, should I use a scripted MP bar for this? I started to play @Kratus's SOR2X for searching for the way of how the MP is used with stars and when it's all consumed, it disappears until you keep attacking to fill.
Here's a character header just in case.
Code:
name Haggar
type player
health 100
mp 114
running 15 2.4 1.8 1 0
nolife 1
speed 7
jumpspeed 10
jumpheight 3
mprate 1.5
grabdistance 24
grabfinish 1
grabback 0
grabwalk 6
antigravity 10
bounce 1
noquake 1
gfxshadow 1
jugglepoints 10
diesound data/chars/haggar/hagg05.wav
flash flash
bflash guard
dust dust2
toflip 1
atchain 1 2 3
makeinv 3 0
falldie 2
riseinv 1 1
antigravity 20
candamage enemy obstacle npc
icon data/chars/haggar/icon.gif 1
icondie data/chars/haggar/icond.gif 1
iconmplow data/chars/haggar/icon.gif 1
iconmphalf data/chars/haggar/33.png 1
iconmphigh data/chars/haggar/66.gif 1
typemp 1 is already set in levels.txt BTW.
Last edited: