AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [L4D2] Fixing body_yaw when incapped? / Set pose parameters? (https://forums.alliedmods.net/showthread.php?t=316787)

Shadowysn 06-10-2019 06:46

[L4D2] Fixing body_yaw when incapped? / Set pose parameters?
 
1 Attachment(s)
https://i.imgur.com/Nf94VD5.jpg
Imgur post

Although I couldn't quite manage it correctly, I made the commentary_dummy parented to Coach look back while incapacitated, thus giving us the impossible sight of a character looking back while incapped in L4D2.
(Also for some reason, the angles for the dummy always stay at 0 even though it's supposed to set them to the client's existing angles already.)

What I planned to do was to make the player's model invisible, parent a dummy model and set that model's pose parameters instead.
(A bug I encountered is that the pose parameters don't change while active for the dummy.)
The new version with atleast some functionality is attached below, the old version is in the original description.



Original Description
I attempted to fix it myself, but turns out that setting the pose parameter on a think hook does not appear to work.

For those that don't know, Valve managed to screw it up in-game, so incapacitated survivors face the front when the actual person's looking at the opposite direction.
The pose parameter I found that manipulated the bugged direction is body_yaw.

Here's some test code that prints out information and is supposed to set the pose parameter in a debuggy way:
Spoiler

Shadowysn 12-03-2019 22:21

Re: [L4D2] Fixing body_yaw when incapped? / Set pose parameters?
 
Should I... bump? Apologies if I'm breaking the rules, but I changed this thread from a simple asking-whether-it-can-be-fixed to there-was-an-attempt-but-I-failed.

cravenge 12-03-2019 23:43

Re: [L4D2] Fixing body_yaw when incapped? / Set pose parameters?
 
I never bothered looking at the source code so there's a mistake that I overlooked at. The think and event hooks are missing the public in their callbacks.

Shadowysn 12-03-2019 23:50

Re: [L4D2] Fixing body_yaw when incapped? / Set pose parameters?
 
Quote:

Originally Posted by cravenge (Post 2675595)
I never bothered looking at the source code so there's a mistake that I overlooked at. The think and event hooks are missing the public in their callbacks.

Huh? Is that needed?
I tested out my code with the void function and the PrintToChatAll debug functions worked and printed out the variables in chat.

Oh yeah, I just now figured out the check through a bit of trial-and-error, but it's not exact. It'll only get the old position before incapacitation, so if the player model's angles change then the check will not be synced.

cravenge 12-03-2019 23:58

Re: [L4D2] Fixing body_yaw when incapped? / Set pose parameters?
 
Quote:

Originally Posted by Shadowysn (Post 2675598)
Huh? Is that needed?
I tested out my code with the void function and the PrintToChatAll debug functions worked and printed out the variables in chat.

Tbh, I don't really remember if it's optional or not since I haven't been coding for so long and just came back recently.
Quote:

Originally Posted by Shadowysn (Post 2675598)
Oh yeah, I just now figured out the check through a bit of trial-and-error, but it's not exact. It'll only get the old position before incapacitation, so if the player model's angles change then the check will not be synced.

Either move to a 0.1 second repeating timer or hooking the other think functions to get that preciseness with minimal erroneous results.

Shadowysn 12-04-2019 00:10

Re: [L4D2] Fixing body_yaw when incapped? / Set pose parameters?
 
Quote:

Originally Posted by cravenge (Post 2675599)
Tbh, I don't really remember if it's optional or not since I haven't been coding for so long and just came back recently.

Either move to a 0.1 second repeating timer or hooking the other think functions to get that preciseness with minimal erroneous results.

Getting the angles just gets the player's angles, not the player model's.

Upon incapacitation, the survivor's visible model is set to stay in one angle while the actual angles of the player are still free to be changed by the player.
I couldn't find a netprop or anything that dictates that angle so I had to make do.

But I could potentially see it working if I added the right checks for crawling, landing on the ground, etc.

Lux 12-04-2019 07:13

Re: [L4D2] Fixing body_yaw when incapped? / Set pose parameters?
 
Animation stuff is usually done in PostThink, so a PostThinkPost hook should work.

Shadowysn 12-04-2019 07:25

Re: [L4D2] Fixing body_yaw when incapped? / Set pose parameters?
 
Quote:

Originally Posted by Lux (Post 2675622)
Animation stuff is usually done in PostThink, so a PostThinkPost hook should work.

Nope, still doesn't seem to be working.

cravenge 12-06-2019 10:50

Re: [L4D2] Fixing body_yaw when incapped? / Set pose parameters?
 
Like I said, move to a 0.1 second repeating timer instead of hooking the incapacitation event since it happens only once unless you want to fire it manually every time players stop crawling and stays in place but that would be messy.

Shadowysn 01-22-2020 01:25

Re: [L4D2] Fixing body_yaw when incapped? / Set pose parameters?
 
Quote:

Originally Posted by cravenge (Post 2675904)
Like I said, move to a 0.1 second repeating timer instead of hooking the incapacitation event since it happens only once unless you want to fire it manually every time players stop crawling and stays in place but that would be messy.

Well, there's one more in-game thing that could change the incap model's angles:
- Landing on the ground after being in the air. (Only seems to sometimes happen, and only just flips the angles.)

I gave up with the real player model and decided to use a parented commentary_dummy instead.


All times are GMT -4. The time now is 17:05.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.