 Okay, this is part four in a series, hopefully there's an annotation on the screen that will bring you to the full playlist. I recommend watching the previous videos. I have wiped out all the changes we've made and and downloaded the fresh codes working with the with the original source code from the PR boom plus project. And today we're going to be just again messing with the code making the game doom a little bit more fun. And one of the things we're going to do is something better than God mode. So in God mode, you're invincible, you know, you get hit and it doesn't hurt you. So what's better than that? How about when you get hit, you get more health, you get more powerful. So again, I'm using Vim as my text editor, you can use whatever text editor you prefer, as long as again, as long as it's a text editor and not a word processor. And I'm using them, I'm jumping straight to line 911 in this source file. And again, the lines might change if the code is updated, you know, from the project, it might bump the line, but should be around this line. In the pinter.c file. And here is the line of code where the player gets hurt. So when the player gets gets shot by somebody, we're going to take the player, we're going to point at itself, what's its health, we're going to say, take its health and subtract from it, whatever the damage the bad guy is placing on you. So when a bad guy shoots you, when a bullet hits you, or a barrel explodes, or a rocket explodes near you, it sends out this how much damage I'm putting out. And with explosions, it's based on a radius. But it says this is the damage that you're getting hit with. So we're taking the player's health and subtracting that health from it, that amount of damage from it. So what we want to do here is change that minus to a plus. So now, let's say you get shot, and it's supposed to do 5% damage, it's actually going to give you 5% health. So we're going to say, make that. And then we're going to source PR boom plus. And now I go into the game, I go, hey buddy, shoot me. And you see, my health is already going up. So it sounds like I'm getting hurt. And my, the screen turns red when I get shot, and my face gets all mad, but my health is actually going up. So I was thinking, you know, if you wanted to make a X-Men mod of this game, just like they had an X-Men mod of Quake back in the day, if you wanted to have the player act like a player, like Bishop, someone who absorbs other people's energy when they get hit, you could do something like this. Every time they get hit by a certain weapon, if you want, you can put an if then statement, if this, then that, you know. And so if you get hit by a plasma beam or something, your life goes up. So that's one thing you can do here. Another thing we want to look at, okay, so in a previous video, we changed the player's default health. So if we go into that same file, line 62, this is where we set our initial health. So let me set this to 999. So we'll make that and we'll run doom. We'll go into here and I'll show you, as I showed you in a previous tutorial, if I come over here, oh, let me turn off what we did earlier because my health is still going up. Let's just change this back to a negative. While I'm in here, I might as well mention what these next two lines are just so you know. So this is the player getting hit. We're subtracting damage from it. But then we say if the player's health is less than zero, set the player's health to zero. So let's say my health is at 5% and someone hits me with 10% damage. The health bar is not going to show negative five. It could, but this function stopping that it's saying, yeah, if it goes below zero, just set the health to zero. That way it doesn't keep going down in the negative numbers. So yeah, just wanted to point that out real quick. So we're putting this back to how it was. Now if I get shot, I get hurt. But our initial health when we, oh, let's make that, our initial health when we're playing the game here is set to 999. That's what we set the initial health to. And if I get shot, it goes down a little bit. If anyone will shoot me, there we go. But you see the blue vials. The blue vials, if I get it, it goes to 200%. And as I mentioned, that's because the max health set for the vials is 200. So when you pick it up, it's changing it to 200. Let's go ahead and change that. So we're going to go into a file. We'll use a Vim and we'll jump to line. Let me look at my notes here. 671 of our source Pinter C. And that's not right. That's the wrong line. Line 300 and 36. And again, the lines might change if you download an updated version of the source code. Things might move, but should be around that area. So here, we're listing all things. What happens when you pick something up? So you can pick up the first type of armor. Armor 2, a health bonus. This is a health bonus. This looks like the armor bonus, as you can see right here. And each time we pick one up, it's saying health plus plus. So it's saying it can go over 100%. But as we saw, it maxes out at 200%. That's because here, we're saying, okay, every time we pick one up, add one. So if you've ever done any type of C, or most programming languages, you know, if you have a value and you say plus plus, that means add one to whatever it's equal. So if you did minus minus, it would subtract one. So we're saying that, and we're saying, yeah, if the player's health is greater than whatever the max health bonus is, well, then set the player's health to the max health bonus. Just like we're saying, if it's under zero, set it to zero, we're saying, if it's over the max, set it to the max. So what we can do is we can find out where this variable sets. That's one thing we can do. I can go grep from all the files in this folder. I should put this here. Look for this, and we can see a few places, and we can see where it's defined. It actually looks like it's defined two different places. One, it's finding your max health and multiplying it by two. And then another place it's using another equation. So I'm not sure really which one of these is being used. I can go look at the code, it's probably an if then statement. If this then use this, if that then use that. But for what we're doing, we're going to go back into our code here. And we can just say, oh, you know what, let's set the max bonus to 1000. So now, if I save that, make and run it, now I should be able to go up to 1000. Should be once or twice. Okay. So are there enough files over here for me to, I don't need just 25 files over there. Let me go grab a health pack real quick. Oh, that health pack won't work because I'm over 100 and that health pack sets up. Okay, so show you it's not dropping down to 200, which is what it was dropping down to before. It will cap out at 1000. Now, let me start this level over again. And just get rid of these guys. So when you get to 1000, I'm still not getting to it because I did get shot. I wanted to show you that 1000 looks like 0000 because anything more than three digits is going to go off the side there. So let me try that one more time. IDK, IDKFA, there we go. Seven. So now if I pick up one of these, my health goes to 1000. It looks like 0000. You see it's not going up any higher than that. So that's another thing that's one thing we can do. We can change the value of that variable or as we just did, just completely replace the variable or we can just delete these two lines and there is no max. So now the health will continue going up above that infinitely until the game hits some sort of physical limit. So make that IDKFA, kill those guys, kill those guys, kill those guys. I got hit once. I was trying not to. Yeah, let's try that again. IDKFA, seven. Man, you'd think that the BFG like this. Okay. So now you can see it looks like 004, but it's actually 1000 and for 1007 now. So you've removed the cap for those little blue vials. So that's pretty cool. So what else do I want to show you? Is there anything else I want to show you today? Let me look at my notes here real quick. Let's go. Okay. So right there, it says the monsters you've killed. I see seven out of 19. I don't think that was in the original game, these messages. Again, there's been a lot of updates to do. For example, the map is also much more advanced than it was in the original game. And there's other versions other than PR boom that give you some other features, kind of like, I think it's chocolate doom. As your life goes down, your health goes down and your arm goes down, it changes color. So anyway, it's showing the number of monsters that happened, their left and the number of monsters you have killed. Let's just quickly look at where that is in the source code. So according to my notes, it's saying it's online 671 of this file. So let's go there. And here it's saying, I guess, when I kill someone resurrection count, it's going up player kill count. So here every time I kill something, it goes up one. So let's go ahead and change that. I haven't actually done this way to change that to 10. So every time I kill one bad guy, it's going to add 10 to that total number of kills. So in theory, again, I haven't tried this yet. So zero out of 19. Let me go ahead, kill both these guys, and then go hide. Nope. Obviously, I wrote something wrong. And it's not showing is not adding up at all. So what we can do to error check something. So as you can see, I'm running this in the shell and there is output here. So let me go in here. And what I'm going to do is wonder if it was, is this one? Well, no, because obviously something I did change it. So it was still at zero. Let's go ahead and change or do an output. So if you've done your very first C programming tutorial, you did a Hello World. So you know what the print F command does it print stuff to the shell. So what I'm going to do here is I'm going to print a message you have killed percent I because it's an integer enemies, exclamation mark, and then new line there. And then here we're going to want to put what the variable is, which is our source kill count here. So we do that. And now I wonder if there just has to be spaces in here. So let's just add spaces. So every time I kill somebody theoretically, we should get a message out to the terminal, the shell saying this message and giving us a value there. So let's go ahead and make that and source PR boom plus. I'm going to do is I'm going to unmaximize this. Oh, and jump towards my second monitor there. So let's go ahead and there we go. So yeah, my math is not working. But my output message, it's telling me, oh, now it says I've killed one. Now it says I've killed one. Interesting. Interesting. So let's see. Let's go back out into our source code here. Let's just change this back to plus plus, looking around the sea. So source player, machine flags kill. Again, I hadn't tried this before. Oh, it's this player kill count down here. Counts all monsters death, even those caused by other monsters. Okay. So that might be something we can change. I set this back to what it was, which was adding one each time. So let's just make that. So we haven't changed how it works, but we're displaying an output. So if you ever want to check something that's not working, you can always print F out to the shell. There you go. One enemy, two enemies. Again, in this particular version of Doom, I can go into the maps and see the number of monsters killed. And of course, if I get to the end here, tells me the percentage killed. So yeah, my goal of changing that number didn't work. But printing it out to the shell does work. So I just wanted to show you that in case you wanted to try to figure out why something is wrong. So anyway, I thank you for watching. There's more to come again. And in a few tutorials, we'll start hitting up hex editors to modify the game, the Doom game, which we don't have to do since we have the source code. But I just wanted to give you an overview of changing something I've done simple stuff in the past by changing strings, we're actually going to change some numeric values in those hex editor tutorials. So anyway, I thank you for watching. Please visit filmsbychrist.com. That's Chris the K. There should be a link in the description. There's also a link in the description to the notes for everything I've done in this video and all the previous videos. So go ahead and check that link out. And I hope that you have a great day. Okay, this is an introduction to filmsbychrist.com. I'm Chris. That's Chris the K. That's me right there. My daughter Ember. And my wife, Jennifer. We pretty much live in the swamps of Florida. I'm a firefighter by day, as well as by night. We work long hours. But that's not why you're here. You're here about the videos I put up on YouTube. These videos are mainly about computers and programming, which means most of my videos look something like this. And if that's what you're interested in, great. If not, that's all right. I do videos on other topics too, such as video editing, special effects, photo editing, 3D design, and music creation. If you are one of my viewers and you enjoy my videos, my Patreon page is a place where you can go to help support my videos. So I ask that you take the time to go to my Patreon page and look at different levels of rewards you can receive for different levels of backing. There should be a link in the description of this video if you're watching it on YouTube. Otherwise, you can visit patreon.com forward slash metalx1000. And I thank you for your time and your support. Have a great day.