Hi all. I'm working on online slasher project and now im writing a combat system.
I'm not going to talk about how to make the weapons, it was discussed on the forum many times.
To store the names of animations, I wrote a simple class:
Such objects (not one) attached to the Weapon and are selected as the current combo.Code:class CAAnimInfo extends Object; var array<name> Anims; var int animIndex; var int animCount; function addAnim(name animName) { Anims[animCount]=animName; animCount++; } function name getCurrentAnimName() { if (!(Anims.Length==0)) { `log("Current anim name is "@Anims[animIndex]); animIndex = (animIndex + 1)%Anims.Length; return Anims[animIndex]; } else return ''; } function name getLastAnimName() { if (!(Anims.Length==0)) { return Anims[animIndex]; } else return ''; } function bool availableNext() { if(animIndex == Anims.Length || Anims.Length==0) return false; return true; } function resetIndex() { animIndex = 0; } DefaultProperties { animCount=0; animIndex=0; }
I had an idea to implement the notification of the beginning of the trace through the blade AnimNotify_Script.
I added a Notify Anim Sequence
and wrote in my Pawn :
But this function is never called. What am I doing wrong?Code:simulated event MeleeStartTrace() { `log("starttrace"); DoStaff(); }
My second issue:
How can I write an algorithm to execute series of attacks?
My version of algorithm:
But it ugly. Anybody got some ideas?Code:function Attack(byte FireModeNum) { attackQueue++; if (!bIsAttack) { bIsAttack = true; PlayComboAnims(); } } simulated function PlayComboAnims() { local float animTime; if (attackQueue>0) { animTime = CAPawn(Instigator).PlayCustomAnim( Anims.getCurrentAnimName(),0.08f,false,,0.08f,false ); attackQueue--; } else { stopAttack(); } if (Anims.availableNext()) { SetTimer(animTime, false,'PlayComboAnims' ); SetTimer(animTime+0.1f,false,'resetCombo'); } else { SetTimer(animTime,false,'stopAttack'); attackQueue=0; resetCombo(); } } function stopAttack() { bIsAttack = false; } function resetCombo() { if (attackQueue==0) { Anims.resetIndex(); stopAttack(); } }
Sorry for my english




Reply With Quote

Bookmarks