L4D2 - Code Your Own Mutations - Part 2 (First Mutation)

  Рет қаралды 1,805

Code Jockey

Code Jockey

Күн бұрын

Пікірлер: 63
@ccarlll
@ccarlll 2 жыл бұрын
Thank you!
@taxxingtheseevaders
@taxxingtheseevaders 7 ай бұрын
1:37 where he starts
@nnoossiirr
@nnoossiirr Ай бұрын
Hey, this seems like a good place to ask, I want to make a Mutation about the original L4D1 Special Infected, and I wanted to make the Boomers do damage when they vomit/explode on you. Not an instakill but like 5 or 8 damage, since I'm planning on making so that there's no hordes, only SI. I know there's an "IT" command or something like that which makes the game know you're vomited, but I'm really not sure how to do it. Any ideas? edit: I already fixed it because I found how to do it, so I don't think I need help anymore
@codejockey4988
@codejockey4988 Ай бұрын
PERFECT place to ask! :))) There is an exact function for this... it can be found in your easylogic.nut! 🥜 function Notifications::OnPlayerVomited::MYFUNCNAME (victim, attacker, params) { if(victim != null) { if(victim.IsAlive()) { victim.Damage(5, 6); //the 5 means how much damage to take, the 6 means what type of damage (blast, bullet, melee) } } } Hope this helps! 🤩 p.s. list for damage types can be found in the entity.nut file 😁 p.s.s. you may also want to explore the cvars list for your mode file & mess with the vomit settings/durations 🤢
@emperorcrimson3656
@emperorcrimson3656 Ай бұрын
I host an 8 player game, and i choose 4 swordsmen for mutation, but the problem is the 5th player have pistol instead of katana, and also the late joiners gets pistol too, idk how to fix it I wanted to use vscript, but idk how and also for the healing gnome, the 5th player have 200hp instead of 100hp
@huntedgaming7794
@huntedgaming7794 2 жыл бұрын
hey, do you know if there is any way to make a player swap teams when they die? (like join the infected when they killed)
@codejockey4988
@codejockey4988 2 жыл бұрын
Hey! Great question! I've actually wondered this myself. I just checked the vslib files, turns out theres a function called "entity.SetTeam(INFECTED);" (try SURVIVORS to become human). There's also a function that checks the current team: "entity.GetTeam();" This may not do what we're hoping though, so you may have to experiment to see what works! Best of luck!
@godssilliestsoldier249
@godssilliestsoldier249 Жыл бұрын
is there a way to pick a random infected and give it special properties? like giving one specific common infected a buncha health, or something of that nature
@codejockey4988
@codejockey4988 Жыл бұрын
Hey, great question! Yes, I've sort of figured out a way to do this (somewhat recently actually)! It's quite a hefty bit of code though so I would love to make a video explaining how! It's not too hard to understand, just long!
@classicamerican2469
@classicamerican2469 4 ай бұрын
I have a question. How would I go about changing the color of the player health bar. In L4D1 at 50 HP your health bar would turn yellow but won't limp. Is there a way to change it?
@codejockey4988
@codejockey4988 4 ай бұрын
Hey! So I'm p sure you can mess with this cvar in the mode file: 👉survivor_limp_health 40👈, you also may be able to tweak the color changing by tweaking the actual player maxhealth. Like say in the OnSpawn Function you put player.SetMaxHealth() == 50, this may also change how the bar color changing works. Otherwise I don't know how to manually change when the bar changes color. I wish I knew more, but I hope some of this helps! 🙏
@classicamerican2469
@classicamerican2469 4 ай бұрын
@@codejockey4988 I thank you so much. I really think your videos are helpful.
@codejockey4988
@codejockey4988 4 ай бұрын
@@classicamerican2469 that means an awful lot to me! 💙💚💛 I actually havent made a proper video in a while, I should really do that! 😅I've been more on that streaming grindset atm 🔥🔥🔥🔥🔥
@slyfoxercoot8119
@slyfoxercoot8119 Жыл бұрын
I've been racking my brain for awhile on this one. When a Survivor spawns i want to give them a random melee weapon.
@codejockey4988
@codejockey4988 Жыл бұрын
Heyo! I think this should do the trick! I guess there is a built in function that gives a random melee weapon! It was hiding in the player.nut library. You should be able to access those reference libraries from your VSLIB folder. Hope this helps! function Notifications::OnSpawn::Spawn (player, params) { if(player != null) { if(player.GetTeam() == SURVIVORS) { player.GiveRandomMelee(); } } }
@slyfoxercoot8119
@slyfoxercoot8119 Жыл бұрын
@@codejockey4988 Been trying alot of ways to make it work. The code you posted didn't work on my end, How about you? P.S. I could still very well be missing something since im still a newbie to all this.
@codejockey4988
@codejockey4988 Жыл бұрын
@@slyfoxercoot8119 Hey! I'm sorry this isn't working, learning this stuff is really frustrating at times, it took me weeks to grasp even the most basic concepts, and I'm still learning new things!Another way you could go about this is by giving a weapon at random manually. In the OnSpawn function, you can make a random variable like this: local someRandomNum = Utils.GetRandNumber(1, 2); then say something like: if (someRandomNum == 1) { player.Give("fireaxe"); } else { player.Give("knife"); } Hopefully this can get you started! Best of luck!
@slyfoxercoot8119
@slyfoxercoot8119 Жыл бұрын
@@codejockey4988 Thanks i'll give it a go. This whole thing trying to understand how to make it possible for survivors to have a random melee spawn when they spawn in, IN THEIR HANDS. Has pretty much lead me down a hole and i refuse to get out until There is some possible way to make it happen. I have left footprints to remind myself if i ever get lost or need to comeback to an idea. I left some on the steam forums and learned a few things. Left 4 dead 2 uses a mission file for all the melees that are in a level. The only one that works for every level is the baseball bat, cause of course dlc. I'll leave what Alwaystoast said to me in one of the forums: "They did something to make 4 horseman work, that we can’t do. Valve specifically made a code to forced katanas to spawn on every map. So while you can copy the four swordsman code to make katanas spawn for a mutation, you can't use it for any other weapon. Every map has a list of melee weapons that are allowed to spawn in the missions file. If it’s not on the list, it can’t spawn (unless valve writes and override to this, like they did for katanas). So you can’t spawn a fireaxe on a map that doesn’t already allow fireaxes to spawn. You can make the default weapon a fireaxe, and that will work on any map that allows a fireaxe. But it won’t work on a map that doesn’t allow the fireaxe to spawn. My mutation Campfire, works that way with baseball bats, because baseball bats were a promotional item so they are allowed in official maps (however they fail to spawn in custom maps that don’t allow baseball bats). If you are OK with getting fireaxes on any map where they can spawn, but a different melee weapon if they are now allowed, that should be possible. There a kind of solution in the RocketDude mutation, in the file rd_melee_getter it’s set up to pick random melee weapons, but it checks to see which melee weapons are available to pick from. So it should be possible to write a code that does: Check if Fireaxe can spawn, if yes, spawn it, if no, spawn another melee weapon instead, repeat through the list of desired melee weapons until you find one that can spawn." I refuse to give up if there's a possible way. Just means we haven't found the permanent solution yet. If Valve figured it out, that means we can too. Nothing is impossible.
@codejockey4988
@codejockey4988 Жыл бұрын
​@@slyfoxercoot8119 Wow I really appreciate your in-depth comment! What I find interesting though is I never noticed this problem happening for me. I've made several mutations and tested them on many different official maps and I don't recall a melee weapon ever failing to spawn. I guess I haven't tried many of my mutations on custom maps so I didn't realize that was an issue. Years ago however, I made my own custom map, a mission file, and a mutation along with it, but I must have set those to allow all melee weapons when I did that. To be perfectly honest with you, this particular solution seems a bit outside of my expertise, as I have not experimented with accessing mission files from mutations, but I emplore you to keep trying & or exploring for alternatives! You are so right that nothing is impossible!
@scrumpD
@scrumpD 11 ай бұрын
Hey there, really appreciate this video. I was just wondering if I could get some implementation advice on this mutation idea i've had: Upon any given player picking up a random weapon, a random horde of special infected will spawn nearby to interrupt the player. It's given randomized range is somewhere between 3 and 10. Common infected will also spawn with a random integer of 10 to 20. How would this work using VSLib especially since VSlib works almost like a purely functional language. Any idea of an implementation? A thousand thank-you's.
@codejockey4988
@codejockey4988 11 ай бұрын
Hey! So glad you liked the video! Really happy you reached out! I love this idea & the best news is I believe I know how to do it (often I do not lol). Thankfully, this should all fit into one function: function Notifications::OnItemPickup::MyWeaponFunc( player, weapon, params ) { if(player != null) { Utils.SayToAllDel("you are using %s", weapon.tostring()); //this tells you the name of the wpn you picked up //the above line is not neccessary, only useful for testing to see what items you are picking up //if you want to spawn a zombie whenever any item or weapon is picked up then you can remove the line below if(weapon == "weapon_smg" || weapon == "weapon_smg_silenced") //if the weapon is a smg or silenced smg { Utils.SpawnZombieNearPlayer(player, Z_BOOMER, 2048.0, 512.0, false); //may want to experiment with which specials can spawn and how many (use Z_COMMON for common infected) //first number is furthest range (2048), second number is closest range (512) and it will pick somewhere in between //false means it will not check for line of sight to spawn (if true it will only spawn if player will not see the zombie spawn) } } } I hope this helps get you started! Sorry in advance for any errors or issues, the code is somewhat untested! Lmk how it goes! Best of luck!
@scrumpD
@scrumpD 11 ай бұрын
@@codejockey4988 dude, you're an absolute lifesaver. Can't even begin to thank you in a way that seems proportionate, I'll lyk if there's some bugs
@scrumpD
@scrumpD 11 ай бұрын
@@codejockey4988 Just one thing though, is there any way to directly randomize what kind of special infected will spawn on any given weapon? I don't mind individually doing it for every infected type, it's just I want those parameters to be completely random
@codejockey4988
@codejockey4988 11 ай бұрын
@@scrumpD Yes, there sure is! You can use a random number and store it in an integer, so like: local randomNum = Utils.GetRandNumber(1, 6); //1 is min 6 is max //then when someone picks up a gun it will randomize one of the 6 specials if (randomNum == 1) { //spawn a jockey } if(randomNum == 2) { //spawn a boomer } etc etc Hope this made sense!
@scrumpD
@scrumpD 11 ай бұрын
@@codejockey4988 Really cool, thank you. Now, is there any way I could randomize the values in MutationOptions? Something like MutationOptions
@toester1087
@toester1087 Жыл бұрын
How can i get tanks to spawn as much as common infected do? i did everything how you did but im guessing tanks still spawn as much as regular tanks do no matter how much tanks can be on screen. Also is there somewhere i can go to view all of the mutation options
@codejockey4988
@codejockey4988 Жыл бұрын
Yes, fantastic question! Here is a link to a download of the other official mutation scripts, it should help you get an idea of what you can do in the "mutation options", hope this helps! :) github.com/Stabbath/L4D2-Decompiled/tree/master/Decompiled%20VScripts
@letteroftheday3657
@letteroftheday3657 Жыл бұрын
Is there a way to sanitize certain weapons you want? I was going for only tier 1 weapons but couldn’t figure out what function does something like that
@codejockey4988
@codejockey4988 Жыл бұрын
Yes there is a way to do that! You basically tell the director to remove certain spawns from the map before the game starts. I should make a video about it!
@codejockey4988
@codejockey4988 Жыл бұрын
DirectorOptions
@codejockey4988
@codejockey4988 Жыл бұрын
I posted some code for you, that is one way I know of doing it. www.gamemaps.com/guide/1 & I reference this guide often for weapon names! Hopefully that all helps. :)
@letteroftheday3657
@letteroftheday3657 Жыл бұрын
@@codejockey4988 Thank you! This definitely helped and worked when tested
@codejockey4988
@codejockey4988 Жыл бұрын
@@letteroftheday3657 SO happy to hear that!
@thedarkroom6416
@thedarkroom6416 2 жыл бұрын
hi I wanted to change the zombie speed but have it only affect on the mutation is that possible ?
@codejockey4988
@codejockey4988 2 жыл бұрын
Hey! Yes, so if I understand your question correctly, you can change the speed of the zombies manually through the use of cvars. There are lots of them so you may have to experiment but the cvar you might be looking for I believe is called "z_speed" It can be found here: developer.valvesoftware.com/wiki/List_of_L4D2_Cvars You would then need to add this to the mode file (I show how to do that at the end of the video), and it should only effect the speed of the zombies while playing that specific mutation. Hopefully this answers your question, lmk if not!
@thedarkroom6416
@thedarkroom6416 2 жыл бұрын
@@codejockey4988Thanks I’ll try that out soon but my other question is when I launch it it doesn’t work I put it so that no specials and 15 common and 30 mega mob I didn’t include the other stuff
@codejockey4988
@codejockey4988 2 жыл бұрын
@@thedarkroom6416 hmm well I can't really see the code, & there could be many reasons why it isn't working. You may want to watch the intro video again just to make sure you have everything set up correctly. Let me know if you still need help!
@AeroHALO61
@AeroHALO61 Жыл бұрын
Hi, i know it's been 2 years but i want to know that is there any command that disable T2 weapons ?
@codejockey4988
@codejockey4988 Жыл бұрын
Wow I can't believe its been 2 years already! Haha But no worries, yes there is this bit of code you can add to your NUT script to restrict specific weapons. I believe it looks smth like this: weaponsToRemove = { weapon_pistol = 1 weapon_pistol_magnum = 1 weapon_smg = 1 weapon_pumpshotgun = 1 weapon_autoshotgun = 0 weapon_rifle = 0 weapon_hunting_rifle = 0 weapon_smg_silenced = 1 weapon_shotgun_chrome = 1 weapon_rifle_desert = 0 weapon_sniper_military = 0 weapon_shotgun_spas = 0 weapon_grenade_launcher = 0 weapon_rifle_ak47 = 0 weapon_smg_mp5 = 1 weapon_rifle_sg552 = 0 weapon_sniper_awp = 0 weapon_sniper_scout = 1 weapon_rifle_m60 = 0 weapon_melee = 1 weapon_chainsaw = 0 weapon_upgradepack_incendiary = 0 weapon_upgradepack_explosive = 0 ammo = 1 upgrade_item = 0 } function AllowWeaponSpawn( classname ) { if ( classname in weaponsToRemove ) { return false; } return true; }
@AeroHALO61
@AeroHALO61 Жыл бұрын
@@codejockey4988 thank you very much, i really appreciate it. Just one more question, is there any way that allow only 1 person in team have the Magnum, the others can only use melee or dual pistol, u know, the Magnum is OP so i want to limit it, thks in advance.😊
@codejockey4988
@codejockey4988 Жыл бұрын
​@@AeroHALO61 ooo great question. Hmm... there are kind of a lot of steps here and different ways you could go about doing this, I probably can't explain/make all that code here. I would have to say the easiest work around would be to just call the player.Give("weapon_pistol_magnum"); in the spawn function and maybe have it choose a player at random. local B = Player ("!bill"); local Z = Player ("!zoey"); local L = Player ("!louis"); local F = Player ("!francis"); local rand = Utils.GetRandNumber(1,4); if(rand == 1) { //give Bill the magnum B.Give("weapon_pistol_magnum"); } else if(rand == 2) { //give Zoey the magnum Z.Give("weapon_pistol_magnum"); } etc etc ... Hope this helps! Sry if this isn't exactly what you were looking for!
@AeroHALO61
@AeroHALO61 Жыл бұрын
@@codejockey4988 Awesome, thank you for your help. Have a really nice day, bro! 😁
@AeroHALO61
@AeroHALO61 Жыл бұрын
@@codejockey4988 hi, im really sorry for bothering u again, but after testing my mutation, there are certain places, like the gun store in Dead Center, the T2 guns dont despaw, is there any way to fix that ?
@Rinka1811
@Rinka1811 9 ай бұрын
my hunters still die even they aren't in the air =((
@codejockey4988
@codejockey4988 9 ай бұрын
Did you make sure to set their health to 5k? Because otherwise yeah they will die from non-airshots unless they have more health. You could also increase the "distance to ground" to a higher number like 10 or 12 to make sure you can only airshot the hunter if they are higher in the sky. Hope that helps in some way!
@Rinka1811
@Rinka1811 9 ай бұрын
@@codejockey4988 tysm!! subbed, love ur vids
@codejockey4988
@codejockey4988 9 ай бұрын
Aw, thanks, that means a lot! @@Rinka1811 Great question! Here is a simple way that should make the tanks spawn similar to how they spawn in tank run (sorry, its not perfect, may need some tweaking). //when the survivors leave the spawn, start a timer to call a function every 5 seconds function Notifications::OnSurvivorsLeftStartArea::StartCD() { //start the timer ('true' meaning this timer repeats after it finishes) Timers.AddTimer( 5.0, true, tankSpawn ); } //this is the function that spawns the tank ::tankSpawn
@Rinka1811
@Rinka1811 9 ай бұрын
@@codejockey4988 it worked !!!! u're the goat Andy. can u make survivors only holding explosives, no primary , secondary weapons ? and after throwing an explosive, survivors get a random explosive ? pls give me ur workshop link too. cant wait to try ur mutations
@Rinka1811
@Rinka1811 9 ай бұрын
Andy , can u check this for me please ?? //include vscript library IncludeScript( "VSLib" ); //start by giving the survivors an smg function Notifications::OnSpawn::Spawn (player, params) { if(player != null) { if(player.GetTeam() == SURVIVORS) { player.Give("weapon_smg_silenced"); player.Give("weapon_pistol"); Utils.SanitizeUnheldWeapons(); } } } //give survivor weapons if they killed special infected function Notification::OnInfectedDeath::GiveWeapon (attacker, params) { if(attacker !=null) { if(attacker.GetTeam()== SURVIVORS) { attacker.Give("weapon_autoshotgun"); } } } when i killed a special infected. i didn't get any auto shotguns =(( and the system showed me this AN ERROR HAS OCCURED [the index 'Notification' does not exist] CALLSTACK *FUNCTION [main()] scripts/vscripts/gungame.nut line [22] *FUNCTION [DoIncludeScript()] NATIVE line [-1] *FUNCTION [IncludeScript()] unnamed line [75] *FUNCTION [ScriptMode_Init()] scripts/vscripts/scriptedmode.nuc line [79] *FUNCTION [ScriptMode_Init()] d:/steam/steamapps/common/left 4 dead 2/left4dead2/addons/8slots.vpk/scripts/vscripts/scriptedmode_addon.nut line [14] *FUNCTION [ScriptMode_Init()] d:/steam/steamapps/common/left 4 dead 2/left4dead2/addons/workshop/2931178538.vpk/scripts/vscripts/scriptedmode_addon.nut line [15] AN ERROR HAS OCCURED [Failed to include script "gungame"] CALLSTACK *FUNCTION [IncludeScript()] unnamed line [75] *FUNCTION [ScriptMode_Init()] scripts/vscripts/scriptedmode.nuc line [79] *FUNCTION [ScriptMode_Init()] d:/steam/steamapps/common/left 4 dead 2/left4dead2/addons/8slots.vpk/scripts/vscripts/scriptedmode_addon.nut line [14] *FUNCTION [ScriptMode_Init()] d:/steam/steamapps/common/left 4 dead 2/left4dead2/addons/workshop/2931178538.vpk/scripts/vscripts/scriptedmode_addon.nut line [15]
@codejockey4988
@codejockey4988 9 ай бұрын
Hey @Rinka1811! I'd be more than happy to! This looks fantastic for starters! You'll laugh when you see what the error is. It was because you wrote Notification:: instead of Notifications:: Haha I can't stand little things like that! Also, I believe OnInfectedDeath is only applied to "when a common infected dies", as I believe they are seperate functions (I know, very intuitive lol). So instead, you can use: //ondeath counts for both survivors or special infected function Notifications::OnDeath::MyCoolFunction(victim, attacker, params) { if(attacker != null && victim != null) { //may be unncessary but i still check to make sure it isn't a common that died [a player includes specials] if(attacker.IsPlayer()) { //if the attacker is on the survivor team and the player that died is on the infected team if(attacker.GetTeam() == SURVIVORS && victim.GetTeam() == INFECTED) { attacker.Give("weapon_autoshotgun"); } } } } Hope this works! Otherwise everything looks fab! Can't wait to see what you make! Feel free to reach out anytime! P.S. I'm hoping to make a discord soon so we don't have to sort all these out in the comment section haha
@Rinka1811
@Rinka1811 9 ай бұрын
@@codejockey4988 ty Andy it worked!! But if I want the system to give me a RANDOM WEAPON after i killed a SPECIAL INFECTED. Is this code correct? //ondeath counts for both survivors or special infected function Notifications::OnDeath::MyCoolFunction(victim, attacker, params) { if(attacker != null && victim != null) { //may be unncessary but i still check to make sure it isn't a common that died [a player includes specials] if(attacker.IsPlayer()) { //if the attacker is on the survivor team and the player that died is on the infected team if(attacker.GetTeam() == SURVIVORS && victim.GetTeam() == INFECTED) { local someRandomNum = Utils.GetRandNumber(1, 2, 3, 4); { if (someRandomNum == 1) { attacker.Give("weapon_autoshotgun"); } if (someRandomNum == 2) { attacker.Give("weapon_rifle"); } if (someRandomNum == 3) { attacker.Give("weapon_rifle_ak47) } if (someRandomNum == 4) { attacker.Give("weapon_rifle_desert) } } } } } }
@codejockey4988
@codejockey4988 9 ай бұрын
@@Rinka1811 That looks fantastic! I love this! That is such a neat concept! I love it! There's so much you could do with this idea! Like maybe check if you killed with a specific weapon, and then replace it with the "upgraded version" local wep = attacker.GetActiveWeapon().GetClassname(); if(wep == "weapon_sniper_scout") { attacker.Give("weapon_sniper_awp") } //this will check to see if you used the scout, then if its true (if I have the scout equipped when I killed that zombie, then give me the awp). Also, quick tip (which I should have explained in my videos), you can actually keep the game running and just relaunch the map over and over while making changes so you dont have to close and relaunch l4d everytime you want to check your code for errors. It just saves lots of time! (this doesn't work if you are editing your mode file, you will need to relaunch l4d for that).
@Rinka1811
@Rinka1811 9 ай бұрын
@@codejockey4988 thank you Andy, xD but sadly it didnt work. The system told me that there is an error with this line: local someRandomNum = Utils.GetRandNumber(1, 2, 3, 4);
@Rinka1811
@Rinka1811 9 ай бұрын
and i have no idea to fix this code =(( since i'm new to this, just have learned from u few days ago. sorry for keep asking u for help, but i do hope u could correct it for me
L4D2 - Code Your Own Mutations - Part 3 (Upload to Workshop)
20:15
Making Left 4 Dead as Realistic as Possible
19:31
ratlobber
Рет қаралды 1,9 МЛН
When mom gets home, but you're in rollerblades.
00:40
Daniel LaBelle
Рет қаралды 127 МЛН
UFC 308 : Уиттакер VS Чимаев
01:54
Setanta Sports UFC
Рет қаралды 912 М.
Microsoft Sucks at Everything
27:06
NakeyJakey
Рет қаралды 1,3 МЛН
L4D2 - Code Your Own Mutations - Part 1 (Setup)
20:26
Code Jockey
Рет қаралды 2,6 М.
left 4 dead 1 expert shows no mercy whatsoever
14:46
jctitan48
Рет қаралды 1,2 М.
I Tried to Recreate Kaiserreich in Vanilla Hoi4!
22:53
Mountain General
Рет қаралды 333 М.
this new Linux feature makes hacking IMPOSSIBLE
11:08
Low Level
Рет қаралды 287 М.
I Ported a TF2 Map to Source 2 Because Valve Wouldn't
35:11
the 18th amendment: a poker night documentary
39:01
meikkon
Рет қаралды 908 М.
Minecraft's Terraria Mod is Incredibly Fun!
21:29
ChippyGaming
Рет қаралды 308 М.
Life in South Lebanon | Inside the War in the Middle East
1:17:15
Brandon Buckingham
Рет қаралды 187 М.
Back 4 Blood proves Valve carried Left 4 Dead
26:17
Crowbcat
Рет қаралды 8 МЛН