HL2: Using VS 2013 to compile Beta weapons for Retail
 

0 Пользователей и 1 Гость просматривают эту тему.

  • Citizen
  • *
  • Сообщений: 27
    • Просмотр профиля
Hello! Yesterday, I was making a HL2 Mod, called Sandbox. I wanted to check 2013 source code of HL2, and I found interesting detail: HL2 has HL2 Beta weapons, and they have fully working code! We are going to talk about this today (without screenshots  ;))
Also, you need to download Visual Studio 2013. I'll use Express edition
So, first of all, we need 2013 source code. You can easily find it in Google, but i'll leave it here: https://github.com/ValveSoftware/source-sdk-2013
Okay, we have the code. Unzip the sp/src folder somewhere.
Now we have Single Player code. We need to compile Solution, to make something, so we will use createallprojects.bat, which will compile solution for us
So, we got our sweets. Open it, and change configuration from Debug to Release.
There is one small thing. Solution don't use HL2 Beta weapons, so add it! For e.g, I will use Sniper Rifle.
1. Search for "Server (HL2)"
2. Open Source Files folder
3. Right click on "HL2 DLL", Add/Existing Item
4. Go to game/server/hl2 and search for weapon_sniperrifle.cpp
Hooray! We now have Sniper Rifle in, but, actually, it will compile code without sniper rifle. We need to edit C_weapon__stubs_hl2.
1. Click on Search Solution Explorer
2. Type "C_weapon__stubs_hl2.cpp"
3. Open it
4. After Citizen Suitcase, print this "STUB_WEAPON_CLASS(weapon_sniperrifle, WeaponSniperRifle, C_BaseHLCombatWeapon);"
Now, you can compile the code, search for client and server.dll, and drop it into your bin folder
This is not end  :D. Some weapons doesn't have script file. All you need to do, is just search it in hl2 beta. That's all! You can convert model from beta to retail, copy materials and sounds.
The last steps: Open your mod/hl2, go to, for e.g d1_canals_01, and type in console "give weapon_sniperrifle". Good luck!

This is my first post, and my English might suck. Sorry for my problems, if there are problems  ;)

rataj

  • Good Citizen
  • *
  • Сообщений: 77
    • Просмотр профиля
To add a new weapon to the impulse 101 command,
you need to open the player.cpp file in
source-sdk-2013-master\sp\src\game\server\player.cpp

Serach for „case 101:"
and add GiveNamedItem( "weapon_sniperrifle" ); after weapon_crossbow entry.

&
Thank you for the LiTE Tutorial! A+

Отредактировано: 03 Мар 2021, 21:49:27 от rataj
~ Rex, Familia et Ultio ~
  • Citizen
  • *
  • Сообщений: 27
    • Просмотр профиля
New thing:
For some weapons, you can just make duplicate them. For e.g - SMG1 and SMG2, you can just duplicate original weapon, re-name them, and compile