Quake3World.com Forums
     Programming Discussion
        Adding/replacing weapons; how to force them into maps


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Adding/replacing weapons; how to force them into maps

eepberries
eepberries
Joined: 24 Jan 2005
Posts: 1848
PostPosted: 10-14-2005 01:12 PM           Profile   Send private message  E-mail  Edit post Reply with quote


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




Top
                 

Recruit
Recruit
Joined: 09 Sep 2005
Posts: 9
PostPosted: 10-14-2005 01:32 PM           Profile Send private message  E-mail  Edit post Reply with quote


Look at Pickup_Weapon in g_items.c, you can change what weapon is given to the player when they touch a weapon. That's server side, client side it looks like there's more to be done, but that should get you started.




Top
                 

eepberries
eepberries
Joined: 24 Jan 2005
Posts: 1848
PostPosted: 10-14-2005 01:51 PM           Profile   Send private message  E-mail  Edit post Reply with quote


How do I do that? Also, isn't that a problem in the first place due to the fact that the map is trying to call up weapons that no longer exist?




Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 10-14-2005 02:00 PM           Profile Send private message  E-mail  Edit post Reply with quote


Alter the appropriate entries in the bg_itemlist[] array in game/bg_misc.c.




Top
                 

eepberries
eepberries
Joined: 24 Jan 2005
Posts: 1848
PostPosted: 10-16-2005 10:07 AM           Profile   Send private message  E-mail  Edit post Reply with quote


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...




Top
                 

Gomu Gomu no.....
Gomu Gomu no.....
Joined: 07 Aug 2003
Posts: 1902
PostPosted: 10-16-2005 10:29 AM           Profile Send private message  E-mail  Edit post Reply with quote


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)-

-An eyeful a day is bloody fantastic!-


Top
                 

Warrior
Warrior
Joined: 26 Nov 2000
Posts: 85
PostPosted: 10-17-2005 02:19 PM           Profile Send private message  E-mail  Edit post Reply with quote


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 );




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.