Disabling or learning attacks

Hi,
Let's say i have 3 freespecial attacks defined.

com U D S freespecial2
com D U S freespecial3

The first one (default) is always available, but the other 2  are only available until later on in the game (by leveling up or something else, they are 'learned').

What was the obvious solution to me was to disable the other 2 attacks with some flag, but i was expecting some event like ondoattack but before the action is performed at all (like a onperformattack or something).

There's animationscript that gets executed on every frame of an animation (i think), so i was thinking it could be cancelled there, something like: if the current animation is freespecial2, check if its yet available, if not cancel the whole animation/attack.

Or maybe in keyall event, catch that keypresses, check things and cancel them.

What's the correct way to do it?

Thanks
 
You could check a condition before running the animation instead of trying to cancel it.  So the script would be inserted in the freespecial animation, if the condition isn't met then the animation won't play.

Code:
anim freespecial2
@script
{

your code here

}
@end_script
frame data/....

About Script Variables
http://www.chronocrash.com/forum/index.php?topic=2034.0
 
Oh i see, it was easier than i thought.

Just one more thing, what's the thing that actually prevents the animation from playing.
I tried to use return 0; but it still plays.

Code:
anim freespecial2
@script
{
if(something){
    return 0;
}
}
@end_script
frame data/....
 
you would probably want to switch to another animation.  Say a default attack, or idle anim.  Or another way, make the freespecial a normal attack, but the script will switch to another freespecial if the condition is met.

It would be something like this.

Code:
@script
if(frame==0){
void vSelf = getlocalvar("self");

if(something){
     changeentityproperty(vSelf, "animation", openborconstant("ANI_ATTACK6"));
 }
}
@end_script

Hope that helps, I'm not really much of  scripter.  I was trying something like this before by adding to existing level up scripts, but I never continued with that mod.
 
superantimonitor said:
Had to use ATTACK1, because if i used IDLE, the player got stuck in that and couldn't move nor atack, i don't know why.
:)

That's because player is still in attacking state when you changed to IDLE. OTOH ATTACK1 is an attack animation and it's compatible to change from FREESPECIAL animations

If you want to return to IDLE, use this instead:

Code:
    setidle(vSelf, openborconstant("ANI_IDLE"));
 
sorry superantimonitor,  I meant to post the IDLE script. 

Thanks Bloodbane.

I just had a thought...if you use setidle with another animation, does this tells the engine that the player is currently idle, even thou it's playing a non idle animation ?

Code:
setidle(vSelf, openborconstant("ANI_FOLLOW2"));

 
BeasTie said:
I just had a thought...if you use setidle with another animation, does this tells the engine that the player is currently idle, even thou it's playing a non idle animation ?
Code:
setidle(vSelf, openborconstant("ANI_FOLLOW2"));

I used it with ANI_ATTACK1 and no changes, it does the same that with ANI_IDLE
 
Yeah I think I might of tried it once.  I had an older mod where an enemy switched to a FOLLOW anim for a custom idle, but the engine didn't treat the enemy as if it's idle so it always got interrupted by other anims.  I think I just made it loop with an animation switch at the end to get back to normal.

You should check out the community scripts like Bloodbane's Simple Scripts, they can give you ideas.  You might want to edit something like his keyint script to suit what you need.


Scripts Index
http://www.chronocrash.com/forum/index.php?topic=1397.0
 
Back
Top Bottom