Target anim

O Ilusionista

Captain 100K
I have some issue here and i can't fix it.
My char have an attack wich will "hold" the target with a net. To archive that, I gave it the "attack3" propriety and made a pain3 on the char, which will spawn the net effect.

Everything works fine, unless a big problem: I can keep hitting the enemy with the same attack, over and over, and this is not cool.

So, I need to make a script to check if my entity (a projectile) to check its target anim. If the target is on "pain3", it should change the target anim to "ANI_FALL" (or change his propriety to "attack", not "attack3 anymore).

In other words: target (which is in pain3 animation) should be able to be hit by everything, MINUS an "attack3". If you use an attack3, it should go to its "fall" animation.

I made a didhitscript with this:

Code:
void main()
{// Anti loop
    void self = getlocalvar("self"); //Get calling entity.
	void target = getlocalvar("Target" + self);

    if(target==NULL())
    {
      target = getentityproperty(self, "opponent");
      setlocalvar("Target" + self, target);
    }
	
	if(target!=NULL() && target==openborconstant("ANI_PAIN3"))
    {
changeentityproperty(target, "animation", openborconstant("ANI_FALL")) ;  
 }

}

But it doesn't works. I don't want to set a takedamagescript for every single entity on my game.
how I do that?
 
Not entirely sure but....

There is this script that checks what anim the enemy is in before it will perform an attack.

'ani0020.c'

Code:
@cmd	ani0020 openborconstant("ANI_FREESPECIAL12") openborconstant("ANI_PAIN3")


Code:
#include "data/scripts/ani0009.h"

int ani0020(int iAni, int iTAni){
    
	/*
	ani0020
	Damon Vaughn Caskey
	Perform alternate animation if target is within range and in specified animation.

	iAni:	Alternate attack.
	iTAni:	Target animation.
	*/

    void vSelf      = getlocalvar("self");					//Caller.                                                         
    void vOpp       = findtarget(vSelf, iAni);				//Nearest target in range of alternate attack.
	
	if (vOpp)												//Found a target?
	{
		if(getentityproperty(vOpp, "animationID") == iTAni)	//Animation match?
		{
			ani0009(vSelf, iAni, 0);						//Perform alternate attack.
			return 1;										//Return 1.
		}
	}

	return 0;												//Return 0.
}

Also required??
Code:
int ani0009(void vTarget, int iAni, int iType)
{
    //Set animation and return 1 if valid.

	if (!vTarget) vTarget = getlocalvar("self");

    if (getentityproperty(vTarget, "animvalid", iAni))          //Animation valid?
    {
        if (iType == -1)                                        //Type -1?
        {
            changeentityproperty(vTarget, "animation", iAni);   //Set animation with entity property.
        }
        else
        {
            performattack(vTarget, iAni, iType);                //Set animation with perform attack command.
        }
        return 1;                                               //Return 1.        
    }
    return 0;
}
 
I did not check, but I think your script will work if you just use performattack instead of changeentityproperty to change animations right away, Ilusionista.
 
It didn't works, neither it would make sense: the target is been hit, not attacking.
I haven't tested DC script, but for what I saw, it will works.

I forgot that the char won't be able to use the same move 2 times in a row, but this could bug if another char uses it, so its better to be prepared.
 
Ei ilusionista, se não funcionou, ok. Agora, se tu acha que não faz sentido, então nem testa o script do DC, pois é exatamente o performattack que ele usa para trocar a animação do vtarget, no seu caso, a entidade que sofreu o ataque.

Não se deixe levar pelo nome. A melhor forma de trocar animação é com performattack, não importa se tu vai trocar para animação de ataque follow ou idle.

Abraço
 
But it is not offensive at all...

Desculpa se te ofendi, realmente não é essa a intenção, e sequer imaginei fosse te ofender de alguma forma.  Aliás, a intenção é te ajudar. Eu também não me senti ofendido.  Sou da paz e pelo que vi tu também :)
 
just add variable to disable the attack for some amount of time or until you get hit, i dont know how they solved it in mk shaolin monks and scorpion spear but i would just disable it if it hits opponent and save all the headache, similar like when you throw net with cyrax in mk3 then you cant throw it again when opponent is trapped in net, i know its beatemup and many enemies at once but how about using hitboxes trick?
So net attack hitbox is only from waist to feet  and when enemy is in his  "trapped in net pain anim" then his bbox is from head to chest so he cant be physically hit by net hitboxes because theyre too low, figure something out :)
 
Back
Top Bottom