Raised This Month: $ Target: $400
 0% 

Creating a prop_ragdoll


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hjkwe654
Senior Member
Join Date: Sep 2005
Location: Taiwan
Old 06-07-2011 , 09:56   Creating a prop_ragdoll
Reply With Quote #1

PHP Code:
new Float:fOriginWatching[3], Float:fOriginFront[3], Float:fAngles[3], Float:fRadiansXFloat:fRadiansY;
        
GetClientEyePosition(ClientfOriginWatching);
GetClientEyeAngles(ClientfAngles);
        
fRadiansX DegToRad(fAngles[0]);
fRadiansY DegToRad(fAngles[1]);
        
fOriginFront[0] = fOriginWatching[0] + (100 Cosine(fRadiansY) * Cosine(fRadiansX));
fOriginFront[1] = fOriginWatching[1] + (100 Sine(fRadiansY) * Cosine(fRadiansX));
fOriginFront[2] = fOriginWatching[2] - 30;

new 
iEntity CreateEntityByName("prop_ragdoll");;
DispatchKeyValue(iEntity"spawnflags""10");
DispatchKeyValue(iEntity"model""models/Police.mdl");
SetEntProp(iEntityProp_Data"m_nSolidType"6);
SetEntProp(iEntityProp_Data"m_CollisionGroup"5);
TeleportEntity(iEntityfOriginFrontNULL_VECTORNULL_VECTOR);
DispatchSpawn(iEntity); 
When i use this code to spawning a ragdoll, server will crash with a message: bad vphysics swap for prop_ragdoll.

Is anyway to probably create a prop_ragdoll without crash?
hjkwe654 is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 06-07-2011 , 16:14   Re: Creating a prop_ragdoll
Reply With Quote #2

Did you try to spawn it with only the model set without touching the solid type or collision group?
__________________
Peace-Maker is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-07-2011 , 16:24   Re: Creating a prop_ragdoll
Reply With Quote #3

Its the collision group being set in Prop_Data that causes the crash (had it a number of times) Use Prop_Send instead.

When spawning ragdolls, I was never able to set the previous clients animation, so they would fall from the T pose. That was in L4D2 anway.
__________________
Silvers is offline
hjkwe654
Senior Member
Join Date: Sep 2005
Location: Taiwan
Old 06-08-2011 , 07:28   Re: Creating a prop_ragdoll
Reply With Quote #4

Thanks to Peace-Maker.
PHP Code:
new iEntity CreateEntityByName("prop_ragdoll");
DispatchKeyValue(iEntity"model""models/Police.mdl");
DispatchSpawn(iEntity);
TeleportEntity(iEntityfOriginFrontNULL_VECTORNULL_VECTOR); 
Can create it without crash. Btw, its not need to set Prop_Data or Prop_Send when creating a prop_ragdoll?

Last edited by hjkwe654; 06-08-2011 at 07:30.
hjkwe654 is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 07:11.


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