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:
I am not surprised that you have problems. The whole spawn module has been designed by a person who must be nuts. It is unnecessarily convoluted and very hard to understand.
I suspect that the cause of your problem is that you do not modify the 'giType' and 'giTag' fields of the item structure. Try to set them like this:
Hope this works (I have not tried it, to be honest).
EDIT:
I may have found a better solution. You could try to modify the function 'G_CallSpawn' in 'g_spawn.c'. There is a 'for' loop in which the function tries to find the item with the given classname. I have added the code I think is needed:
Code:
//_SP added if (strcmp(ent->classname, "ammo_bfg") == 0) strcpy(ent->classname, "ammo_plasma"); //_SP