Thread: Can player models use random idle animations?

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Apr 2019
    Posts
    10

    Can player models use random idle animations?

    I've been working on a personal player model (using The303's Compile-o-matic as a base), and I've noticed that player models have three identical idle animations: idle, look_idle, and deep_idle.

    I was hoping that I could take advantage of the two redundant idle animations, and inject a little extra variety into "act_idle" by altering the "action tag" weighting numbers for these animations in anims.qc, as they're seemingly used for animations tagged with "die_backwards" and "die_headshot". Unfortunately I haven't had any luck getting my own values to work in-game. I'm assuming this is just an unmentioned restriction for player models, but it's better to ask and be sure.

    Can player models make use of custom weighting numbers to trigger random animations, or does the engine completely ignore custom values for player models?

  2. #2
    Regular player DNIO071's Avatar
    Join Date
    Mar 2016
    Location
    Argentina
    Posts
    74

    Re: Can player models use random idle animations?

    Someone else might be able to confirm this but I'm pretty sure the game only uses deep_idle.

    Player models change animations according to their index and do not depend entirely of their action tag, this is why old models play random animations since they're missing the new ones introduced in version 5.0
    Have a nice day, no matter what you went through it'll all be okay by tomorrow.

  3. #3
    Registered User
    Join Date
    Apr 2019
    Posts
    10

    Re: Can player models use random idle animations?

    Quote Originally Posted by DNIO071 View Post
    Someone else might be able to confirm this but I'm pretty sure the game only uses deep_idle.
    After a little more testing, it seems Sven uses "idle" while unequipped. Though that said, once you get a weapon or health pack, the idle animation seems to revert to "ref_aim_X" where X is the equipped item — this basically strikes out what I was hoping to achieve anyway lol, oops.

    For what it's worth: When I say "random animation", I'm talking about the weight number following action tags.
    Code:
    anims.qc from The303's Compile-o-matic
    
    // Idles & movement
    $sequence "look_idle" "../_ANIMATIONS/look_idle" fps 14 loop ACT_IDLE 1 
    $sequence "idle" "../_ANIMATIONS/idle" fps 14 loop ACT_IDLE 1 
    $sequence "deep_idle" "../_ANIMATIONS/deep_idle" fps 12 loop ACT_IDLE 4 
    ...
    
    // Deaths
    ...
    $sequence "die_backwards1" "../_ANIMATIONS/die_backwards1" fps 26 ACT_DIEBACKWARD 4 { event 2001 13 } 
    $sequence "die_backwards" "../_ANIMATIONS/die_backwards" fps 30 ACT_DIEBACKWARD 2 { event 2001 15 } 
    ...
    $sequence "headshot" "../_ANIMATIONS/headshot" fps 24 ACT_DIE_HEADSHOT 4 { event 2001 22 } 
    $sequence "die_spin" "../_ANIMATIONS/die_spin" fps 30 ACT_DIE_HEADSHOT 2 { event 2001 16 }
    Going by the GoldSrc QC compile commands glossary on The303's site: Using a "1" after an action tag supposedly means that any amount of randomization is disabled, while higher numbers should cause an animation to play more frequently than animations with lower numbers - within the same action tag.

    By those rules, "look_idle" and "idle" both cancel out the random weighting for "act_idle", so the weight tag on "deep_idle" does nothing. But, the action tags "act_diebackwards" and "act_die_headshot" both feature two animations each, with weight numbers higher than "1", suggesting that there's supposed to be a random chance of viewing either animation. I haven't tried to test whether deaths-via-headshot actually have a random chance of playing one of the two headshot death animations, and The303's QC glossary says that weighting numbers are only used for monsters anyway, so I don't know if Sven is even doing anything with these extra animations.

    My original hope was that the weight numbers for "act_idle" could be altered, so that "act_idle" would have a random chance of playing any of the three animations. It'd be nice to have more freedom with player model animations (plus more control/documentation for how animations are compiled and used in-game), but I'm gonna move onto other stuff for now. Maybe these player model limitations could change in a later major update?
    Last edited by Lollie; 11-04-2019 at 06:17 AM. Reason: source of code, highlighting values

  4. #4
    Registered User
    Join Date
    Jul 2019
    Posts
    2

    Re: Can player models use random idle animations?

    As said above its entirely possible that specific animations are called in code by their sequence name and not by ACT

    IE like in hgrunt.cpp
    iSequence = LookupSequence("smflinch");
    vs
    iSequence = LookupActivity(ACT_SMALL_FLINCH)
    Otherwise you sure can as long as they use the same ACT_
    The weight number after the action tag determines how likely it will be randomly picked. So higher number means more likely to be picked.

    If you want purely random keep them all at one for example:


    $sequence "idle1" "..\scientist\idle1" fps 7 ACT_IDLE 1
    $sequence "idle3" "..\scientist\idle3" fps 12 ACT_IDLE 1
    $sequence "idle4" "..\scientist\idle4" fps 12 ACT_IDLE 1
    $sequence "idle5" "..\scientist\idle5" fps 13 ACT_IDLE 1
    $sequence "idle6" "..\scientist\idle6" fps 13 ACT_IDLE 1
    $sequence "idle7" "..\scientist\idle7" fps 13 ACT_IDLE 1

    This is how I switched up scientist animations in my mod etc

    $sequence "ACT_EXCITED1" "..\scientist\panic" fps 18 ACT_EXCITED 1
    $sequence "ACT_EXCITED2" "..\scientist\cower_handsup" fps 18 ACT_EXCITED 1
    $sequence "ACT_EXCITED3" "..\scientist\fear1" fps 18 ACT_EXCITED 1
    $sequence "ACT_EXCITED4" "..\scientist\fear2" fps 18 ACT_EXCITED 1
    Last edited by defragen1; 01-07-2019 at 07:47 PM.

  5. #5
    Registered User
    Join Date
    Apr 2019
    Posts
    10

    Re: Can player models use random idle animations?

    This is all good and well for NPCs, like scientists and enemies, but that wasn't my issue. My problem was trying to play randomized animations specifically on 3rd-person player models.

    Ultimately though, it turned out that it doesn't matter:
    Quote Originally Posted by Lollie View Post
    After a little more testing, it seems Sven uses "idle" while unequipped. Though that said, once you get a weapon or health pack, the idle animation seems to revert to "ref_aim_X" where X is the equipped item — this basically strikes out what I was hoping to achieve anyway lol, oops.
    Once you're armed, the "ACT_IDLE" animations are no longer used by the 3rd-person player model. So even if I could have gotten random animations working on a player model, it would have been wasted effort - unless I created multiple idle animations for every single weapon. And like, no lol, that's not happening.

  6. #6
    REE3 The303's Avatar  
    Contributor
    Join Date
    Jul 2015
    Posts
    398

    Re: Can player models use random idle animations?

    Yeah Playermodels are bound by various limitations vs NPC models, also the order of animations being an issue as well. Also did you get my DM? Id like to discuss some more technical stuff

  7. #7
    Registered User
    Join Date
    Jul 2019
    Posts
    2

    Re: Can player models use random idle animations?

    I'm pretty sure I've tested randomized animations on the player and my mod being completely thirdperson.

    The thing is - weapon animations are not bound to ACTs it seem

    While things like idle or death animation
    IE
    $sequence "die_back1" "..\operator\die_back1" fps 30 ACT_DIE_BACKSHOT 1 { event 2001 10 }
    $sequence "die_back2" "..\operator\die_back2" fps 30 ACT_DIE_BACKSHOT 4 { event 2001 9 }
    $sequence "headshot" "..\operator\headshot" fps 30 ACT_DIE_HEADSHOT 4 { event 2001 23 }
    $sequence "headshot2" "..\operator\headshot2" fps 30 ACT_DIE_HEADSHOT 1 { event 2001 16 }
    Those are randomized death animations etc
    The ultimate solution would be to have your own code and control everything yourself - then you'll eliminate any problem for whatever you're trying to do.

    Also if you had ACTs for weapons animations you don't have to have more than one animation for each weapons idle/aim.

    For example one weapon could have 3 idles while the rest 1, its whatever you put in the qc - they don't all have to be equal amounts.

    In source you can add custom ACTs to activity.h !? but I think its also possible to do it somehow in HL1. The problem is studiomdl might not recognize it - so you might need a custom model compiler as well

  8. #8
    Registered User
    Join Date
    Apr 2019
    Posts
    10

    Re: Can player models use random idle animations?

    Quote Originally Posted by defragen1 View Post
    The ultimate solution would be to have your own code and control everything yourself - then you'll eliminate any problem for whatever you're trying to do.
    I have doubts about how appropriate this would be for Sven Coop, lol. This was literally just for a custom player model in standard Sven multiplayer, rolling custom code for this would be overkill. (If it's even possible. I don't have the right skills to investigate it, lol.)

    If I ever find myself making another model for Half-Life 1/Sven Coop, I'll experiment further. But at this point, I'm pretty certain that the original plans for my player model's animations are dead in the water. Sven's devs would have to lift the animation limits for player models so that they're on par with NPCs.

    Quote Originally Posted by The303 View Post
    Also did you get my DM? Id like to discuss some more technical stuff
    Hell, it slipped from memory, I'm so sorry! Checking it now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •