[ANY/CSGO] Ragdoll PhysicsObject
[ANY/CSGO] Ragdoll PhysicsObject
I've been messing around with server side ragdolls (prop_ragdoll), and I've ran into a wall. Since the ragdoll is made up of individual parts, I need to access certain bones, but I have no idea where to start (well.. sort of). There's this ragdoll_t struct that I keep seeing within the SDK, which has a list of ragdollelement_t and this element struct has what I need - an IPhysicsObject. Any suggestions as to how I could access this would be greatly appreciated!
- L'In20Cible
- Project Leader
- Posts: 1536
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Re: [ANY/CSGO] Ragdoll PhysicsObject
Syntax: Select all
for i in range(1, ragdoll.get_datamap_property_int('m_ragdoll.listCount')):
ragdoll.get_datamap_property_pointer(f'm_ragdoll.list[{i}].pObject')
Re: [ANY/CSGO] Ragdoll PhysicsObject
Thank you so much L'In20Cible! While I have you here, could you tell me what I'm doing wrong with this?
Syntax: Select all
# ../ragdolls/ragdolls.py
# Source.Python
from entities.entity import Entity
from events import Event
from memory import make_object
from physics import PhysicsObject
from players.dictionary import PlayerDictionary
player_instances = PlayerDictionary()
@Event('player_death')
def player_death(event):
player = player_instances.from_userid(event['userid'])
ragdoll = Entity.create('prop_ragdoll')
ragdoll.model = player.model
ragdoll.owner_handle = player.owner_handle
ragdoll.origin = player.origin
ragdoll.angles = player.angles
ragdoll.spawn()
ragdoll.delay(4.1, ragdoll.remove)
for i in range(1, ragdoll.get_datamap_property_int('m_ragdoll.listCount')):
ptr = ragdoll.get_datamap_property_pointer(
f'm_ragdoll.list[{i}].pObject')
physics_object = make_object(PhysicsObject, ptr)
Syntax: Select all
[SP] Caught an Exception:
Traceback (most recent call last):
File "..\addons\source-python\packages\source-python\events\listener.py", line 92, in fire_game_event
callback(game_event)
File "..\addons\source-python\plugins\ragdolls\ragdolls.py", line 30, in player_death
physics_object = make_object(PhysicsObject, ptr)
ValueError: Unable to make an object using this class.
- L'In20Cible
- Project Leader
- Posts: 1536
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Re: [ANY/CSGO] Ragdoll PhysicsObject
VinciT wrote:Thank you so much L'In20Cible! While I have you here, could you tell me what I'm doing wrong with this?
Nothing wrong, it's just that memory tools were not implemented for that class. Those have been added into 895338e.
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 122 guests