Raised This Month: $51 Target: $400
 12% 

How do you spawn objects into a map on client commands?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kingnugget
Junior Member
Join Date: Apr 2005
Old 04-21-2005 , 16:52   How do you spawn objects into a map on client commands?
Reply With Quote #1

I am basically trying to create a grenade on a player death or client command and make it explode.
But this raises a basic question of creating objects in a game.

I found some code that looked like it might do the job for a smoke grenade, but I got loads of errors.

Code:
ParticleSmokeGrenade *pSmoke = dynamic_cast<ParticleSmokeGrenade*>( CreateEntityByName(PARTICLESMOKEGRENADE_ENTITYNAME) );
if ( pSmoke )
{
	Vector vForward;
	AngleVectors( GetLocalAngles(), &vForward );
	vForward.z = 0;
	VectorNormalize( vForward );

	pSmoke->SetLocalOrigin( GetLocalOrigin() + vForward * 100 );
	pSmoke->SetFadeTime(25, 30);	// Fade out between 25 seconds and 30 seconds.
	pSmoke->Activate();
	pSmoke->SetLifetime(30);
	pSmoke->FillVolume();
}
This gave me the error message (first of many): error C2065: 'ParticleSmokeGrenade' : undeclared identifier.
I added #include "particle_smokegrenade.h" but then got the error "..\..\dlls\baseentity.h(759) : error C2065: 'CPredictableId' : undeclared identifier".
Adding other include headers from this point spiralled down into loads errors.

I am missing something basis?
Are the any examples about for spawning objects into a game?
Kingnugget is offline
Kingnugget
Junior Member
Join Date: Apr 2005
Old 04-21-2005 , 18:19   Update
Reply With Quote #2

Still working on it, a little progress, very little.

I can get this code to compile
Code:
CBaseEntity *weapon = (CBaseEntity *)CreateEntityByName("weapon_grenade");
But I then get a linking error for CreateEntityByName().

unresolved external symbol "class CBaseEntity * __cdecl CreateEntityByName(char const *,int)"

I can see the function prototype for CreateEntityByName in baseentity.h.
When I add baseentity.cpp to my project I get a lot of compilation errors from baseentity.cpp.

Is this usual or am I doing something wrong in my project?? I'm running VC++6
Kingnugget is offline
vancelorgin
Senior Member
Join Date: Dec 2004
Location: san frandisco
Old 04-22-2005 , 10:01  
Reply With Quote #3

Search works wonders.
__________________
Avoid like the plague.
vancelorgin is offline
Kingnugget
Junior Member
Join Date: Apr 2005
Old 04-22-2005 , 15:23  
Reply With Quote #4

I've had a look, there's a lovely thread talking about including CBaseEntity, but for player info that's working already.
I couldn't find any threads that talk about resolving linking errors or creating new entities like a grenade.
Kingnugget 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 17:59.


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