Submodels change when monster performs action Created 1 year ago2022-05-22 23:55:42 UTC by jamie jamie

Created 1 year ago2022-05-22 23:55:42 UTC by jamie jamie

Posted 1 year ago2022-05-22 23:55:42 UTC Post #346540
Hey, so im making a mod and Barney has a 2 submodels:
  • Normal one
  • HEV one
However, when Barney receives damage or stops shooting it changes to the normal/HEV one. I dont know why this is happening. Can anyone help me?
Posted 1 year ago2022-05-23 21:19:21 UTC Post #346541
You can swap Barneys Head if memory serves correct but not his body mesh due to the way the Engine handles it.

I'm afraid that you need a custom code in order to get it to work the way you intend.

Zombies on the other hand had no special sub models like pistols and such things attached to their model which is why body model swapping works on them.
Posted 1 year ago2022-05-24 02:14:31 UTC Post #346542
So, is there any source code or something like that to make it work?
Posted 1 year ago2022-05-26 08:36:41 UTC Post #346552
I have seen this in Half-Life Extended SDK located here:

https://github.com/bacontsu/halflife-extended/tree/main/source-code
Posted 1 year ago2022-05-26 10:40:30 UTC Post #346553
Barney's one of the oldest NPCs and doesn't use the game's body group APIs, instead it directly modifies the pev->body variable so it doesn't respect the state of body groups.

To fix this in code you should use GetBodygroup and SetBodygroup instead.

You can see how that's done here: https://github.com/SamVanheer/halflife-unified-sdk/commit/2f27727b42a9f4ab7e104d178771b006df572f71#diff-c961f346030c270f9dc49f497b12c437c8a08940336ddad837d025428dc6b526R326-R338

Note that there are other places in the code where these changes are needed.

I'd suggest checking the latest version of that code to see what needs to be changed: https://github.com/SamVanheer/halflife-unified-sdk/blob/master/src/game/server/entities/NPCs/blackmesa/barney.cpp
You must be logged in to post a response.