Results 1 to 12 of 12
  1. #1
    MSgt. Shooter Person
    Join Date
    Mar 2003
    Posts
    353

    Default Ensuring Animation Finishes

    Has anyone found a way to make sure that an animation finishes playing before anything else can happen?

    I have a weapon reload animation that starts and all, and the reload stuff works, but the animation gets cut off if I start firing the weapon.

    So has anyone figured out a way to ensure that an animation finishes?

  2. #2
    Redeemer
    Join Date
    Dec 2003
    Location
    PHiNQ.com
    Posts
    1,266

    Default

    Hmm. Sounds maybe like you're trying to fix your reload wait prob a different way. You might have to disable firing (while reloading) for a hard coded length of time (which would work, I suppose) instead of trying to work a more universal method.

    Dicky B (anyway, it would disable firing and play the animation for X seconds, which sounds like the effect you want)
    Hi.

  3. #3
    MSgt. Shooter Person
    Join Date
    Mar 2003
    Posts
    353

    Default

    Thats what I was trying to do, but how would I disable for a set amount of time?

    You can't call sleep in a WeaponFire subclass, cause WeaponFire isnt a subclass of actor.

    I tried cheating using a variable and a loop, but that didnt work... So how would I make the danged thing wait?

  4. #4
    Redeemer
    Join Date
    Sep 2002
    Posts
    1,517

    Default

    we have a similar problem (which ive solved quite hackily, i might add). we have a variable in our weapon class that says we are reloading. its a bool, obviously, and the weapon checks to see if we are reloading before it will fire. this is easily done, if you follow your weapon code a bit, youll see a great place to add it.

    the pawn also has to be told not to perform animations, which there is a variable in pawn already called FireState. if you have your own pawn class, you can change this a bit, and that will help you keep your pawn from doing silly things when you need the anim to work.

    also there is a function called AnimEnd(int Channel). this is in both pawn and weapon, and is (i believe) called from native magic to ensure it works automatically (its never called within uscript). you can rig this up, but its a bit hacky also.

    the BEST way to do it is with a complex system of state code. that will ensure that your pawns and weapons never play anims when you dont want them to, and also has sleep capability. anything relating to animations is best put in state code, since animations are time based, and state code is wonderful for that. but its all depending on what you have time/skill for. our methods are a bit hacky due to lack of time. we will refactor our code once MSU is over.

  5. #5
    MSgt. Shooter Person
    Join Date
    Mar 2003
    Posts
    353

    Default

    I'll check this all out when I get home thanks.

    I am using a reload bool, or I was. I have changed it now so that when you hold down alt-fire, it starts playing the animation. Then if you let go it stops. Thats actually ok, only I can't grasp how to figure out that the animation has played out. I dont want the ammo to be added to the weapon until the reload ammo has been played out.

    The whole idea was to tie the alt-fire to reload, and that was all fine and good. But what happened was that if you fired off a shot while it was being reloaded, it would stunt the animation.

    So yeah, I tried the whole statecode thing, I have another post about that.

  6. #6
    Redeemer
    Join Date
    Sep 2002
    Posts
    1,517

    Default

    i use a timer with a variable that corresponds to the animation length. also you shoudl check Actor.uc for the animation functions. i believe there is one to tell you if an animation has completed on a channel, and there is one that returns the length of an animation, but i dont know if its in frames or seconds.

  7. #7
    MSgt. Shooter Person
    Join Date
    Apr 2004
    Posts
    96

    Default

    Look on the frag-ops forums, squirrel zero wrote a reloading weapon tutorial that works such that the reloading doesn't finish until the animation is over and can't be interrupted.

  8. #8
    MSgt. Shooter Person
    Join Date
    Mar 2003
    Posts
    353

    Default

    Ok all I got it thanks.

    I used the Wiki tutorial on creating reloading weapons, and coupled it with a cheap a$$ trick using a fake time elapsing trick. When the firing starts, the timer gets set to whatever the time elapsed is. Then when the firing is over, if the elapsed time - the time when the firing started isn't more than a given amount, then the weapon reload doesn't get applied.

    In other words, if enough time hasn't elapsed, the reload doesnt do shyte except for play the animation. If the animation finishes, then enough time has passed for it to pass my test. Yay.

  9. #9
    Redeemer
    Join Date
    Dec 2003
    Location
    PHiNQ.com
    Posts
    1,266

    Default

    Originally posted by cknight52
    cheap a$$ trick using a fake time elapsing trick
    Dude, it's all smoke and mirrors anyway. It's only cheap if it's an online hacksploit.

    Dicky B (otherwise, it's clever)
    Hi.

  10. #10
    Redeemer
    Join Date
    Sep 2002
    Posts
    1,517

    Default

    inspired by one of my favorite shirts...and shows.

    its not stupid. its...ADVANCED! :bulb:

  11. #11
    Redeemer
    Join Date
    Dec 2003
    Location
    PHiNQ.com
    Posts
    1,266

    Default

    Originally posted by Bonehed316
    inspired by one of my favorite shirts...and shows.

    its not stupid. its...ADVANCED! :bulb:
    It's not a bug, it's a FEATURE!

    and when I was living alone, doing the single life thing:

    It's not just clean, it's BACHELOR clean!

    Dicky B (you know, looks clean, but don't open the closets)
    Hi.

  12. #12
    Redeemer
    Join Date
    Sep 2002
    Posts
    1,517

    Default

    dont open the closets, or look under ANYTHING. and nevermind that smell...


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.