I've been working on a small mod lately that: removes the plasmagun and railgun and replaces them with a "super nailgun" and "super shotgun". I've already coded both of these weapons into both game and cgame so that they function and can be received with the give command. The problem that I'm facing now is how to get them into currently existing maps, specifically the id maps, without having to re-distribute them (obviously because that's illegal and also because it's dumb). How can I do this? Is there some way that I can tell the game that when it finds say "wp_plasmagun" when loading the map to replace it with another weapon?
edit: I noticed one more thing. Once the rocket launcher is picked up, using the nextweapon command will allow the player to select an "invisible weapon." What I mean is that the hud selection box that shows which weapon is currently selected while you're switching through weapons, it moves to a nonexisting weapon past the last visible icon so that it's hovering over nothing, though both visually and in terms of gameplay you will still have the last valid weapon. Example: if the rocket launcher if the last valid weapon, once the non existant weapon is selected, the rocket launcher model is still displayed, rockets are still fired, rocket ammo is still subtracted, etc. Anyone know what's causing this and what I should do to fix it?
in case it helps, the current weapon list (in order):
gauntlet
nailgun (renamed machinegun)
super nailgun (variant of machinegun)
shotgun
super shotgun (variant of shotgun)
grenade launcher
rocket launcher
lightning gun
bfg
Adding/replacing weapons; how to force them into maps
-
- Posts: 1975
- Joined: Mon Jan 24, 2005 10:14 pm
-
- Posts: 1975
- Joined: Mon Jan 24, 2005 10:14 pm
-
- Posts: 4022
- Joined: Sat Mar 12, 2005 6:24 pm
-
- Posts: 1975
- Joined: Mon Jan 24, 2005 10:14 pm
Alright, sorry but I really don't get what exactly I'm supposed to do. I tried a few things and they didn't work. Also, I had another thought. Wouldn't it be a problem that the player is supposed to start off with the shotgun? Because of this, I will want to replace the shotgun pickups in maps with something else, but I can't just replace the shotgun entry in bg_itemlist...
-
- Posts: 304
- Joined: Fri Aug 08, 2003 7:00 am
If you want existing maps to work with your new weapons, you need to keep the same classname and just change the other things like the pickup name, icon and sounds, or check for the old weapons in g_spawn.c and replace the classname strings with your new weapons.
-It is not the fall that kills you. It's the sudden stop at the end. (Douglas Adams)-
[url=http://www.violationentertainment.com/misc/ccm]-An eyeful a day is bloody fantastic!-[/url]
[url=http://www.violationentertainment.com/misc/ccm]-An eyeful a day is bloody fantastic!-[/url]
FWIW, you can also do it at runtime in G_CallSpawn() (g_spawn.c), by simply changing item for the appropriate one and setting ent->classname based upon it, before it spawns it. eg, something like this:
if (!strcmp(ent->classname, "some_classname"))
{
item = BG_FindItemForWeapon(WP_MACHINEGUN);
ent->classname = item->classname;
}
:
G_SpawnItem( ent, item );
if (!strcmp(ent->classname, "some_classname"))
{
item = BG_FindItemForWeapon(WP_MACHINEGUN);
ent->classname = item->classname;
}
:
G_SpawnItem( ent, item );