Adding Weapons to a Half-Life 2 Mod.

14
Adding Weapons to a Half-Life 2 Mod.

description

Adding Weapons to a Half-Life 2 Mod. 3 Scopes of Chocolate Tutorial. Will not cover Modeling Coding Will cover Taking weapon code and model and putting them into the game. Dude, where’s my Weapon?. To put a weapon into the Mod, you will need one first. Create a new Single Player Mod. - PowerPoint PPT Presentation

Transcript of Adding Weapons to a Half-Life 2 Mod.

Page 1: Adding Weapons to a Half-Life 2 Mod.

Adding Weapons to a Half-Life 2 Mod.

Page 2: Adding Weapons to a Half-Life 2 Mod.

3 Scopes of Chocolate Tutorial

Will not coverModelingCoding

Will coverTaking weapon code and model and putting

them into the game.

Page 3: Adding Weapons to a Half-Life 2 Mod.

Dude, where’s my Weapon?

To put a weapon into the Mod, you will need one first.

Create a new Single Player Mod. In the SDK click on the button. Hit Next. Select the bullet. Hit Next. Put the Mod anywhere you can remember in 2

minutes, and name the mod anything you like. Compile the Single Player Mod.

We will be taking a weapon out of the single player game and putting it into your Mod.

Page 4: Adding Weapons to a Half-Life 2 Mod.

Takes Two to Tango

Each weapon has a series of animated models for each action it can do (Reload, fire, Ect.), and a .qc (text file) that links them together and allows to the code to use it.

The ones we will use are located at:

(You do not need to go here, or do anything on this slide, feel free to forget everything on it.)

Page 5: Adding Weapons to a Half-Life 2 Mod.

Yonik!

The model files now have to be added to our own Mod. Open up a command prompt and type in cmd Navigate to the “sourceSDK” folder in the steam

directory.

Page 6: Adding Weapons to a Half-Life 2 Mod.

Clato Naoto Victo?

Then type in this very long command:bin\studiomdl -game “D:\Steam\SteamApps\SourceMods\[moddirectory]" “D:\

Steam\SteamApps\[username]\sourcesdk_content\hl2\modelsrc\weapons\v_pistol\v_pistol.qc

(that’s all one line in the command prompt using your own directory information)

Page 7: Adding Weapons to a Half-Life 2 Mod.

Script Kittens

Script files contain basic variables dealing with objects in your mod, like guns, cars, and sounds.

They are not needed but make so that you don’t need to recompile your mod after small behavior changes.

(forget this page too)

Page 8: Adding Weapons to a Half-Life 2 Mod.

Let There Be Bullets …and Sound. In your (compiled) Single player(SP) mod, go to

the folder called Scripts. Copy the file called weapon_pistol.txt into your real

mods Script folder.

Page 9: Adding Weapons to a Half-Life 2 Mod.

Back in the SP mod Scrip folder, open the called game_sounds_weapons.txt Search for weapon_pistol.txt Copy all 8 methods in this file to your mods

game_sounds_weapons.txt file. You can’t just copy the game_sounds_weapons.txt

file over

Page 10: Adding Weapons to a Half-Life 2 Mod.

And here I thought I was an art major

Now the weapon must be put into code Download the file pistol.zip off of my website:

www.coe.uncc.edu/~rwhiting/weapon.zip This file hold the coding for the weapon itself. Create a file in your own mods (source) directory to hold

this file. Name it hl2r, and unzip it in the src\game_shared folder.

Page 11: Adding Weapons to a Half-Life 2 Mod.

20/20 Visual

Open your mods project in Visual by clicking on the in the src folder of your mods (source) directory.

Open the Solution Explorer (View-> solution Exploer)

Page 12: Adding Weapons to a Half-Life 2 Mod.

In the Client Tab, right click on the folder and click Add->New Folder. Call it HL2R.

Do the same thing under the Server Tab. Right click on the new HL2R folder in the client

Tab, and click . Navigate to the HL2R folder and add both files you put in there.

Do the same for the server tab.

Page 13: Adding Weapons to a Half-Life 2 Mod.

Time to wake up! Click on Build-> solution

Then wait for the output to give you no errors because you did everything right.

Page 14: Adding Weapons to a Half-Life 2 Mod.

Fin.

Special Thanks to:MSpaintHL2Coding.com (example pistol code)