PDA

View Full Version : PlayCustomAnim problem



Niandi
04-09-2012, 01:00 PM
Hi guys,

I've been trying to call an animation from code for a while now, and getting totally stumped by it. Right now my AnimTree is working with all the movement/death/attacks absolultely fine, not a problem. However I've been trying to call a 'TakeDamage' anim and I can't see anywhere in the AnimTree where 'TakeDamage' animations are naturally being handled.

I found a piece of code in UDK that says you can play a custom animation using code.. I've been trying this with no luck.

This is what I've been doing so far.



event TakeDamage(int Damage, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
{
FullBodyAnimSlot.PlayCustomAnim('SK_Human_damage_A nim', 10.0, 1.0, 0.0, false, false);

Super.TakeDamage(Damage, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);
}


There is literally no effect by doing this unfortunately... Does anyone have any idea what I'm doing wrong? (By the way I've connected the 'Take_Damage' anim in the AnimTree under 'Custom').

Thanks!

Niandi
04-09-2012, 01:40 PM
I've also been trying another way to call the animation, but with no luck...



var AnimNodePlayCustomAnim TakeDamageAnim;


simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
super.PostInitAnimTree( SkelComp );

if (SkelComp == Mesh)
{
AttackBlend = AnimNodeBlend(Mesh.FindAnimNode('AttackBlend'));
}

if(SkelComp == Mesh)
{
TakeDamageAnim = AnimNodePlayCustomAnim(Mesh.FindAnimNode('TakeDama geAnim'));
}
}

exec function GetHit()
{
TakeDamageAnim.PlayCustomAnim('TakeDamageAnim',1.0 ,0.2,0.2,false,true);
}

event TakeDamage(int Damage, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
{
FullBodyAnimSlot.PlayCustomAnim('SK_Human_damage_A nim', 10.0, 1.0, 0.0, false, false);

GetHit();

Super.TakeDamage(Damage, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);
}



Can anyone see what I'm doing wrong?

Thanks in advance!