Solved followanim at a specific set of frames?

Question that is answered or resolved.
I am trying to make a FREESPECIAL move, and a FOLLOWANIM to follow. The problem is that FOLLOWANIM command starts from the the first attack box it detects, but I want the next move to start if attack boxes are between frames 80-110 only.

Is there any way to specify a set of frames for that?


Thanks for your time!
 
Sorry, follow doesn't do that. You'll need to set up a script. I recommend using the "didhit" event. It's not hard to do at all. I'm on my phone and can't write code, but there are tons of examples if you look around.

DC
 
@spyroskonst

Yeah, I agree with @DCurrent about the didhit, it's the best way to go. Just my two cents, below I posted a code similar to what I'm using on SORX.
I put some check steps only as examples but you can use any other as a filter to manipulate the conditions that will trigger the script.

C:
void main()
{//Custom followanim using script
    void self    = getlocalvar("self");
    void target    = getlocalvar("damagetaker");
    void anim    = getentityproperty(self,"animationID");
    void eType    = getentityproperty(target,"type");
    void sType    = getentityproperty(target,"subtype");
    int height    = getentityproperty(self,"y");
    int base    = getentityproperty(self,"base");

    //CHECK IF THE CURRENT ANIMATION IS THE FREESPECIAL, WHICH WILL TRIGGER THE SCRIPT
    if(anim == openborconstant("ANI_FREESPECIAL")){

        //CHECK THE TARGET TYPE AND SUBTYPE TO NOT ACTIVATE AGAINST WRONG OPPONENTS, LIKE OBSTACLES
        if(eType != openborconstant("TYPE_OBSTACLE") && sType != openborconstant("SUBTYPE_NOTGRAB")){

            //CHECK IF THE ENTITY IS ON THE GROUND, COMPARING HEIGHT WITH BASE
            if(height == base){
                performattack(self, openborconstant("ANI_FOLLOW1"), 1);
            }
        }
    }
}
 
Hey, hey, both of you, I am barely a newbie here and you are throwing me to the script lion. 😂

Thank you very much both of you, legends. I have no idea how to use set of frames on the didhit script, but now I know where to look for a workaround. 😀
 
int height = getentityproperty(self,"y");
int base = getentityproperty(self,"base");

//CHECK IF THE CURRENT ANIMATION IS THE FREESPECIAL, WHICH WILL TRIGGER THE SCRIPT
if(anim == openborconstant("ANI_FREESPECIAL")){

//CHECK THE TARGET TYPE AND SUBTYPE TO NOT ACTIVATE AGAINST WRONG OPPONENTS, LIKE OBSTACLES
if(eType != openborconstant("TYPE_OBSTACLE") && sType != openborconstant("SUBTYPE_NOTGRAB")){

//CHECK IF THE ENTITY IS ON THE GROUND, COMPARING HEIGHT WITH BASE
if(height == base){[/CODE]
Is base = 0 if the player is on an obstacle/platform/wall?
 
script lion. 😂
lol 😂😂😂

Sorry @spyroskonst I forgot to put an example using frames as requirements. Okay, let's do it step by step.

1) Download the didhit.c file I attached in this post (you need to extract from the zip file), it contains the following script

C:
void main()
{//Custom followanim using script
    void self        = getlocalvar("self");
    void target        = getlocalvar("damagetaker");
    void anim        = getentityproperty(self,"animationID");
    void eType        = getentityproperty(target,"type");
    void sType        = getentityproperty(target,"subtype");
    int height        = getentityproperty(self,"y");
    int base        = getentityproperty(self,"base");
    int frame        = getentityproperty(self,"animpos");
    int firstFrame    = 80;
    int lastFrame    = 110;

    //CHECK IF THE CURRENT ANIMATION IS THE FREESPECIAL AND WITH THE CORRECT FRAME RANGE, WHICH WILL TRIGGER THE SCRIPT
    if(anim == openborconstant("ANI_FREESPECIAL") && frame >= firstFrame && frame <= lastFrame){

        //CHECK THE TARGET TYPE AND SUBTYPE TO NOT ACTIVATE AGAINST WRONG OPPONENTS, LIKE OBSTACLES
        if(eType != openborconstant("TYPE_OBSTACLE") && sType != openborconstant("SUBTYPE_NOTGRAB")){

            //CHECK IF THE ENTITY IS ON THE GROUND, COMPARING HEIGHT WITH BASE
            if(height == base){
                performattack(self, openborconstant("ANI_FOLLOW1"), 1);
            }
        }
    }
}

2) Move the didhit.c file to your scripts folder at "data/scripts/"

3)Open your character file and call the didhit.c script at the header, like this

Code:
didhitscript data/scripts/didhit.c

Here's an example

1680118570908.png

4) Test to see if it's working as intended, and that's it :)
 

Attachments

OMG I can not thank you enough!
Thank you for the thoroughly detailed answer. I knew where to place it and how to enable it, but coding wise (scripts etc), I am really struggling to understand them. But I will try your script! I'll definetely need it for so many moves.

I am modding TMNT Shell Shock unfinished game from White Dragon. TERRIBLE CHOICE FOR A NEWBIE! :ROFLMAO:

I have mixed 6 TMNT games into this mod and now I am adding moves to the turtles. I don't know if I will ever finish it, or have the guts to publish it, but I like how I am progressing with it. It's a great excuse to learn the engine. Enough of that, back to coding now.🔥
 
I am modding TMNT Shell Shock unfinished game from White Dragon. TERRIBLE CHOICE FOR A NEWBIE! :ROFLMAO:
🤣

I have mixed 6 TMNT games into this mod and now I am adding moves to the turtles. I don't know if I will ever finish it, or have the guts to publish it, but I like how I am progressing with it. It's a great excuse to learn the engine. Enough of that, back to coding now.🔥
I like your enthusiasm and I hope you'll keep it as long as possible! Coding isn't funny for most people but making progress at it is very satisfying when it comes to programming what you really want.
 
🤣


I like your enthusiasm and I hope you'll keep it as long as possible! Coding isn't funny for most people but making progress at it is very satisfying when it comes to programming what you really want.
It takes me literally one day to do one move. I know that many are laughing with this, but it's not easy. Also, any recommendations for tools are welcomed. I am lacking of useful tools. 🙏
 
I know that many are laughing with this, but it's not easy
Don't worry buddy, the community will help you. And we are all learning too :)

About the tools, I strongly recommend using the Visual Studio Code to edit your game, mainly the scripts. In a more advanced stage, I suggest using GitHub to manage your project.
Another recommendation is the latest version of the Chrono Crash Modder Tools (CMT), you can find it in the resources section.
 
Back
Top Bottom