Solved Freespecial question: MP amount to activate and another to decrease?

Question that is answered or resolved.

NONAME01150

New member
Basically, is there a way to make the character require a certain amount of mp to do the freespecial but it actually takes away a smaller amount of it? example: 70 mp or bigger to do freespecial8 but takes away 30 mp.
 
Solution
That's why I used script for MP costing freespecials. Script or function to prevent freespecial is seperate from one that spends the MP.
See this example:
Code:
anim    freespecial
    delay    1
    offset    80 90
    frame    data/chars/bard/harp1.png
    delay    8
    @cmd    aniLimit "ANI_CANT" 0 70
    frame    data/chars/bard/harp5.png
    frame    data/chars/bard/harp6.png
    frame    data/chars/bard/harp5.png
    frame    data/chars/bard/harp6.png
    @cmd    mpcost 30
    @cmd    spawn01 "Phoenix" 38 50 0
    frame    data/chars/bard/harp5.png
    frame    data/chars/bard/harp6.png
    frame    data/chars/bard/harp5.png
    frame    data/chars/bard/harp6.png #
    frame    data/chars/bard/harp4.png
    frame...
That's why I used script for MP costing freespecials. Script or function to prevent freespecial is seperate from one that spends the MP.
See this example:
Code:
anim    freespecial
    delay    1
    offset    80 90
    frame    data/chars/bard/harp1.png
    delay    8
    @cmd    aniLimit "ANI_CANT" 0 70
    frame    data/chars/bard/harp5.png
    frame    data/chars/bard/harp6.png
    frame    data/chars/bard/harp5.png
    frame    data/chars/bard/harp6.png
    @cmd    mpcost 30
    @cmd    spawn01 "Phoenix" 38 50 0
    frame    data/chars/bard/harp5.png
    frame    data/chars/bard/harp6.png
    frame    data/chars/bard/harp5.png
    frame    data/chars/bard/harp6.png #
    frame    data/chars/bard/harp4.png
    frame    data/chars/bard/harp3.png
    frame    data/chars/bard/harp2.png
    frame    data/chars/bard/harp1.png
    frame    data/chars/bard/select3.png

In this example, this animation has aniLimit function which changes animation to CANT animation if MP is less than 70 IOW prevent performing the animation if MP is not enough. That function doesn't do the MP spending. Instead mpcost function does the MP spending.

Here are both functions:
C:
void mpcost(int Cost)
{// Spend some MP
    void self = getlocalvar("self");
    int MP = getentityproperty(self,"mp");

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

void aniLimit(void Ani, int Frame, int Limit)
{// Change current animation if MP falls below limit
    void self = getlocalvar("self");
    void MP = getentityproperty(self,"mp");   

    if (MP < Limit){
      changeentityproperty(self, "animation", openborconstant(Ani),2);
      updateframe(self, Frame);
    }
}

Do you know how to use animation script?
 
Solution
void mpgain(int Gain)
{// Spend some MP
void self = getlocalvar("self");
int MP = getentityproperty(self,"mp");

changeentityproperty(self, "mp", MP+Gain); //Gain!
}

Hey I figured it out, my first script ever lol (there might be a more universally used one out there)
 
Back
Top Bottom