Hello guys.
I am trying to play some animations on my custom weapons, however as I am using BehindView Camera with some offsets (3rd person), so the weapon model which is being hold by my pawn is controlled by UTWeaponAttachment Class.
After reading through the UTWeaponAttachment code, there is a function to play animations:
So I am having some hard time to call these animations using my weapon class. In example, I created a custom reload system for my weapons, extending the UTWeapon Class. And whenever the player presses the "R" key it plays the animation on the pawn owner of the weapon:
Untill here its fine, the weapon code plays a reload animaton on the pawn (player model), however I need to play aswell the animation on the UTWeaponAttachment of this gun, like the magazine being ejected and inserted a new one. I already have the two animations synchronized, the pawn reload and weapon reload, I just don't know how to call this animation from the weapon code to be played on the weapon attachment class.
Here is my Attachment Class:
Now i tried to access this attachment class by my weapon code, first by declaring a variable that will hold this attachment class:
Then on the fire event of this weapon UTWeap_AIRPG7 (because I need that the rocket actually disappears whenever the rpg fires), I tried to call the custom fire animation for the weapon attachment:
However whenever I compile, it gives me the error message "Unexpected RPG7Attachments".
Any help?
I am trying to play some animations on my custom weapons, however as I am using BehindView Camera with some offsets (3rd person), so the weapon model which is being hold by my pawn is controlled by UTWeaponAttachment Class.
After reading through the UTWeaponAttachment code, there is a function to play animations:
Code:
simulated function ThirdPersonFireEffects(vector HitLocation) { local UTPawn P; if ( EffectIsRelevant(Location,false,MaxFireEffectDistance) ) { // Light it up CauseMuzzleFlash(); } // Have pawn play firing anim P = UTPawn(Instigator); if (P != None && P.GunRecoilNode != None) { // Use recoil node to move arms when we fire P.GunRecoilNode.bPlayRecoil = true; } if (Instigator.FiringMode == 1 && AltFireAnim != 'None') { Mesh.PlayAnim(AltFireAnim,,, false); } else if (FireAnim != 'None') { Mesh.PlayAnim(FireAnim,,, false); } }
Code:
//reload function to play reload animation/////////////////////// exec function Reload() { //this statement will prevent weapon reloading when ammo is full if (AmmoTotal > 0 && !bIsReloading && AmmoCount < MaxAmmoCount) { ForceEndFire(); bIsReloading = true; //PlayWeaponAnimation('WeaponReload', 1.9); //this will play the custom reload animation only on the half top body UTPawn(Owner).TopHalfAnimSlot.SetActorAnimEndNotification(true); //AnimName, Rate, BlendInTime, BlendOutTime UTPawn(Owner).TopHalfAnimSlot.PlayCustomAnim('reload_rocket_UT3', 1, 0.25, 0.25); WeaponPlaySound(WeaponEquipSnd); //this timer will be triggered after the duration of the reload animation which is 3.13 seconds setTimer(3.13, false, 'AddAmmoToMag'); } } //reload function to play reload animation///////////////////////
Here is my Attachment Class:
Code:
class UTAttachment_AIRPG7 extends UTWeaponAttachment; DefaultProperties { Begin Object class=UTAnimNodeSequence Name=MeshSequenceA End Object Begin Object Name=SkeletalMeshComponent0 SkeletalMesh=SkeletalMesh'rpg7.rpg7' Scale=0.9000000 Animations=MeshSequenceA AnimSets(0)=AnimSet'rpg7.animations' End Object Mesh=SkeletalMeshComponent0 //play pistol holding animations// WeapAnimType=EWAT_ShoulderRocket bMakeSplash=True //muzzleflash for 3rd person model MuzzleFlashSocket=MuzzleFlashSocket MuzzleFlashPSCTemplate=ParticleSystem'WP_RocketLauncher.Effects.P_WP_RockerLauncher_Muzzle_Flash' //<DO NOT MODIFY> WeaponClass=Class'UTWeap_AIRPG7' }
Code:
class UTWeap_AIRPG7 extends WeaponReloadRocket; //An instance of the RPG7 Attachment class so we can animate the attachment (3rd person weapon) in game var UTAttachment_AIRPG7 RPG7Attachment; RPG7Attachment=Class'UTAttachment_AIRPG7'
Code:
//function to fire gun and play animation///////////////////////// simulated function FireAmmunition() { //this will play the allah_akbar sound PlaySound(SoundCue'dhikr.allah_akbar_1_Cue', false, true, true, vect(0,0,0), false); RPG7Attachments.Mesh.PlayAnim('rocket_shoot',,, false); super.FireAmmunition(); } //function to fire gun and play animation/////////////////////////
Any help?
Comment