Map entities
Posted: Sat Oct 20, 2012 7:08 pm
Hi,
I've being battling to find a way to replace entities in a map at map loading time. After numerous attempts I've run out of ideas. I've worked my way all the way back to G_SpawnEntitiesFromString() trying to figure it out, alas, no luck! Here's my latest (quick) attempt to load ammo_bfg entities as ammo_cells:
g_items.c:
void G_SpawnItem (gentity_t *ent, gitem_t *item) {
G_SpawnFloat( "random", "0", &ent->random );
G_SpawnFloat( "wait", "0", &ent->wait );
RegisterItem( item );
if ( G_ItemDisabled(item) )
return;
ent->item = item;
if ( !strcmp(ent->item->classname, "ammo_bfg" ) ) {
strcpy(ent->item->classname, "ammo_cells" );
strcpy(ent->item->pickup_name, "Cells" );
strcpy(ent->item->world_model[0], va("models/powerups/ammo/plasmaam.md3") );
}
...
}
It makes absolutely no difference. What am I doing wrong?
I've being battling to find a way to replace entities in a map at map loading time. After numerous attempts I've run out of ideas. I've worked my way all the way back to G_SpawnEntitiesFromString() trying to figure it out, alas, no luck! Here's my latest (quick) attempt to load ammo_bfg entities as ammo_cells:
g_items.c:
void G_SpawnItem (gentity_t *ent, gitem_t *item) {
G_SpawnFloat( "random", "0", &ent->random );
G_SpawnFloat( "wait", "0", &ent->wait );
RegisterItem( item );
if ( G_ItemDisabled(item) )
return;
ent->item = item;
if ( !strcmp(ent->item->classname, "ammo_bfg" ) ) {
strcpy(ent->item->classname, "ammo_cells" );
strcpy(ent->item->pickup_name, "Cells" );
strcpy(ent->item->world_model[0], va("models/powerups/ammo/plasmaam.md3") );
}
...
}
It makes absolutely no difference. What am I doing wrong?