Announcement

Collapse
No announcement yet.

Help with StopCustomAnim ( )

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with StopCustomAnim ( )

    Hello guys

    It`s me again.

    As I said before, I am extending UTGame and turning it into a Third Person Shooter (soon I will showcase my game here), and as I am a n00b in UDK, I am using many of the UT functions as a base for my own classes, I am using even the same UT3 Skeleton for my custom character, same AnimationTrees and even same animation set (however I am replacing almost ALL UT3 locomotion animation like running, crouching, running left, right, pistol aiming, and so on..)

    Something I never liked in UTGame is the running animation, because the character runs and aims at the same time, and as I have got many mocap files for different actions, I am using a cool sprint running animation similar to PUBG and Fortnite. However, as I am using the UTGame AnimationTree, whenever I am running with my custom sprint animation and shoot, there is no shooting animation, so I added this code on my weapon code to play a shooting (aiming) animation whenever the Pawn (player and enemies) shoots while is running (because for the idle state, the idle animation already has the aiming position):

    Code:
    //function to fire gun and play animation/////////////////////////
    simulated function FireAmmunition()
    {
    
            //this will play the shooting animation only whenever the player is running, which is when it is needed to make the transition
            //between running and shooting
            if(UTPawn(Owner).Velocity.x > 0 || UTPawn(Owner).Velocity.y > 0 || UTPawn(Owner).Velocity.z > 0)
            {
            //this will play the custom shoot animation only on the half top body
            UTPawn(Owner).TopHalfAnimSlot.SetActorAnimEndNotification(true);  
            UTPawn(Owner).TopHalfAnimSlot.PlayCustomAnim('shoot_aim_rif', 1, 0.15, 0.15, true, false);
            }
    
            else
            {
            UTPawn(Owner).TopHalfAnimSlot.StopCustomAnim(0.15);
            }
    
            super.FireAmmunition();
    }
    //function to fire gun and play animation/////////////////////////
    The problem is that the UTPawn(Owner).TopHalfAnimSlot.StopCustomAnim(0.15); doesn't seem to be working, the aiming animation continues to be played on the tophalfslot until another animation overrides it like reload animation (I created a reload system).

    I tried to add this function on the weapon code also:

    Code:
    simulated function ConsumeAmmo( byte FireModeNum )
    {
            if(UTPawn(Owner).Velocity.x == 0 || UTPawn(Owner).Velocity.y == 0 || UTPawn(Owner).Velocity.z == 0)
            {
            //this will stop the custom shoot animation only on the half top body
            UTPawn(Owner).TopHalfAnimSlot.StopCustomAnim(0.15);
            }
    
            super.ConsumeAmmo(1);
    }
    Because after reading the UDK Weapons Technical Guide, I learned that the ConsumeAmmo() is the function that comes right after FireAmmunition(), so I thought that it would work, however, it didn't work.

    Whenever I added the ConsumeAmmo() the shooting animation does not play, so the Pawn only runs (sprint animation), and shoots while his hands are playing the sprint animation (looks weird).

    Any help?
    Last edited by udkultimate; 08-08-2018, 02:40 PM.

    #2
    Perhaps there are some aimnode before the tophalfslot in the animtree?
    Provisional blog: http://cobaltudk.blogspot.com.es/
    Videos: https://www.youtube.com/user/cobaltudk
    Facebook: https://www.facebook.com/babylonprojectgame/

    Comment


      #3
      Originally posted by CobaltUDK View Post
      Perhaps there are some aimnode before the tophalfslot in the animtree?
      Thanks friend for the info, I will look at the animation tree, I tried to keep the most of UTGame logic, however indeed I need to change somethings. Cheers!

      Comment

      Working...
      X