No announcement yet.

How to play animations for 3rd person weapons [SOLVED -- Stupid error like everytime]

  • Filter
  • Time
  • Show
Clear All
new posts

    How to play animations for 3rd person weapons [SOLVED -- Stupid error like everytime]

    is it possible to play animations on the third person view of a weapon?

    i tryed something like this:
    PHP Code:
    //from my weaponfire class
    local gibblerAttachment att;
    att gibblerAttachment(Weapon.ThirdPersonActor);

    but i get an "Access None" warning on LitWeapon

    it would be important to see these animations on third person actors...

    If you want to play an animation on the thirdperson actor itself you would just do att.playanim('MixerExtend',,,1);

    What does LitWeapon reference to? It must be a variable in your attachment class but what is it for?


      You don't need to do casting there since PlayAnim is declared in Actor.uc and so is available to all actors. So this should do it:


        thirdpersonactor (in this case) refers to a xWeaponAttachment class, not the weapon itself. Since LitWeapon is the only reference from xWeaponAttachment to a weapon i thought that this is the rendered weapon.

        i tried
        Weapon.ThirdPersonActor.PlayAnim('MixerExtend',,,1 );

        but it just does nothing . Is there somewhere a bool that specifies if animations should be played?


          Are you sure the animation exists and has been linked to the mesh? Check the log for animation errors.


            I take it you have animations for the 3rd person model your using for the attachment class right? I know I had an issue initially because I thought that simply because the attachment model and the 1st person were in the same animation file, that they would share animations. Not true (unless you set them up to).

            So if Weapon.ThirdPersonActor.PlayAnim('MixerExtend',,,1 ); didn't work, are you sure that functions getting called when you think it is? Did you try throwing a log("playingAnim") in front of it or something?

            I used to always be like wtf when something wasnt happening, thinking it was problems with my code. Well it was, but the problem was that the code was never being called.

            So, is it being called for sure? Is that animation associated with the attachment model? try a different animation for testing?


              i use the same mesh for 1st and 3rd view. (ATM... i'll do a lowpoly version later...)

              the function
              function BeginState()
              weapon.ThirdPersonActor.PlayAnim('MixerExtend',,,1 );

              is being called and the anims are linked correctly because i see the anims in 1st person view.

              btw, i just tested it with an instigator.clientmessage. and its called correctly in 3rd person view, too.

              edit: ahhh there comes a thought... i linked bones to channels on the firstperson view weapon. but not on the 3rd. personview one... :noob: i'll try to link them too... i'm such an idiot....


                nope, that wasn't the problem... still no anim in 3rd person...



                  Well wait, are we sure that the Weapon.ThirdPersonActor actually refers to your attachment class?

                  Like the attachment is what should be playing the animation right?

                  So Weapon refers to the weapon class, and not the attachment class.

                  Is there a way to get that particular instance of the attachment? Im sure there is, but I think thats what you may have to look for rather than the instance of the weapon itself.

                  Does that sound reasonable?


                    are we sure that the Weapon.ThirdPersonActor actually refers to your attachment class?
                    yes, we are. quote from ShieldAltFire.uc:
                        local ShieldAttachment Attachment;
                        Attachment = ShieldAttachment(Weapon.ThirdPersonActor);
                        if( Attachment != None && Attachment.ShieldEffect3rd != None )
                            Attachment.ShieldEffect3rd.bHidden = false;
                    they cast the Weapon.ThirdPersonActor to theyr ShieldAttachment class.

                    the ThirdPersonActor is assigned in Inventory.uc:
                    ThirdPersonActor = Spawn(AttachmentClass,Owner);


                      i've found my problem!

                      "I'm such an idiot", Part 2:

                      it was the problem which i wrote first, i played animations on channels that arent set... Then ok, i set the channels. In postBeginPlay. what i didn't know was that when postbeginplay is being executed, thirdPersonActor isn't set. So getting an "access none" on thirdPersonActor.
                      Now i set the animBlenParams everytime before i call play PlayAnim...

                      sometimes i do really stupid errors...


                        Good deal, I will be after you when I want to do some animations. I havent done shizzit with them yet so...