Wavelength Logo
tl.jpg (2351 bytes) blank.gif (837 bytes) tr.jpg (2446 bytes)
blank.gif (837 bytes)
Basic Half-Life Weapon Coding by PsychoDude
blank.gif (837 bytes)

Click here for the printable version of this tutorial

Note: This tutorial is meant for people fluent in C++, and who know how to create levels in Worldcraft. You must also know how to make the liblist.gam file. Making it is explained in "How to make a mod.doc" which comes with the SDK (or can be viewed here). You need to have Visual C++, preferably 5.0. It should work with 6.0 too.

In this tutorial, we'll be making a new weapon from scratch, rather than modifying or replacing Half-Life's existing weapons. Since I don't quite understand the client.dll yet (specifically, I can't get it to run), you'll have to use console commands to select your weapon after you make it.

Also, for this tutorial we'll be making a pulse laser (think "Star Wars"). The class name will be CBlaster, and the entity is weapon_blaster. Our mod name will be "BlasterMod". So, go ahead and create a BlasterMod subdirectory of Half-Life, and put your liblist.gam in it, with the appropriate keys and values.

 

Preparing The Level

Let's create our level ahead of time. Note that when creating new entities, such as weapons, you must have a matching Worldcraft entity . If you don't, it will generate a "Bad IndexOfEdict()" error when you run Half-Life.

So, we'll create a new FGD file which tells Worldcraft the new entities. It couldn't be simpler. Create a file in plain text format (use Notepad or open it in Visual C++) and save it as "(half-life dir)\BlasterMod\BlasterMod.fgd". It doesn't actually matter what you call it, or where you save it as. Put these lines in it:

// Worldcraft game data file for BlasterMod.

@PointClass = weapon_blaster : "Blaster" []

@PointClass = proj_blaster : "Blaster Projectile" []

Now, in Worldcraft, go to Tools | Options and click the Game Configurations tab. 'Add' the BlasterMod.fgd file we just wrote. Click 'OK'. Now make your level (could be a hollow box, doesn't matter) and compile it as "BlasterMap.bsp".

 

blank.gif (837 bytes)
bl.jpg (2471 bytes) blank.gif (837 bytes) br.jpg (2132 bytes)