Valve Source Code 2013 Tutorial (Episode 25): Adding 3 Half-Life 2 Beta Weapons!

Ойындар

Hello everyone and welcome to a new (probably short) series of videos I do involving the source code from Valve for Half-Life 2, and some guides on how to do stuff with this code. In this celebratory episode, I outline how to add 3 Half-Life 2 Beta weapons into a Source 2013 Singleplayer mod, with those weapons being the combine guard gun, the immolator and the fire extinguisher. Thank you all for the comments and support of this series, there's plenty of other suggestions I can do videos about so I hope you'll stick around to see what comes out next! Please let me know what you think and see you for whatever I decide to do next, thanks for watching!
Timestamps
00:00 Preamble
03:23 Combine Guard Gun
06:12 Immolator
17:27 Fire Extinguisher
► You can buy me a coffee to support the effort of creating videos on my new channel! -- www.buymeacoffee.com/garethth...
► My new channel: GarethTheGamer -- / @gareththegamer1

Пікірлер: 93

  • @TheMaster974
    @TheMaster9742 ай бұрын

    UPDATE: At around 7:05, I outline an issue I experienced where the Immolator would fire bullets when it wasn't supposed to, plus it would have an incredibly high rate of fire so the ammo would be consumed nearly instantly. It seems as if a couple of commenters have experienced something like this too and I think the resolution to this issue is to remove the BaseClass::ItemPostFrame(); line which is seen at around 11:38, hopefully this helps!

  • @jeremymonedero3762
    @jeremymonedero37622 ай бұрын

    Man, you're here again :D you're a legend, thank you so much

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    Thanks for the comment!

  • @RModOfficial
    @RModOfficial2 ай бұрын

    another good video! nice!

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    Thanks for the comment!

  • @tyris4559
    @tyris45592 ай бұрын

    You are a LEGEND

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    Thank you!

  • @MazdoTheWolf
    @MazdoTheWolf2 ай бұрын

    it's here ! the beytah tutorial is real !!!

  • @RModOfficial

    @RModOfficial

    2 ай бұрын

    fr!!!

  • @The_psp_secret
    @The_psp_secret2 ай бұрын

    Appreciate it!

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    Awesome, thanks for the suggestion!

  • @banditboogaloo
    @banditboogalooАй бұрын

    HE DID MY REQUEST HOLY SHIT

  • @AeliaQ
    @AeliaQ2 ай бұрын

    You're the best! but also can you make a tutorial on how too add custom keybinds too the options menu keyboard panel

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    Thanks for the comment, however I'm not too sure about what it is you want me to look into because you can change the keybinds from the options menu to whatever you want, or you can modify config.cfg.

  • @vaturakd7846
    @vaturakd7846Ай бұрын

    Hey @TheMaster974 I have a question about modding. Ive never saw an video or tutorial in the internet where its shown how to make your own hl2.exe and edit something of this file.

  • @TheMaster974

    @TheMaster974

    Ай бұрын

    Thanks for the comment, it is technically possible to create your own hl2.exe file, but it's not really worth doing because it won't launch the game (at least it doesn't from my testing). I talk about it in this video if you want to learn more about it: kzread.info/dash/bejne/i6aCpc2JcpTZZrw.html

  • @vaturakd7846

    @vaturakd7846

    Ай бұрын

    @@TheMaster974 Thank you for your comment and for the video. I will try it and let you know about my tests in the future. 👍

  • @tyris4559
    @tyris45592 ай бұрын

    Hey if you want, I have a patched up Bullsquid and Houndeye code + assets, I can let you know what I did for those for a potential video tutorial 👍

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    You can do if you want to, I know that's been recommended to me in the past.

  • @tyris4559

    @tyris4559

    2 ай бұрын

    @@TheMaster974 I sent you an email, did you receive it?

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    Yes I did and I responded to it.

  • @dreadcraftre
    @dreadcraftre2 ай бұрын

    thanks!

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    No problem, thanks for the suggestion!

  • @AquaOfficial69
    @AquaOfficial692 ай бұрын

    nice

  • @pokitsu
    @pokitsu2 ай бұрын

    Thanks man !

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    No problem, thanks for the comment!

  • @pokitsu

    @pokitsu

    2 ай бұрын

    @@TheMaster974 So I fixed the immolator but I'm actually getting the bullet problem, if you somehow find a fix it would be nice to tell me please

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    Try removing the last BaseClass::ItemPostFrame(); line and see if that helps.

  • @pokitsu

    @pokitsu

    2 ай бұрын

    @@TheMaster974 It worked thanks ! Another stupid question, is that normal it only set fire to props and not npc too ?

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    The Immolator will set fire to certain NPCs (like Metrocops, as shown in some of the video footage), however not all NPCs in the game are set to be ignitable (like Antlions), so it depends on the NPC. I mention the resolution to this in the Flaregun tutorial I did: kzread.info/dash/bejne/jKSYq8qpoJasZbg.htmlsi=NY9qOcmTpQIg2HVn&t=316

  • @slightlyannoyedtokusatsunerd
    @slightlyannoyedtokusatsunerd2 ай бұрын

    Hey, do you have written versions if these tutorials, because i find them slightly hard to follow as videos

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    At this point in time, I don't have written versions of the tutorials, only some notes that I use to help me with the audio commentary which covers the changes that need to be made. In the (hopefully near) future, I hope to have a GitHub page with most of the code I showcase in the videos, although I can't help but feel like that would completely negate the purpose of the videos!

  • @AquaOfficial69
    @AquaOfficial692 ай бұрын

    how to make the flamethrower change the fire to particle fire

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    I'll have to look into that and see if it's something that can work.

  • @RModOfficial
    @RModOfficial2 ай бұрын

    hello its me again, sorry if i ask too many question, is there a way to make citizen or friendly npc when you shoot at him (friendly fire) it will make npc will say "we trusted you" "freeman we are on your side!" like hl2 beta when you shoot friendly npc, ok i know you arent gonna use the leak sound, so i recommended the code will use custom sound instead

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    That should already be allowed to happen in Source 2013 mods, plus from my brief investigation into this, the Half-Life 2 Beta only uses one more sound file than retail Half-Life 2 for when the citizens betray you, so there's not much to add.

  • @RModOfficial

    @RModOfficial

    2 ай бұрын

    @@TheMaster974 when i shot him it play play the npc hurt sound, there's no the "freeman Watch what your doing!" "FREEMAN WERE ON YOUR SIDE!", so is theres a way to add it master?

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    I can't understand why that would be happening, I think I'll have to take a look into it a bit more to find out what's going on. From what I can tell, retail Half-Life 2 doesn't allow you to kill friendly NPCs (unless it does and I don't realise it?) so it's confusing me right now.

  • @RModOfficial

    @RModOfficial

    2 ай бұрын

    @@TheMaster974 i modifed the npc relationship to player, so player can damage the NPC, also maybe you can make a tutorial how to turn on friendly fire in Hl2, and restoring the beta sound like "FREEMAN WERE ON YOUR SIDE"

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    I can look into it and see if I can get that working.

  • @RModOfficial
    @RModOfficial2 ай бұрын

    is there a way to fix weapon sway in source sdk 2013 multiplayer? to make it look like in singleplayer version?

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    Like viewmodel bobbing? I outline it in this video: kzread.info/dash/bejne/pJmK0quic73PZrQ.html

  • @RModOfficial

    @RModOfficial

    2 ай бұрын

    ​@@TheMaster974 not that, weapon sway aka Viewmodel lagger is like when you look left the viewmodel will lagging or swaying for an example you can find an youtube video about that, i cant sent a link here

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    I took a little look into it and I think I know what you're on about, I think for Multiplayer mods, it does exist but it is barely noticeable. However, you can make this viewmodel lagging effect more visible by changing a ConVar value called cl_wpn_sway_scale and by changing it to a higher value, you should see immediate results. It might not look the best, it's simply due to how the effect works in Multiplayer. If you want to look into it further, take a look at the predicted_viewmodel.cpp file and the CalcViewModelLag function. Hopefully this helps!

  • @RModOfficial

    @RModOfficial

    2 ай бұрын

    @@TheMaster974 Thx, btw i add you in discord

  • @the_redface
    @the_redface13 күн бұрын

    Yes Thank you very much :D and can I ask if you don't know how to make weapon_brickbat work + add new categories of this weapon? and I also wanted to ask how to make the hl2beta HUD work too? (Sorry if it's written badly in English)

  • @TheMaster974

    @TheMaster974

    13 күн бұрын

    Thanks for the comment, the Brickbat weapon is very complicated to implement, so I might not be able to do anything regarding that. As for the Beta-style HUD, I can look into it but Client coding isn't something I feel confident with.

  • @the_redface

    @the_redface

    13 күн бұрын

    @@TheMaster974 okay. By the way, you can just call me RedFace or just Red :D

  • @the_redface

    @the_redface

    12 күн бұрын

    @@TheMaster974 I wanted to ask another question yesterday but I forgot. how to fix +lookup and +lookdown commands. in the source engine these commands still exist but do not work

  • @TheMaster974

    @TheMaster974

    12 күн бұрын

    From my investigation into this, those commands only work if the ability to look around with the mouse is disabled i.e. cl_mouselook is set to 0. By default, you press the Page Up button to look up and the Page Down button to look down (check cfg/config.cfg). I found this out by opening in_main.cpp and looking at around line 700.

  • @the_redface

    @the_redface

    11 күн бұрын

    @@TheMaster974 okay thank you :D and I want to ask you, if you don't know of any way to improve the source 1 lights so that they look similar to the ones in the source 2 engine

  • @PhantomGhostLevelDesign
    @PhantomGhostLevelDesign2 ай бұрын

    Hi! Watched a few videos and happy to be learning from them, so I am posting this comment in the hopes of finding a fix to the following. Half-Life 2: Deathmatch and the MP branch of SSDK 2013 have a bug with the shotgun where if you begin reloading the gun, use your phys_swap key and come back to the shotgun before the gun gets reloaded in the background, the gun gets stuck in an animation until you shoot or press your reload key again. This problem does not happen in the SP branch. I have tried many things, but I am just unable to figure out a solution. I would appreciate it enormously if you could provide a solution to this. Cheers!

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    Thanks for the comment, it certainly sounds like a strange issue, however I believe I have a fix for you. Inside weapon_shotgun.cpp, inside of the ItemHolsterFrame function (I think you can what I'm going to add wherever, I've added it before the auto-reloading part) add: if (m_bInReload) { m_bInReload = false; if (m_iClip1 m_iClip1 += 1; } This makes it so the Shotgun doesn't continue reloading when switching in the way that you've outlined and also makes it so the user has the amount of ammo in the Shotgun that is displayed before switching, although it may not be perfect. Hopefully this helps!

  • @PhantomGhostLevelDesign

    @PhantomGhostLevelDesign

    2 ай бұрын

    @@TheMaster974 Hi! Thank you for the reply and the time spent looking into this! I gave this a shot and sadly, this hasn't fixed it. I added some debug text with Msg() to see why it did not work and in my server console, m_bInReload is always seen as false in ItemHolsterFrame, so it seems that it never gets called. I tried a few different versions, but alas, no dice. I have no idea why the phys_swap function is the one that causes this specifically, as that bug never happens if you get to the physcannon by weapon selection, the "use weapon_physcannon" command or your lastinv key and then back to the shotgun. The moment you start reloading the shotgun, switch to the gravity gun with your phys_swap key while the shotgun reload animation happens and then back to the shotgun, it just gets stuck like that: imgur.com/a/UQFbapF I even tried messing with WeaponIdle() since I see that when this gets called, it makes it happen, but this may be a byproduct. I also tried editing the phys_swap function to just call for the lastinv command, which seems to stop it from happening, but that doesn't really solve the issue since that nukes phys_swap entirely. I also tried suppressing prediction, as I know that re-added back some missing sounds for some of the guns, but that didn't do anything either. I have fixed a whole bunch of issues with the game, but that one thing is killing me. Also, another unrelated thing, do you know how I can change the grenade surface type to play the actual grenade surface sound in MP like it does in SP? It currently plays the weapon drop sound on impact with any surface and all my attempts to change the sound results in the server crashing. I may be using wrong code, though. Thanks in advance!

  • @TheMaster974

    @TheMaster974

    Ай бұрын

    I don't understand why my recommendation isn't working for you, have you modified the Shotgun code at all? The unmodified file should set m_bInReload to true at the end of the StartReload function. I've recorded a short video that I could potentially upload that shows the fix working on my end, and I'm definitely using the phys_swap command (which essentially does a use command if you look into how it works). As for the grenade sound, that's actually defined in the model that the grenade uses, so using the Singleplayer version of the grenade model should yield the result you are looking for.

  • @PhantomGhostLevelDesign

    @PhantomGhostLevelDesign

    Ай бұрын

    @@TheMaster974 yeah, my reply keeps getting deleted or filtered, I'm assuming the imgur link is the cause. So here goes again my reply. I assure you that something is happening, since I'm getting server console replies. The debug text that I added in your shared code shows that (m_bInReload) is always seen as false in the ItemHolsterFrame function, so it never gets called on my end. Here is how I checked: if (m_bInReload) { m_bInReload = false; if (m_iClip1 m_iClip1 += 1; Msg("It's true. "); } else { Msg("It's false. "); } My server console has always shown "It's false" in Half-Life 2: Deathmatch and SSDK 2013 Multiplayer.

  • @TheMaster974

    @TheMaster974

    Ай бұрын

    From my testing, it seems as if the message that says that m_bInReload is true only gets called once (presumably for one frame), so the console will get flooded with the message in the else statement, so it's easier for testing purposes to remove the else statement and only check to see if m_bInReload is true.

  • @skarano
    @skarano9 күн бұрын

    the immolator works perfectly fine for me except i need to change weapons to make it able to work again do you know how to fix this

  • @TheMaster974

    @TheMaster974

    9 күн бұрын

    I don't understand what your issue is, are you saying the Immolator works fine but then you need to switch to another weapon and back because it stops working out of nowhere? It might be the functionality I put in place to prevent the player from spamming the attack button and consuming all of the ammo very quickly, however I can't be sure.

  • @skarano

    @skarano

    9 күн бұрын

    @@TheMaster974 i have to switch to another weapon and back after my first attack with the immolator, i can only do an attack once with it before having to switch weapons

  • @TheMaster974

    @TheMaster974

    9 күн бұрын

    That's weird, I don't know why that would be happening. Try removing the if statement I mention at around 12:35 i.e. the one involving the m_flNextAttackTime variable and see if that helps or not.

  • @Total_Chaos_Animations
    @Total_Chaos_AnimationsАй бұрын

    Hey, don't know if you'll ever see this, but I just wanted to mention that the Immolator tutorial didn't work for me. And I made sure to follow your tutorial exactly. For me, the game crashes shortly after I start firing. No errors, no nothing. Also, it thinks it has reserve ammo, something I'm not seeing in your video. And it refuses to fire unless I give myself ammo, and then it takes ammo from the reserve ammo, not the clip. The other two weapons in the tutorial worked fine for me, it's just the Immolator that's not working for some reason. (And yes, that one BaseClass::ItemPostFrame(); at the bottom of the Immolator's ItemPostFrame needs to be commented out or removed otherwise it will shoot bullets, I made sure to test that.) Anyway, that's all I wanted to say. I would appreciate it if you made a followup tutorial addressing some bugs and all that, but I'm not expecting you to. Thank you for these amazing tutorials, there's no way I could've ever figured out how to fix some of these weapons. By the way, any chance weapon_thumper and weapon_rollerwand can be fixed up, including npc_rollerbuddy? Sorry for the wall of text, I'm not good at keeping things short.

  • @Total_Chaos_Animations

    @Total_Chaos_Animations

    Ай бұрын

    Quick update, I fixed the crashing. I just defined pEntity in the wrong spot (I guess I deserve that for trying to follow a complex and lengthy tutorial after midnight). I still have those other issues, though. And the Immolator in general seems pretty buggy. You have to click twice for it to attack sometimes, it seems to do both the flamethrower and laser attack at the same time (kinda? It doesn't always ignite things), the flashlight toggle sound makes the firing sound stop playing, the laser in general is kinda weird, etc.. But I guess it is an unfinished beta weapon, so I don't really know what I was expecting.

  • @TheMaster974

    @TheMaster974

    Ай бұрын

    Thanks for the comment, at least you were able to resolve the game crashing issue you were experiencing! For the ammo count issue, it could be something in the weapon script, the clip_size should be -1 and the default_clip should be 99 (or whatever value you want), it might be worth checking. As for the issue where you need to click the attack button twice, it could be due to a measure I put in place to prevent people from being able to spam the attack button and consume all of the ammo, so you might want to remove that and see if it helps. The igniting of enemies will only happen when the Immolator has been used for a short duration, when m_flBurnRadius is greater than 64, so you could always change that as well. The flashlight sound issue is news to me, thanks for pointing it out! I didn't change anything about how the beams work, hence why there could be some strange behaviour. As for the thumper weapon and rollerwand/rollerbuddy, I would probably only end up looking into the weapon_thumper code, as the rollerwand and rollerbuddy files are only available from leaked code, which I have reservations about doing tutorials about. Don't worry about posting walls of text, I'm guilty of doing this too...hopefully this ends up being useful!

  • @Total_Chaos_Animations

    @Total_Chaos_Animations

    Ай бұрын

    Thanks for the reply. I know this is a bit long, so I won't blame you for skimming over this. Yes, I thought it might have something to do with my weapon script file, which I took directly from the leak (albeit with slight modifications). And as for the code that prevents people from spamming the attack button, I'll look into it. And, frankly, I always thought the Immolator was going to have two different fire modes. One would be a long-range laser that deals a lot of damage but doesn't set anything on fire, and then the other mode would make it a flamethrower that only sets things on fire at close range. I don't know if alt-fire would switch between them or if it would just do whichever the alternate attack would've been (probably the laser would've been primary and secondary would've been the flamethrower if that was how it would've worked), but that's just my theory. But that aside, now that I know more how it works, I think the stuff you implemented is actually pretty good for balance reasons. Honestly, the only thing I would want to see out of this is the laser on the Immolator and the CGuard gun being fixed. Because right now it doesn't look like they come from the gun, and instead they just come from around the player's face, which causes culling issues with the player camera, among other things. I can't imagine it would be too hard to make it come from the "muzzle" attachment on their respective models, similar to how the beta Physics Gun works (and it would be cool to see the Physics Gun's laser not disappear when you look away from the thing you're holding with it and have its interactions with ragdolls restored, but both of those are way beyond me and I'm honestly not expecting any sort of followup tutorial for your old Physics Gun tutorial). And on a final note, I'm glad to hear that you're still planning on doing these tutorials. This is great for beginners that want to learn how to code for the Source SDK, as well as for experienced coders who might need a refresh. ...okay, one last question. Any chance you can make any videos on how the vehicles work in the SDK? Maybe on restoring the ability for the player to be able to drive vehicles like prop_vehicle_apc, prop_vehicle_jetski, prop_vehicle_driveable, and maybe prop_vehicle_cannon? I'm not expecting you to do that by any means, but it would be cool to see proper somewhat/relatively easy to follow tutorials for the basics on making new functional vehicle entities that aren't just copies of prop_vehicle_jeep or prop_vehicle_airboat with some slight modifications.

  • @TheMaster974

    @TheMaster974

    28 күн бұрын

    No problem, I can look into the beam drawing issues eventually, I should have realized that I could have made the beams shoot from the muzzle attachment, supposing the viewmodel has the muzzle attachment in the first place! The Physgun beam disappearing is something I haven't figured out, plus what do you mean by interactions with ragdolls? As for vehicle stuff, it's not something I've looked into before, so I'm not making any promises that I'll do anything regarding that any time soon.

  • @Total_Chaos_Animations

    @Total_Chaos_Animations

    25 күн бұрын

    The Physics Gun's ability to pick up ragdolls and throw them around. In my testing (mostly on d1_trainstation_02) it's not able to pick up ragdolls at all, unlike what's seen in some beta screenshots (like the one where the player is holding a Metrocop by his boot and the Physics Gun is a pistol). It can't pick up, damage, or kill some enemies sometimes either. And, honestly, I won't blame you for not doing a video on the vehicles. There isn't really any good documentation on how they work on the programming side, and the documentation that actually exists is hard to follow. And my only guess for the Physics Gun beam disappearing is because the "origin" of the beam is on whatever the player is holding and not the gun itself, for whatever reason. And then Source tries to cull the beam for performance reasons because it thinks the beam is "out of the player's sight", when it's really not.

  • @realuser0
    @realuser02 ай бұрын

    Thanks! Can u please add the binoculars in source sdk 2013?

  • @WadDeIz

    @WadDeIz

    2 ай бұрын

    He's done the binoculars

  • @MazdoTheWolf

    @MazdoTheWolf

    2 ай бұрын

    ​@@WadDeIz he didn't, but fixing the leaked code of the binoculars is for source 2013 is pretty simple

  • @WadDeIz

    @WadDeIz

    2 ай бұрын

    @@MazdoTheWolf and ye it isn't that hard, I also used the leaked beta source code to fix the gauss cannon

  • @MazdoTheWolf

    @MazdoTheWolf

    2 ай бұрын

    ​@@WadDeIz For the Gauss, I prefer to use the official 2004 SDK code, as it works right out of the box and doesn't require any tweaking

  • @TheMaster974

    @TheMaster974

    2 ай бұрын

    At this point in time, I have my reservations about doing tutorials where getting leaked code is a necessary step (the binoculars is one example where this needs to be done, as it isn't provided in a Source 2013 mod). I'll probably look into the Tau Cannon eventually, there's something I need to address about it which is quite interesting. The 2004 Source code can be found here, for reference: github.com/Source-SDK-Archives/source-sdk-2004

  • @mrwhopper-cc4kq
    @mrwhopper-cc4kqАй бұрын

    can you make a tutorial about how to add lua in source sdk 2013 multiplayer? pls?

  • @TheMaster974

    @TheMaster974

    Ай бұрын

    I'm unfamiliar with Lua, so the best thing I can do is to refer you to this page: developer.valvesoftware.com/wiki/Adding_Lua

  • @mrwhopper-cc4kq

    @mrwhopper-cc4kq

    Ай бұрын

    @@TheMaster974 the tutorial is shit

Келесі