Solved Animation Switch Issue

Question that is answered or resolved.

AlexDC22

Well-known member
@DCurrent
Code:
void change_animation(int animation_id)
{
void ent = getlocalvar("self");
performattack(ent, animation_id);
}

Code:
frame data/chars/dude/frame_0.png
@cmd change_animation openborconstant("ANI_FREESPECIAL2")
frame data/chars/dude/frame_0.png
frame data/chars/dude/frame_0.png

Thats the original and the one below is mine, yet it crashes and the error is: Script compile error in 'updateentityscript': ANI_FREESPECIAL1 line 4, column 23

script in the scripts folder
void counter(int block)
{
void ent = getlocalvar("self");
performattack(ent, ANI_FREESPECIAL1);
}

the command in the character text file
anim block
loop 0
delay 5
offset 31 99
frame data/chars/ryu/block1.gif
@cmd counter openborconstant("ANI_FREESPECIAL1")
offset 31 99
frame data/chars/ryu/block1.gif
offset 33 102
bbox 39 7 2 81
delay 5
frame data/chars/ryu/block2.gif


so what am i doing wrong here....thx
 
Last edited:
heres the log...and you are wrong sir...the engine is crashing cus I made it crash lmfao
I have that effect on things it seems lol

btw the goal is to perform a counter attack by pressing block as youre getting hit...so if youre in the last frame of the block animation it just blocks as normal tho...thats the intent. thanks
 

Attachments

Last edited:
This line in the log tells you where the problem is:

Code:
Script compile error in 'updateentityscript': ANI_FREESPECIAL1 line 4, column 23

Now looking at your function, I see why:

C:
performattack(ent, ANI_FREESPECIAL1);

You need to do this instead:

C:
performattack(ent, openborconstant("ANI_FREESPECIAL"));

In depth:

Script is total, 100% control, but that means you have to say exactly what you mean. There's no filter holding your hand and converting the values to things the engine can understand like with regular text files. ANI_FREESPECIAL1 on its own has no meaning at all, so the engine has no clue what to do. It's basically saying "WTF is this?!", and shutting down. Then it prints an error in the log to tell you.

In order to work, the performattack() function needs to know what animation, and like a lot of things, animations are identified by a number. You as a creator don't know what that number is ahead of time and you don't need or want to. Instead, there's a function that gets that number for you - openborcosntant(). You supply openborconstant() with the correct name, and when the engine first starts up it converts that to the number ID. Then when performattack() runs it uses that number to execute the animation you wanted.

Lastly, the correct name for the first free special is ANI_FREESPECIAL. There's no such thing as ANI_FREESPECIAL1.

HTH,
DC
 
so i changed it to that and changed it to freespecial2 as 1 didnt work and 2 is the one i wanted anyways lol...still nothing...
i also loaded the script (script data/scripts/didhit.c)and also took it off but same...
so if thats the only thing you see that i did wrong....then i have no clue as youre the expert lol
just says it cant find the counter function.
Thanks again
void counter(int block)
{
void ent = getlocalvar("self");
performattack(ent, openborconstant("ANI_FREESPECIAL2"));
}
 

Attachments

I think this is going off the thread rails a bit. I'd probably have to see your project to know what's going on. There are several things it might be, but without seeing the project it's just guesswork. I'm going to split this off into another thread and let's try to figure it out from there.

DC
 
I think this is going off the thread rails a bit. I'd probably have to see your project to know what's going on. There are several things it might be, but without seeing the project it's just guesswork. I'm going to split this off into another thread and let's try to figure it out from there.

DC
ok sorry i replied there because thats where the code i used is from there...so is cool to move it as long as it keeps things organized , appreciate it :)
is just ATOV i am adding some things like counters...so far that and another free special have been added to ryu only...so the only things i have edited is ryus text file and added the script mentioed in the scripts folder...thats really it...so i can upload his text file and the script file as thats the only thing new...or the whole module including those...again thats all ive done so far lol...trying to spruce it up a little before i do something new...that way i have a better grasp of what i am doing lol...i hope haha
 
ok heres the game with latest engine i believe already extracted and ready to test...only one script in the scripts folder ad it is ryu..on his text file its the very last code anim block the one we are testing...again i want it to counter attack if you press block as youre about to get hit...it blocks normal if it gets to the last frame...i cant test if this will work since it wont load for whatever reason... thx folks :)
 
Last edited:
Script compile error: can't find function 'counter'

This error message means counter function can't be found in Ryu's animation script. Have you added the function there?
 
This error message means counter function can't be found in Ryu's animation script. Have you added the function there?
the issue was the way it was loaded...was declaring it under the wrong title..maxman fixed that for me and the script does what its supposed to do..but is not what i need sadly..i need a counter on block so it it counter attacks on the first frame, if that window closes then it blocks as normal.....
found other examples but cant figure them out :/ OpenBOR DoAttack Example

feeling my age all of a sudden lol
 
Oh so you want something like counter in Night Slashers X?
If you haven't played that mod yet, you should try it 😀 .
 
Night Slashers X used secure pak so it can't be unpacked with regular unpacker.

I'll just quote Jasmin's BLOCK animation here:
Code:
anim block
    counterframe 0 1 0
    followanim 4
    delay 15
    offset    76 143
    bbox    60 47 25 69
    frame    data/chars/jasmin/020
    frame    data/chars/jasmin/020

Counterframe is old command BTW, it's replaced with counterrange which gives wider window time for counter.
Anyways, in that BLOCK animation, if Jasmin is attacked on first frame, she'll counter with FOLLOW4.
 
Night Slashers X used secure pak so it can't be unpacked with regular unpacker.

I'll just quote Jasmin's BLOCK animation here:
Code:
anim block
    counterframe 0 1 0
    followanim 4
    delay 15
    offset    76 143
    bbox    60 47 25 69
    frame    data/chars/jasmin/020
    frame    data/chars/jasmin/020

Counterframe is old command BTW, it's replaced with counterrange which gives wider window time for counter.
Anyways, in that BLOCK animation, if Jasmin is attacked on first frame, she'll counter with FOLLOW4.
ill try again, i stopped trying this when i read somewhere here DC said this was not recommended for counter on block, and that script doattack was the way....also why secure assets that are not yours to begin with? lol ok lol

thanks again

EDIT: tried both and cant get it to work at all... this is getting annoying now to the point where i am starting to question this quest lol
 
Last edited:
When you say "cant get it to work", do you mean:
1. It crashed the game?
OR
2. It doesn't crash the game but when enemy hits you, nothing special happens (no counter and no blocking)?
OR
3. It doesn't crash the game but when enemy hits you, it was blocked but no counter?
 
When you say "cant get it to work", do you mean:
1. It crashed the game?
OR
2. It doesn't crash the game but when enemy hits you, nothing special happens (no counter and no blocking)?
OR
3. It doesn't crash the game but when enemy hits you, it was blocked but no counter?
no just nothing happens lol
it just acts as regular block
 
Ah glad that regular block works.

That means you could chan.... I rather say it, rename BLOCK into a FREESPECIAL animation, use com as method to perform that FREESPECIAL and use script to activate and deactivate blocking state.
Here's an example:
Code:
anim    freespecial4 # Block
    delay    8
    offset    90 120
    counterrange 1 1 1 0
    followanim 1
    bbox    75 24 35 96
        frame    data/chars/wrestler/block.png
    delay    15
        frame    data/chars/wrestler/block.png
    delay    35
    @cmd    block 1
        frame    data/chars/wrestler/block.png
    delay    8
    @cmd    block 0
        frame    data/chars/wrestler/block.png

In this example, Wrestler has block status active at 3rd frame and deactivated at last frame. At second frame, he has counter state active. IOW if he's hit when he's in second frame, he'll perform FOLLOW1 as his counterattack. But if he's hit in 3rd frame, he'll just block the hit.

HTH
 
Ah glad that regular block works.

That means you could chan.... I rather say it, rename BLOCK into a FREESPECIAL animation, use com as method to perform that FREESPECIAL and use script to activate and deactivate blocking state.
Here's an example:
Code:
anim    freespecial4 # Block
    delay    8
    offset    90 120
    counterrange 1 1 1 0
    followanim 1
    bbox    75 24 35 96
        frame    data/chars/wrestler/block.png
    delay    15
        frame    data/chars/wrestler/block.png
    delay    35
    @cmd    block 1
        frame    data/chars/wrestler/block.png
    delay    8
    @cmd    block 0
        frame    data/chars/wrestler/block.png

In this example, Wrestler has block status active at 3rd frame and deactivated at last frame. At second frame, he has counter state active. IOW if he's hit when he's in second frame, he'll perform FOLLOW1 as his counterattack. But if he's hit in 3rd frame, he'll just block the hit.

HTH
but i cant unpack to get any of the scripts to adapt from NSX tho :(
 
So i fould one with ash but no wrestler but is the latest i could find and unpak.
the 2 scripts below are from it and the bit ive done wont run without them...they are declared in the ryus text file as well.
theres a bit of code in the scripts using freespecial that ive edited to the animations i am using but still the same results.

and those results are as follow.

ryu counter attacks but the block animation is not there and it doesnt play as it plays follow3
thats being called instead..that animation acts as the block animation which is weird.
the bit of code below is what i am using...thanks again ive been at this for 3 days with no luck ugh.

anim block
counterrange 0 1 1 10
followanim 3
loop 0
delay 5
offset 31 99
bbox 39 7 2 81
frame data/chars/ryu/block1.gif
@cmd keyint "ANI_FOLLOW3" 0 "S" 0 200
offset 33 102
bbox 39 7 2 81
delay 5
frame data/chars/ryu/block2.gif



anim follow3
loop 0
delay 4
offset 26 101
bbox 19 12 27 66
move 1
energycost 10
fastattack 1
sound data/sounds/ryurjatk.wav
frame data/chars/ryu/ratk08.gif
offset 24 93
bbox 20 10 34 68
frame data/chars/ryu/ratk09.gif
offset 26 89
bbox 25 10 32 55
frame data/chars/ryu/ratk10.gif
offset 27 82
bbox 31 8 29 47
frame data/chars/ryu/ratk11.gif
offset 27 87
frame data/chars/ryu/ratk12.gif
offset 27 87
frame data/chars/ryu/ratk13.gif
offset 27 87
attack 48 9 59 45 2 1
frame data/chars/ryu/ratk14.gif
offset 28 88
bbox 27 13 35 59
attack 0 0 0 0 0
frame data/chars/ryu/ratk15.gif
offset 26 91
bbox 21 10 37 61
frame data/chars/ryu/ratk16.gif
 

Attachments

Back
Top Bottom