.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 1 SDK (http://forums.bots-united.com/forumdisplay.php?f=33)
-   -   Having a problem creating a entity... (http://forums.bots-united.com/showthread.php?t=495)

EclipseX 25-01-2004 17:02

Having a problem creating a entity...
 
I know this probably ain't the place to ask this question, but when I try to spawn a new entity using a model I precahed before hand... seems to crash the server..


PHP Code:

 In DispatchSpawn:
   const 
char *pClassName STRING(pent->v.classname);
   
DWORD pCrc32 CRC32::Generate((BYTE *)pClassNameutils::mstrlen(pClassName));
   if (
pCrc32 == 0x13EF7D28)
   {
     
// "worldspawn"
     // Do all our level initialization shit here...
 
     // Precache the models & sounds...
     
PreCacheModel("models/crystal.mdl");
 
     
// Initialize the string-name...
     
locator::markerName AllocString("item_locmarker");
   }
 
 
In Locator::AddMarker:
   
// Create the entity... 
   
locs[s].ent CreateNamedEntity(markerName);
 
   
// Give the entity a model...
   
SetModel(locs[s].ent"models/crystal.mdl");
 
  
// Set the model size...
  
SetSize(locs[s].entvec3_t(-1, -1, -1), vec3_t(1,1,1));
 
  
// Set the model origin...
  
SetOrigin(locs[s].ent, (float *)&locs[s].origin);
 
  
// Spawn the entity...
  
Spawn(locs[s].ent); 

Upon adding a marker the server crashes... (swds.dll: 0656D166 89B8 34010000 MOV DWORD PTR DS:[EAX+134],EDI)

Pierre-Marie Baty 25-01-2004 22:01

Re: Having a problem creating a entity...
 
Is there an exported class for "item_locmarker" entities in your game DLL ? You can only add entities that are supported by the game DLL, not create new ones on the go.

EclipseX 26-01-2004 08:17

Re: Having a problem creating a entity...
 
doh! I completely forgot all about that thx for reminding me PM, how o_O I seem to be now LOL..

botman 26-01-2004 14:54

Re: Having a problem creating a entity...
 
"You can only add entities that are supported by the game DLL, not create new ones on the go."

Well..., not if you add hooks to your plugin to handle these new entities. :)

Take a look at my Monster plugin for metamod as an example of adding new entities to a MOD that doesn't normally support them. It's pretty complicated to get working properly and it has some limitations interacting with the game DLL code, but it can be done if you know what you are doing.

botman

Pierre-Marie Baty 26-01-2004 15:32

Re: Having a problem creating a entity...
 
heck, I am once again given lessons by the Jedi Master... thanks for correcting, botman ;)


All times are GMT +2. The time now is 02:57.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.