View Full Version : New Weapons help

07-25-2010, 09:53 PM
So I'm rather confused on how to make new weapons here. weapons seem to be a few things:
the models (mdl, ctx, etc), the .txt script (damage, firespeed, reload speed, sounds it uses), and the .cpp/.h (the code of what it does).

Basically I want to make a "freeze" flamethrower. For simplicity I Just wanted to change the alt-fire extinguisher to be "ice gun". This seemed pretty simple...find out what makes the sentry freeze people, and then apply it to the flamethrower instead of the extinguishing. However, I can't find where to put the .cpp files in the addon folder. :| I think I need to tell the script file to use it, but I don't know how. Am I missing something here?

Is there a reslist or weapons list file that I need to modify in order to put tell it to use the new .cpp or does the .cpp file have a specific folder. I've tried finding it...but there seems to be no game directory for .cpp files in the .vpk :o

I admit, I am not an experienced coder or anything so I could just be doing this wrong. So if someone could tell me a "step 1/2/3+" of making a new weapon or changing an existing weapon (outside of damage done and easy stuff like that) that would be great.
tl;dr: How the hell do you make a custom weapon?

Also yes, I just lurk the forums, this is my first post :cool:

07-26-2010, 10:26 AM

not sure anyone has done this type of custom weapon yet.

This is the base weapon class for all Alien Swarm weapons.

This holds the static data associated with each weapon type, read from the weapon script files in swarm/scripts.

All alien swarm weapons extend the CASW_Weapon class so i would look at how the other weapons are being created.

You can copy the .h and .cpp file of a weapon class, edit the class name and get rid of the code you dont want. If you want to know specifically how its doing something you will need to know how to read c++. What specifics are you running into that you dont understand?

07-26-2010, 10:54 AM
i did this in the latest version of my modifications. Its fairly easy.
In the alt fire of the flamethrower i inserted the freeze grenade, freeze alien function. Basically just call that where finds out it a person or not and yea.

07-26-2010, 11:51 AM
Lacus, where did you put the cpp file in your addon? Thats what I need to find out :<

07-26-2010, 01:00 PM
it goes in game/shared/swarm.
then you have to add it to the client and server projects in shared/swarm

07-26-2010, 04:15 PM
Hmm...so in my addon folder where would I put it?

07-26-2010, 09:33 PM
If you still want to create a new weapon... the way i suggest starting is by simply copying one of the existing weapons and just renaming it/changing a few of the properities and see if you can get it to compile first before you plan too much.

Here is what i did to the flamethrower to get it to freeze on alt fire.

In asw_weapon_flamer_shared.cpp
put #include "asw_grenade_freeze.h" at the top

Then i simply inserted this line in the area where it will check for extinguishing people.
ASWGameRules()->FreezeAliensInRadius( pMarine, 1.0f, GetAbsOrigin(), 220.0f );

I put that line after this DispatchEffect( filter, 0.0, "ExtinguisherCloud", data );}