anim cant & anim jumpcant

Mr.Q!

Well-known member
Well, just made this animation with:
energycost 25 1 0

And also made this Anim Cant, so it could be played whenever my character is out of mp, but it's not coming out for some reason. Is it still working on latest ver. 3.xx?

Does Anim Jumpcant works the same way but for characters that are using Energycost while jumping moves, right?
 
Well, just made this animation with:
energycost 25 1 0

And also made this Anim Cant, so it could be played whenever my character is out of mp, but it's not coming out for some reason. Is it still working on latest ver. 3.xx?

Does Anim Jumpcant works the same way but for characters that are using Energycost while jumping moves, right?

Cant does not work in 3.0, it was fixed in 4.0. Jumpcant is indeed a cant for mid air, and IIRC it does work.

DC
 
You can use a script for that:
C-like:
void mpcostAnim(int MCost, void Ani)
{// Spend some MP with the desired value. If MP is less than the cost, changes to a desired animation.
// Douglas Baldan / O Ilusionista - 12.01.2018
void self = getlocalvar("self"); // get self
void MPower = getentityproperty(self,"mp"); //get mp
    if (MPower>MCost){ // if MP is greater than the cost
    changeentityproperty(self, "mp", MPower-MCost);//consume mp
    } else {
    performattack(self, openborconstant(Ani));    // change to the desired animation
    }
}

usage (put this on the freespecial you want to cancel)

@cmd mpcostAnim 20 "ANI_CANT"
 
Dang, any solution to this?

There is, but it's a bit involved. You pretty much have to ditch using the native energy system entirely and roll your own. You set up 0 energycost for everything so the native engine lets in play. Then at the start of the special, you have a function that either takes the energy, or if there's not enough, plays another animation (presumably CANT).

C:
/*
* Caskey, Damon V.
* 2025-12-03
*/
void dc_energy_check(int energy_cost, int fail_animation){
    #define DC_ENERGY_CHECK_RESET_ENABLE 1
    
    /* Gaurds - Forces correct and valid types. */
    if(typeof(current_energy) != openborconstant("VT_INTEGER")
        || typeof(fail_animation) != openborconstant("VT_INTEGER")) {
        shutdown("\n\n ERROR: dc_energy_check(" + energy_cost + ", " + fail_animation + ") - Missing or invalid argument.\n\n");
    }

    /* Get acting entity and current energy. */
    void acting_entity = getlocalvar("self");
    int current_energy = getentityproperty(acting_entity, "mp");   


    /*
    * If we can pay the energycost, deduct
    * it from current energy. Otherwise,
    * play fail animation if valid, or   
    * go back to idle.
    */
    if(current_energy >= energy_cost){

        int new_energy = current_energy - energy_cost;
        changeentityproperty(acting_entity, "mp", new_energy);

    } else {

        /* Verify we have a valid fail animation. */
        int animation_valid = getentityproperty(acting_entity, "animvalid", fail_animation);

        if(animation_valid){
            executeanimation(acting_entity, fail_animation, DC_ENERGY_CHECK_RESET_ENABLE);
        } else {
            shutdown("\n\n ERROR: dc_energy_check(" + energy_cost + ", " + fail_animation + ") - Invalid fail animation.\n\n");
        }
    }

    #undef DC_ENERGY_CHECK_RESET_ENABLE
}

Call it in first frame of the special animation:

Code:
@cmd dc_energy_check 5 openborcosntant("ANI_CANT")
frame data/chars/blah/blah/image_0.png

HTH,
DC
 
I am currently using 4.0 and anim cant is not functioning


anim cant

@cmd clearL

loop 0

delay 5

offset 80 129

bbox.position.x 68

bbox.position.y 83

bbox.size.x 24

bbox.size.y 44

@cmd Pause 0

sound data/sounds/error.wav


frame data/chars/1jimmy/pain03.gif



I have also tried it without th @cmd as well no luck, any thoughts?
 
Back
Top Bottom