Daimao Cancel System

Tutorial Daimao Cancel System 1.0

No permission to download
What is it?

Daimao Cancel is an advanced cancel system for creating combos that works for all types of entities (player, enemy, npc) and attacks (normal attacks, projectiles, slams). It was built to create The Bruiser Brigade gameplay and overcome some limitations of the core cancel system :

- Canceling to animations other than freespecials (that is attacks, follows, special, etc)
- Animation restriction without input restriction. That is you can press your input before the switch frame is reached, the input will be registered, but the animation won't change until that switch frame is reached. Very good to ensure smooth transitions without affecting gameplay. On most animations the "right" switch frame is after an attackbox frame and before the final frame. Switching on attackbox frame is often visually to early while switching on final frame is often visually too late.
- Setting the frame at which the following anim will start (used to skip "start up" frames)
- Support directional key holding instead of directional key press
- Choosing to keep velocity momentum or not (default system always break velocity momentum, which is especially bad for air cancel)

It also support important things that the default system does support too :

- Setting the start frame and the end frame between which input will be registered (but unlike the core system, here the actual switch will only happen when animation is between switchFrame and endFrame. If an input is registered between startFrame and switchFrame, the system will wait until animation reaches the switchFrame to actually switch).

(As for the name, I justed named it like this at first to work on it and distinguish it from the core cancel system, but then I didn't change it so it stayed).


Setting the system up

Download the archive and put the files in it in your mod scripts folder.

First, open the keyall.c (if you don't have one create one) in your mod scripts folder so that it has these lines :

C:
#import "data/scripts/dcancel.c"


void main(){
 
    daimaoKeyCancel();
}


Then, you need this line at the top of your entities animationscript :

C:
#import "data/scripts/dcancel.c"

Finally, to allow input buffering (that is more flexible input timings), add this block around the top of your entity model file :

C:
@script
    if(frame > 0) daimaoCancel();
@end_script



Usage

Here I'll show you the basic usage of this system with an example :


C:
anim attack1
    @script
        if(frame == 0){
            void data = createDaimaoCancel();
         
            set(data, "switchFrame", 4);
         
            addCancel(data, "a1", "ANI_attack2");
            addCancel(data, "F a1", "ANI_attack3");
            addCancel(data, "a2", "ANI_freespecial1");
     
        }
    @end_script
    loop    0
    delay    5
    offset    45 119
    bbox    21 2 45 119
    frame    data/chars/maxima/punch000.gif
    frame    data/chars/maxima/punch001.gif
    attack    76 21 42 39 7
    bbox    31 6 51 116
    frame    data/chars/maxima/punch002.gif
    frame    data/chars/maxima/punch003.gif
    attack    0 0 0 0 0
    bbox    31 5 50 116
    frame    data/chars/maxima/punch004.gif

anim attack2
    @script
        if(frame == 0){
            void data = createDaimaoCancel();
         
            set(data, "switchFrame", 4);
         
            addCancel(data, "a1", "ANI_attack3");
            addCancel(data, "a2", "ANI_freespecial1");
     
        }
    @end_script
    loop    0
    delay    6
    offset    48 116
    bbox    33 3 45 114
    frame    data/chars/maxima/na2-00.gif
    move    2
    offset    50 116
    frame    data/chars/maxima/na2-01.gif
    offset    52 116
    frame    data/chars/maxima/na2-02.gif
    attack    59 31 64 32 14
    offset    54 116
    frame    data/chars/maxima/na2-03.gif
    offset    56 116
    frame    data/chars/maxima/na2-04.gif
    attack    0
    offset    58 116
    frame    data/chars/maxima/na2-05.gif
    move    0
    frame    data/chars/maxima/na2-06.gif


For a specific animation, cancel (or combo) possibilites are defined with inline script. I might add @cmd style commands as it might be more confortable for some people, but I prefer to use inline scripts.

What you have to modify to suit your needs is the middle part :

C:
set(data, "switchFrame", 4);
         
addCancel(data, "a1", "ANI_attack3");
addCancel(data, "a2", "ANI_freespecial1");

This line :

C:
set(data, "switchFrame", 4)

tells the system on which frame the engine can actually change animation (wether an input was registered before or not).

This line :

C:
addCancel(data, "a1", "ANI_attack2");

tells the system that the entity can follow to attack2 from this animation. Moreover, if the entity is controlled by player it will follow to attack2 if player pressed the "a1" button which is the attack button.

This line :
C:
addCancel(data, "F a1", "ANI_attack3");

tells the system that the entity can follow to attack3 from this animation. If the entity is controlled by player, it will follow to attack3 if player pressed the attack button while holding forward.

The creation of input is similar to the core system.
Available attacks button are : a1, a2, a3, a4.
Directional keys are : F, B, D, U.


There's a lot more to say about this system, but for now I'll just leave it there.



Setting a proper cleaning of the data

The system creates data variables, and while it tries to clear them automatically, sometimes they are not and it can creates crashes or simply use unecessary memory. So to ensure a proper cleaning we need to set up additional cleaning.

First, open the endlevel.c (if you don't have one create one) in your mod scripts folder so that it has these lines :

C:
#import "data/scripts/dcancel.c"

void main(){
 
 
    int i = 0;
    void vEnt;
    void cancelData;
    log("\nclearing players...");
    for(i=0; i<4; i++){
        vEnt = getplayerproperty(i, "entity");
        if(vEnt != NULL()){
            log("\nPLAYER " + i + " " + vEnt);
            clearDaimaoCancel(vEnt);
        }
    }
    log(" cleared players");
}

Then open your entity deathscript (if you don't have one create a file called deathscript.c in your mod scripts folder) so that it has these lines :

C:
#import "data/scripts/dcancel.c"

void main(){
    void vEnt = getlocalvar("self");
 
    int playerIndex = getentityproperty(vEnt,"playerindex");
 
    if(playerIndex != NULL()){
        log("\nDEATH SCRIPT - Clearining daimao cancel data for player " + playerIndex);
        clearDaimaoCancel(vEnt);
     
    }
 
}
  • Like
Reactions: Grit
Author
Piccolo
Downloads
16
Views
916
First release
Last update

Ratings

5.00 star(s) 1 ratings

More resources from Piccolo

Back
Top Bottom