Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding

Reply
 
Thread Tools Display Modes
Old 07-01-2007, 11:33 AM   #1
Nial
 
 
 
Guest
Posts: n/a
Ragdolls

I have various questions regarding ragdolls. I'm working with the HL2DM mod base. I was originally looking into making ragdoll pickups with the gravity gun (similar to the end of HL2 Single Player). After some testing with server side ragdolls (and the network traffic that they create), I decided this wasn't really a practical idea. I've come up with an alternative solution.

Right now, I'm trying to check when a living player is standing over a corpse/ragdoll. Here's some simple test code:

Code:
	trace_t	trace;
	UTIL_TraceEntity( this, GetAbsOrigin(), GetAbsOrigin() - Vector(0,0,256), MASK_ALL, &trace );

	if( trace.m_pEnt && trace.m_pEnt->GetBaseAnimating() && trace.m_pEnt->GetBaseAnimating()->IsRagdoll() ) Msg("Is a ragdoll");
Sadly, this doesn't seem to be working at all. I wanted to ask how you guys would suggest:

A) Detecting when a player was standing over a ragdoll
B) If it was possible to link the ragdoll with a player (i.e: which player created that particular ragdoll).

Finally, to be able to do the above checks, would it be necessary to create server-side ragdolls?
 
Reply With Quote
Old 07-01-2007, 11:30 PM   #2
siodmak
 
 
 
Guest
Posts: n/a
A) look at the Use() function (or any other it uses, maybe FindUseEnt()). It checks whether the entity you try to pick up is GetGroundEnt() or something similar (don't remember)
B) simply add a variable, add it as a field to the ragdoll's class and fill it upon creation (you want to look at CreateServerSideRagdoll() or CBaseSomething::BecomeRagdoll()... it's somewhere in CAI_BaseNPC)

when I check if tr.m_pEnt is a ragdoll I just do if( FClassnameIs(tr.m_pEnt, "prop_ragdoll") ) or if( dynamic_cast<CRagdollProp*>(tr.m_pEnt) )

hope this helps
  Reply With Quote
Old 07-02-2007, 07:46 AM   #3
Nial
 
 
 
Guest
Posts: n/a
I also wanted to know if it was possible to 'freeze' a server-side ragdoll. So that after its initial reaction to the force that caused the players death, it would freeze and essentially become a static prop?
  Reply With Quote
Old 07-02-2007, 11:06 AM   #4
siodmak
 
 
 
Guest
Posts: n/a
theRagdoll->VPhysicsGetObject()->SetMotionEnabled(false); //should help
  Reply With Quote
Old 07-02-2007, 11:39 AM   #5
Nial
 
 
 
Guest
Posts: n/a
I'm really looking to be able to manipulate ragdolls via the physgun, but I'm not having much luck. From my investigation, someone suggested adjusting the flags that ObjectCaps returns. But I'm not entirely certain what ObjectCaps actually signifies.
  Reply With Quote
Old 07-02-2007, 11:47 AM   #6
Penumbra
 
 
 
Guest
Posts: n/a
The ObjectCaps method can be used to set a entity to 'useable' or not.
A piece of sample code:
Code:
//-----------------------------------------------------------------------------
// Purpose: Returns ObjectCaps() with possibility of using the Victim
//-----------------------------------------------------------------------------
int CVictim::ObjectCaps( void )
{
	int caps = BaseClass::ObjectCaps();

	return caps |= FCAP_ONOFF_USE;
}
This code makes my victim (which is a ragdoll entity) useable for the user. FCAP_ONOFF_USE means that the player has to keep pressing 'use' while standing close to the victim. There are multiple FCAPs, so you'll have to check if there is something in it for you.

FindUseEntity() in (I thought) Player.cpp traces a line from the player's viewpoint forward and checks if entities colliding with that line are useable. It will check for these ObjectCaps...

Hopes this helps!

Edit: By the way, can't you just check the code of the superduper physicsgun from HL2?

Last edited by Penumbra: 07-02-2007 at 11:50 AM.
  Reply With Quote
Old 07-02-2007, 03:29 PM   #7
Nial
 
 
 
Guest
Posts: n/a
Quote:
By the way, can't you just check the code of the superduper physicsgun from HL2?
As far as I can tell, the mega-physcannon doesn't do anything particularly special. If a player is killed by it, then the code just creates a server-side ragdoll (rather than a client-side one). For some reason, my server-side ragdolls cannot be manipulated by my mega-physcannon.

Bullets also pass straight through them.
  Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Tool Discussions > Source Coding


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -7. The time now is 11:16 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2012, All Rights Reserved.