Sup. When my character gets hit by an enemy attack, he successfully does his hit animation and loses damage. What I need is a solution to make it so that if he gets hit while he's attacking, the attack function will stop. The reason this is difficult is because I need the attack function to stop from the being hit function, making return; unusable. Here's the scripts. Note: Super big attack script because it's a portion of a combo.
function BeingHit (){
isAttacking = false;
comboable = false;
animation.CrossFade("getHit",0.03);
yield WaitForSeconds(.5);
beingHit = false;
}
function QuickCombo1()
{
isAttacking = true;
if(isAttacking == true){
animation.CrossFade("qc1");
yield WaitForSeconds(.5);
hitTimeSmall = true;
attackMove = true;
yield WaitForSeconds(.2);
attackMove = false;
yield WaitForSeconds(.5);
hitTimeSmall = false;
comboable = true;
yield WaitForSeconds(0.3);
if(inCombo == false){
comboable = false;
isWalking = true;
isMoveable = true;
isAttacking = false;
}
}
}
yes I agree, and you would also need to add an isAttacking = false at the end of the loop so the loop terminates even if the character is not attacked
– loopyllama