How work @cmd forceanim

Fish

New member
Hi,
I've a problem with the
@cmd forceanim
I don't know why this command work only after the player hit or be hitting by enemy,  or grab the enemy.
For example, if the player perform:
Code:
Animation Freespecial
loop 0
Offset...  
Bbox... 
Delay... 
Frame.... 
@cmd forceanim openborconstant ("ANI_FOLLOW4") 
Frame...
the enemy don't change in
Anim follow4 at the first time, but only after a hit or one grab.
If the player perform again the animation with @cmd forceanim work perfecly and enemy change.
I want that forceanim work normally.
You can help me to understand how?
 
As far as I know, forceanim is not a native OpenBor function, but a custom one. So we would need to see the function in action to explain it to you.

But taking a wild guess here (judging by what you said), this function will change your target animation to one you desire. So, to make it work, first you would need to have a valid target. This is why it works only after you grab or hit someone. I have  a similar function that work in the same way.

There is a way to modify the function to make it work without touching, but it can lead to some weird bugs.
 
Maybe you just need this ?
@cmd performattack getlocalvar("self") openborconstant("ANI_ATTACK1")
We dont know forceanim and dont know what you want to do, there might be easier way for this
 
Thank's for the answers.
Code:
@cmd performattack getlocalvar("self") openborconstant("ANI_FOLLOW4")

This change the player's animation, but I need to change enemy's animation.

I need that the player perform a move like a parry:
1- Enemy attack the player;
2- The player block;
3- After blocking the enemy's attack, the player (pressing attack button) can perform an attack that hit only the enemy that attacking him and not touch the others enemies around. 

this is the function in script.c that I use to change the enemy's animation.
Code:
void forceanim(int anim){
	void self = getlocalvar("self");
	void opp = getentityproperty(self, "opponent");
	changeentityproperty(opp, "animation", anim);
}

This is the command in the player txt.

Code:
@cmd forceanim openborconstant("ANI_FOLLOW4")

but the problem is that don't work without touching first.
 
I've tested it and player won't get an opponent by blocking enemy's attack

That can be solved by setting this simple script:
Block.c
Code:
void main()
{
    void self = getlocalvar("self");
    void target = getlocalvar("attacker");

    if(target){
      changeentityproperty(self, "opponent", target);
    }
}

Save that in data/scripts folder as block.c
Declare that in player's text with this:

Code:
didblockscript	data/scripts/block.c

With this, when player blocks an attack, he/she will get the attacker as his/her opponent which allows you to force animation to the latter
 
Back
Top Bottom