Page 1 of 1

Pose parameter

Posted: Sun May 14, 2023 1:28 pm
by rovizon
Hello!

I have created a prop_dynamic_override entity and want to change its pose.
Because I didn't see any changes with this code in CSS (it do change only once after spawning and when i collapse and expand the game, why?) (in CS GO it works good):

Syntax: Select all

entity.set_property_float('m_flPoseParameter.000', 0.85)


I decided to try change pose with a function call CBaseAnimating::SetPoseParameter.
This function takes as the first argument CStudioHdr *pStudioHdr. How to find this argument of my entity?

https://github.com/ValveSoftware/source ... 2-L1213C12

Re: Pose parameter

Posted: Sun May 14, 2023 4:09 pm
by L'In20Cible
Technically, you could get it by reading CBaseAnimating::m_pStudioHdr:

Syntax: Select all

entity.get_pointer(
entity.datamap.find('OnIgnite').offset
+ get_size(BaseEntityOutput)
+ 4
)
However, it needs to be locked by CBaseAnimating::LockStudioHdr first for it to be defined. Therefore, your best bet is probably to call CBaseAnimating::GetModelPtr directly and let it handle the locking for you. Here's the (untested) signature:

Code: Select all

 A1 ? ? ? ? 56 8B 30 8B 01 FF 50 18 8B 0D ? ? ? ? 50 FF 56 04 5E C3

Re: Pose parameter

Posted: Sun May 14, 2023 5:40 pm
by rovizon
Thank you for help!

Now call function is working but there are no changes on the model as well as with the code from the first post. Perhaps something is wrong with the model? Going to find out.

Syntax: Select all

import memory
from memory import Convention, DataType

server = memory.find_binary('server')

get_model_ptr = server['_ZN14CBaseAnimating11GetModelPtrEv'].make_function(
Convention.THISCALL,
[DataType.POINTER],
DataType.POINTER
)

set_pose_param = server['_ZN14CBaseAnimating16SetPoseParameterEP10CStudioHdrif'].make_function(
Convention.THISCALL,
[DataType.POINTER, DataType.POINTER, DataType.INT, DataType.FLOAT],
DataType.FLOAT
)

model_ptr = get_model_ptr(entity.pointer)

""" Return right values so everything is working properly? """
print(set_pose_param(entity.pointer, model_ptr, 0, 0.15))
print(set_pose_param(entity.pointer, model_ptr, 1, 0.15))

Re: Pose parameter

Posted: Sun May 14, 2023 6:48 pm
by rovizon
Just discovered that in CSS changing m_flPoseParameter work if disabled client side animation. In CSGO it worked without this.

Syntax: Select all

entity.set_property_bool('m_bClientSideAnimation', False)
entity.set_property_float('m_flPoseParameter.000', 0.85)