Hello friends. I am a beginner in Unreal Script, still learning. I am trying to recreate (or make something similar) to Gears of War Chainsaw Executions in UDK. I am beginning with the first step which is the player play the chainsaw attack anim. The second step is getting the enemy bot to play the chainsaw death animation at the same moment the player pawn plays the attack animation (synchronization). Then the last step is to have a camera animation to play to change from behindview to showing (close) both the player pawn and enemy.
So for the first step, I have followed this awesome tutorial:
mavrikgames.com/tutorials/melee-weapons/melee-weapon-tutorial-part-1
However, as I am extending the UT Base Classes, I have done something a bit different from the above tutorial, and I have created a normal pickup weapon to use it as a melee weapon. In fact, is not a real melee, is an instant hit weapon that has a very small range and no projectile, so is a kind of fake melee (I am doing something very basic).
The point is that I want that whenever the player presses the fire button, then the pawn (player mesh) will play a custom attack animation.
Here is the Animation Tree I created, and there is the PlayCustomAnimation node:
Everything is working almost perfectly, however, the problem is that I don`t know why and how that only the default UDK Animations work, play. If i setup in my code the name of any custom animation I created and imported inside the AnimationSet, it does not play.
However, the animation works perfectly inside UDK, I used the “Import FBX Animation” inside the Skeleton Mesh Preview, the animation imports and plays perfectly.
Here are the animations playing inside UDK:
However, whenever I add my custom animation name in the weapon code to play this animation, it does not work. However, whenever I change the animation to anyone of the UDK animations (Taunt_Victory, i.e), the code works perfectly, the animation plays whenever I press the fire button. But whenever I point to anyone of my custom animations, the pawn just freezes all his animations. It seems like there is another class on which I need to mention the name of my custom animations, because it seems that UDK is not finding my custom animations.
I am using the default UT3_Male Template 3dsmax biped and skeleton (70 Bones) to create my animations.
This is my pawn code. In the pawn code there is a function to find the animation node:
ChainsawAnim = AnimNodePlayCustomAnim(SkelComp.FindAnimNode(‘ChainsawAnim’));
//this pawn class is just for setting up a basic third person view
//the default player mesh (CharClassInfo) is defined in UTPlayerReplicationInfo
class UDKUltimatePawn extends UTPawn;
//this variable will store the animation node chainsaw attack
var AnimNodePlayCustomAnim ChainsawAnim;
//this function will find the animation node and store this to another variable
simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
super.PostInitAnimTree(SkelComp);
if (SkelComp == Mesh)
{
ChainsawAnim = AnimNodePlayCustomAnim(SkelComp.FindAnimNode('ChainsawAnim'));
}
}
//override to make player mesh visible by default
simulated event BecomeViewTarget( PlayerController PC )
{
local UTPlayerController UTPC;
Super.BecomeViewTarget(PC);
if (LocalPlayer(PC.Player) != None)
{
UTPC = UTPlayerController(PC);
if (UTPC != None)
{
//set player controller to behind view and make mesh visible
UTPC.SetBehindView(true);
SetMeshVisibility(UTPC.bBehindView);
}
}
}
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
local vector CamStart, HitLocation, HitNormal, CamDirX, CamDirY, CamDirZ, CurrentCamOffset;
local float DesiredCameraZOffset;
CamStart = Location;
CurrentCamOffset = CamOffset;
DesiredCameraZOffset = (Health > 0) ? 1.2 * GetCollisionHeight() + Mesh.Translation.Z : 0.f;
CameraZOffset = (fDeltaTime < 0.2) ? DesiredCameraZOffset * 5 * fDeltaTime + (1 - 5*fDeltaTime) * CameraZOffset : DesiredCameraZOffset;
if ( Health <= 0 )
{
CurrentCamOffset = vect(0,0,0);
CurrentCamOffset.X = GetCollisionRadius();
}
CamStart.Z += CameraZOffset;
GetAxes(out_CamRot, CamDirX, CamDirY, CamDirZ);
CamDirX *= CurrentCameraScale;
if ( (Health <= 0) || bFeigningDeath )
{
// adjust camera position to make sure it's not clipping into world
// @todo fixmesteve. Note that you can still get clipping if FindSpot fails (happens rarely)
FindSpot(GetCollisionExtent(),CamStart);
}
if (CurrentCameraScale < CameraScale)
{
CurrentCameraScale = FMin(CameraScale, CurrentCameraScale + 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
}
else if (CurrentCameraScale > CameraScale)
{
CurrentCameraScale = FMax(CameraScale, CurrentCameraScale - 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
}
if (CamDirX.Z > GetCollisionHeight())
{
CamDirX *= square(cos(out_CamRot.Pitch * 0.0000958738)); // 0.0000958738 = 2*PI/65536
}
out_CamLoc = CamStart - CamDirX*CurrentCamOffset.X + CurrentCamOffset.Y*CamDirY + CurrentCamOffset.Z*CamDirZ;
if (Trace(HitLocation, HitNormal, out_CamLoc, CamStart, false, vect(12,12,12)) != None)
{
out_CamLoc = HitLocation;
}
return true;
}
defaultproperties
{
Begin Object Name=WPawnSkeletalMeshComponent
AnimTreeTemplate=AnimTree'UDKUltimate_Test.AnimTree.AnimTreeTutorial'
AnimSets(0)=AnimSet'UDKUltimate_Test.AnimTree.AnimSet_Test'
End Object
Health=250
HealthMax=250
bPhysRigidBodyOutOfWorldCheck=TRUE
bRunPhysicsWithNoController=true
LeftFootControlName=LeftFootControl
RightFootControlName=RightFootControl
bEnableFootPlacement=true
MaxFootPlacementDistSquared=56250000.0 // 7500 squared
}
This is my Weapon Code. In the weapon code there is a code for “injecting” the custom animation on the empty animation node sequence that is connected to the animnodeplaycustom animation:
UDKUltimatePawn(Owner).ChainsawAnim.PlayCustomAnim(‘Chainsaw_Attack’, 1.0);
class UTWeap_GOWChainsaw extends UTWeapon;
//this variable will store the chainsaw animation name
var() const name ChainsawAnimationName;
simulated function FireAmmunition()
{
if (HasAmmo(CurrentFireMode))
{
//this function will play the custom animation once the player presses the fire button, i.e FireAmmunition
UDKUltimatePawn(Owner).ChainsawAnim.PlayCustomAnim('Chainsaw_Attack', 1.0);
PlayWeaponAnimation(ChainsawAnimationName, GetFireInterval(CurrentFireMode));
super.FireAmmunition();
}
}
defaultproperties
{
Begin Object class=AnimNodeSequence Name=MeshSequenceA
bCauseActorAnimEnd=true
End Object
Begin Object Name=PickupMesh
SkeletalMesh=SkeletalMesh'WP_GOW.Mesh.WP_GOWRifleAssalto_P3'
Scale=0.9000000
End Object
PivotTranslation=(Y=0.0)
bInstantHit=true;
WeaponFireTypes(0)=EWFT_InstantHit
InstantHitDamage(0)=30
WeaponRange=50
//ammo fire speed functions///////////////////////////////
FireInterval(0)=0.15
//ammo fire speed functions///////////////////////////////
//ammo properties
MaxAmmoCount=1000
AmmoCount=1000
//sounds
WeaponEquipSnd=SoundCue'WP_GOW.Sounds.CogRifleRaise_Cue'
WeaponPutDownSnd=SoundCue'WP_GOW.Sounds.CogRifleLower_Cue'
//WeaponFireSnd(0)=SoundCue'WP_GOW.Sounds.CogARifleFire08_Cue'
PickupSound=SoundCue'WP_GOW.Sounds.CogRifleRaise_Cue'
//CrosshairImage=Copy texture from Content Browser
CrossHairCoordinates=(U=0,V=0,UL=0,VL=0)
//<DO NOT MODIFY>
Mesh=FirstPersonMesh
DroppedPickupMesh=PickupMesh
PickupFactoryMesh=PickupMesh
AttachmentClass=Class'UTAttachment_GOWChainsaw'
}
Any help?
Cheers and sorry for the long post.