mp I have a question.

DD Tokki

Well-known member
C:
anim    freespecial1
    loop    0
    delay    1
    offset    28 109
    @cmd    checkPal2    "ANI_follow31" 5
    @cmd    checkPal2    "ANI_follow51" 9
    frame    data/sprites/sprite/chara/scorpion/idle-01.gif
    @cmd    anichange "ANI_FOLLOW1"
    frame    none

anim    follow
    loop    0
    energycost    30 1 0
    nokill    1
    delay    14
    offset    32 109
    bbox    4 0 45 105
    @cmd    degravity    -0.5
    frame    data/sprites/sprite/chara/scorpion/skill-a01.gif
    delay    4
    offset    27 95
    bbox    12 0 45 91
    frame    data/sprites/sprite/chara/scorpion/skill-a02.gif
    delay    2
    offset    27 83
    bbox    39 0 45 79
    sound    data/sounds/se/scorpion/se-sk1.wav
    attack3    127 4 30 30 20 0 0 0 0 20
    hitflash    flash-ken
    hitfx    data/sounds/se/misc/flash-ken1.wav
    dropv    2.4 1 0
    followanim    7
    followcond    2
    forcedirection    -1
    frame    data/sprites/sprite/chara/scorpion/skill-a03.gif
    @cmd    anichange "ANI_FOLLOW2"
    frame    none

KoR - 0070.png

The photo shows the Scorpion firing Get Over Here. The problem is that I created a conditional branch in "freespecial" and connected it to "follow" below and applied "energycost", but mp does not decrease. I want to create an MP that can be used at any time.

I tried using "@cmd mpgain" but it reduces mp and doesn't stop the attack.
 
Last edited:
C:
void mpcost( int Cost)
{// Spend some MP
    void self = getlocalvar("self");
    void MP = getentityproperty(self,"mp");

    changeentityproperty(self, "mp", MP-Cost); //Spend!
}

You can spend MP anywhere with this script.
However, even when the number reaches 0, the attack does not stop.
 
C:
void mpcost(int Cost)
{// Spend some MP
    void self = getlocalvar("self");
    void MP = getentityproperty(self,"mp");

    changeentityproperty(self, "mp", MP-Cost); //Spend!
}

C:
void limiter(int Limit)
{// Prevents hero from performing the animation if his/her MP is less than Limit
    void self = getlocalvar("self");
    void MP = getentityproperty(self,"mp"); //Get entity's MP.

   if(MP<=Limit) // Don't have enough MP?
   {
     executeanimation(self, openborconstant("ANI_follow999")); //Don't play the animation.
   }
}

C:
anim    freespecial1
    loop    0
    delay    1
    offset    28 109
    @cmd    checkPal2    "ANI_FOLLOW31" 5
    @cmd    checkPal2    "ANI_FOLLOW51" 9
    frame    data/sprites/sprite/chara/scorpion/idle-01.gif
    @cmd    anichange "ANI_FOLLOW1"
    frame    none

anim    follow
    loop    0
    @cmd    limiter    39
    @cmd    mpcost    40
    nokill    1
    delay    14
    offset    32 109
    bbox    4 0 45 105
    @cmd    degravity    -0.5
    frame    data/sprites/sprite/chara/scorpion/skill-a01.gif
    delay    4
    offset    27 95
    bbox    12 0 45 91
    frame    data/sprites/sprite/chara/scorpion/skill-a02.gif
    delay    2
    offset    27 83
    bbox    39 0 45 79
    sound    data/sounds/se/scorpion/se-sk1.wav
    attack3    127 4 30 30 20 0 0 0 0 20
    hitflash    flash-ken
    hitfx    data/sounds/se/misc/flash-ken1.wav
    dropv    2.4 1 0
    followanim    7
    followcond    2
    forcedirection    -1
    frame    data/sprites/sprite/chara/scorpion/skill-a03.gif
    @cmd    anichange "ANI_FOLLOW2"
    frame    none

First of all, by using the limiter and mpcost script together,
It has also been implemented that mp is consumed even in non-freespecials and attacks are stopped due to limiters. But since I just made it, I would like to know if there is a better way.
 
View attachment 8325

The reason for not specifying energycost in freespecial is
This is because we make freespecial a branch point of follow and make each follow play the role of freespecial.
I did some tests using the @O Ilusionista idea as a base, you can use 3 freespecials in sequence each with its own energycost. Then, the priority will be automatically changed according to mp remaining and animation order, but configuring the header to use the same button for all of them.

C:
com a2    freespecial3
com a2    freespecial4
com a2    freespecial5

C:
anim freespecial3 #RAGE1
    fastattack 1
    jugglecost 0
    forcedirection -1
    otg 1
    energycost 15 1 6
    loop    0
    delay    20
    offset    62 125
    frame    data/chars/heroes/axel/sor3/rage00.png

anim freespecial4 #RAGE2
    fastattack 1
    jugglecost 0
    forcedirection -1
    otg 1
    energycost 10 1 6
    loop    0
    delay    20
    offset    62 125
    frame    data/chars/heroes/axel/sor3/runatk01.png

anim freespecial5 #RAGE3
    fastattack 1
    jugglecost 0
    forcedirection -1
    otg 1
    energycost 5 1 6
    loop    0
    delay    20
    offset    62 125
    frame    data/chars/heroes/axel/sor3/block00.png
 
I did some tests using the @O Ilusionista idea as a base, you can use 3 freespecials in sequence each with its own energycost. Then, the priority will be automatically changed according to mp remaining and animation order, but configuring the header to use the same button for all of them.

C:
com a2    freespecial3
com a2    freespecial4
com a2    freespecial5

C:
anim freespecial3 #RAGE1
    fastattack 1
    jugglecost 0
    forcedirection -1
    otg 1
    energycost 15 1 6
    loop    0
    delay    20
    offset    62 125
    frame    data/chars/heroes/axel/sor3/rage00.png

anim freespecial4 #RAGE2
    fastattack 1
    jugglecost 0
    forcedirection -1
    otg 1
    energycost 10 1 6
    loop    0
    delay    20
    offset    62 125
    frame    data/chars/heroes/axel/sor3/runatk01.png

anim freespecial5 #RAGE3
    fastattack 1
    jugglecost 0
    forcedirection -1
    otg 1
    energycost 5 1 6
    loop    0
    delay    20
    offset    62 125
    frame    data/chars/heroes/axel/sor3/block00.png
I didn't use those special attacks in order.
It's the same freespecial, but the attack presentation has changed due to the palette script.

It's the same command technique, but the color changes and the attack changes.
 
I didn't use those special attacks in order.
It's the same freespecial, but the attack presentation has changed due to the palette script.

It's the same command technique, but the color changes and the attack changes.
com a2 freespecial3
com a2 freespecial4
com a2 freespecial5

I missed this. I'll give it a try.
 
Yes, in this case the same button will trigger all the 3 freespecial, but I recommend to put the cost order from the higher to the lower. This way the engine will try to perform the mp cost of 40 then 34 then 30.

As shown in the video, the attack called A has different presentation depending on the palette. At first, this used the same amount of MP, but we plan to change the amount of MP consumption depending on the direction.

Although the color is different, it is an attack with the same command mode.

1718767657026.png
 
Last edited:

As shown in the video, the attack called A has different presentation depending on the palette. At first, this used the same amount of MP, but we plan to change the amount of MP consumption depending on the direction.

Although the color is different, it is an attack with the same command mode.
If the energycost method does not work, I suggest applying a fully scripted solution based on keyscripts. This way you will have full control of any behaviour involving key presses, mp and palette.

C:
if(playerkeys(iPIndex, 1, "attack2") && mp >= 40 && palette == 1){
    performattack(self, openborconstant("ANI_FOLLOW1"), 0);
}
 
If the energycost method does not work, I suggest applying a fully scripted solution based on keyscripts. This way you will have full control of any behaviour involving key presses, mp and palette.

C:
if(playerkeys(iPIndex, 1, "attack2") && mp >= 40 && palette == 1){
    performattack(self, openborconstant("ANI_FOLLOW1"), 0);
}
Can you give me an example of applying this script?
 
The example is the same I posted before, you only need to get the mp and palette. You must call it in the character header like this:
C:
void main()
{
    void self      = getlocalvar("self");
    void vAniID  = getentityproperty(self,"animationID");
    int iPIndex  = getlocalvar("player");

    if(playerkeys(iPIndex, 1, "attack2") && mp >= 30 && palette == 5){
        performattack(self, openborconstant("ANI_FOLLOW31"), 0);
      }
}


There is no key script in King of Rage.
I applied what I worked on in Mega Man, but the game doesn't run.
 
C:
void main()
{
    void self      = getlocalvar("self");
    void vAniID  = getentityproperty(self,"animationID");
    int iPIndex  = getlocalvar("player");

    if(playerkeys(iPIndex, 1, "attack2") && mp >= 30 && palette == 5){
        performattack(self, openborconstant("ANI_FOLLOW31"), 0);
      }
}


There is no key script in King of Rage.
I applied what I worked on in Mega Man, but the game doesn't run.

Something like this:

C:
void main()
{
    void self    = getlocalvar("self");
    void vAniID    = getentityproperty(self,"animationID");
    int iPIndex    = getlocalvar("player");
    int mp        = getentityproperty(self,"mp");
    int palette    = getentityproperty(self,"map");

    if(playerkeys(iPIndex, 1, "attack2") && mp >= 30 && palette == 5){
        if(vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK")){
            performattack(self, openborconstant("ANI_FOLLOW31"), 1);
        }
    }
}
 
Something like this:

C:
void main()
{
    void self    = getlocalvar("self");
    void vAniID    = getentityproperty(self,"animationID");
    int iPIndex    = getlocalvar("player");
    int mp        = getentityproperty(self,"mp");
    int palette    = getentityproperty(self,"map");

    if(playerkeys(iPIndex, 1, "attack2") && mp >= 30 && palette == 5){
        if(vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK")){
            performattack(self, openborconstant("ANI_FOLLOW31"), 1);
        }
    }
}
Applied. Although the behavior has changed with palette detection in the script.
MP does not decrease.
 
Applied. Although the behavior has changed with palette detection in the script.
MP does not decrease.
You need to mix the mpcost script into the keyscript in order to subtract the value before the animation changes, like this:

C:
void main()
{
    void self    = getlocalvar("self");
    void vAniID    = getentityproperty(self,"animationID");
    int iPIndex    = getlocalvar("player");
    int mp        = getentityproperty(self,"mp");
    int palette    = getentityproperty(self,"map");
    int cost        = 30;

    if(playerkeys(iPIndex, 1, "attack2") && mp >= cost && palette == 5){
        if(vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK")){
            changeentityproperty(self, "mp", mp-cost); //Spend!
            performattack(self, openborconstant("ANI_FOLLOW31"), 1);
        }
    }
}
 
You need to mix the mpcost script into the keyscript in order to subtract the value before the animation changes, like this:

C:
void main()
{
    void self    = getlocalvar("self");
    void vAniID    = getentityproperty(self,"animationID");
    int iPIndex    = getlocalvar("player");
    int mp        = getentityproperty(self,"mp");
    int palette    = getentityproperty(self,"map");
    int cost        = 30;

    if(playerkeys(iPIndex, 1, "attack2") && mp >= cost && palette == 5){
        if(vAniID == openborconstant("ANI_IDLE") || vAniID == openborconstant("ANI_WALK")){
            changeentityproperty(self, "mp", mp-cost); //Spend!
            performattack(self, openborconstant("ANI_FOLLOW31"), 1);
        }
    }
}
Thank you. MP is now consumed properly.
Lastly, there is an issue where pressing the button quickly causes the attack to blend in with the existing attack.
 
Lastly, there is an issue where pressing the button quickly causes the attack to blend in with the existing attack.
I think it's due to the "resetable" flag in the performattack function. I suggest to remove or change it to 0.

C:
performattack(self, openborconstant("ANI_FOLLOW31"), 0);
 
I think it's due to the "resetable" flag in the performattack function. I suggest to remove or change it to 0.

C:
performattack(self, openborconstant("ANI_FOLLOW31"), 0);
C:
anim    freespecial1
    loop    0
    @cmd    checkPal2    "ANI_FOLLOW31" 5
    energycost    40 1 0   
    nokill    1
    delay    14
    offset    32 109
    bbox    4 0 45 105
    @cmd    degravity    -0.5
    @cmd    stop
    frame    data/sprites/sprite/chara/scorpion/skill-a01.gif
    delay    4
    offset    27 95
    bbox    12 0 45 91
    frame    data/sprites/sprite/chara/scorpion/skill-a02.gif
    delay    2
    offset    27 83
    bbox    39 0 45 79
    sound    data/sounds/se/scorpion/se-sk1.wav
    attack3    127 4 30 30 20 0 0 0 0 20
    hitflash    flash-ken
    hitfx    data/sounds/se/misc/flash-ken1.wav
    dropv    2.4 1 0
    followanim    6
    followcond    2
    forcedirection    -1
    frame    data/sprites/sprite/chara/scorpion/skill-a03.gif
    @cmd    anichange "ANI_FOLLOW1"
    frame    none

Even if it is set to 0, the attack will still occur.
"@cmd checkPal2 "ANI_FOLLOW31" 5"
I put it in freespecial1 to bypass it depending on the color.

Since MP is not consumed alone, I tried to solidify the change in attack using the "checkPal" script and "Key" script you provided.
 
Back
Top Bottom