Left 4 Dead 2

Left 4 Dead 2

Throwable Melee Weapons Advanced (Vscript)
102 Comments
kurochama  [author] 18 Aug @ 11:42pm 
@Cr0w , probably there were some errors on console after you modified some scripts. It would be easier to check if you make a new discussion thread, & then copy-paste which parts of scripts you modified there. Sometimes removing some scripts may cause errors if there are some important scripts deleted by accident.
Cr0w 18 Aug @ 4:04pm 
I wasn't sure how to explain it, but I was trying to make the world a valid target for an area of effect to occur and also remove the requirement of a button press for activation to make throwing the primary fire. I couldn't seem to remove the requirement without it resulting in it lightly throwing the weapon with no effect.
kurochama  [author] 17 Aug @ 7:34pm 
@ Cr0w , what alterations? You can open a discussion thread on this mod to discuss, as comments don't support format for codes.
Cr0w 17 Aug @ 4:26pm 
I'm attempting to make a version of this with a couple alterations and I was wondering if I could discuss this with you.
Bonnie 15 Jul @ 2:42pm 
weird that your version but not him, is not conflict melee frenzy btw
kouga 14 Jun @ 8:00am 
@kurochama thanks. ill reach out to you once my schedule is a bit more free
kurochama  [author] 11 Jun @ 4:32am 
@Kouga , I just sent you a friend request.
kouga 10 Jun @ 9:21pm 
@kurochama i've uploaded the aim to shoot version now, https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=3496527153
once again, thank you for your help

as for your tips, would you mind if i sent you a friend request on either steam or discord to inquire further assistance on how to pull off each point? thank you
kurochama  [author] 7 Jun @ 1:11am 
@Kouga , for each point:
1. You need to rename the melee script on the melee model names (see my "Flamethrower with GL Skin" for knife).
2. To spawn an item when empty-handed, you can use "weapon_drop" & set it only if secondary slot is empty (no weapon). I think my "Throwable Melee" already has the example for that.
2.5. I think there's a mod that gives magnum as the gun when incapped, though I'm not sure if that can solve the pistol problem.
3. You can exclude a melee from being throwable by using the model names to register the melee (see my "Knife Throwing Arts" for the way to register melee model name).
kouga 5 Jun @ 12:00am 
btw, i mentioned 2.5) because i plan on greatly changing the function of pistols as well in the gameplay. currently, the "Primary Slot Pistols" mod make it so you spawn with a pistol as a primary slot, which works fine and well. And with the rise of the current edit of "Throwable Melee" you helped me create, it really shows some fun potential! the only problem is that when you get incapped, you still are given the pistol as a replacement primary, whch again gives the unwanted effect of dropping your current primary weapon and spawning a pistol out of thin air. it gives off a feeling of an infinite duplication glitch which is not what im going for.

as for 3) im not sure how to tackle exactly. i think youve mentioned before that its possible to make "Throwable Melee" to leave it as an exception? but in case that isnt possible or is too much work, would destroying the weapon and giving it back as soon as it leaves your hand be a good idea? what do you think could be done?
kouga 5 Jun @ 12:00am 
@kurochama tbh thats giving me all the more reason to want to have survivors fists as a melee weapon xD because then you could throw your melee and instantly have it replaced with fists (therefore it wont switch to primary & no SCOPE/ZOOM mode) ...but the logistics of it really have to be thoroughly accounted for. as it stands from what we've discussed these are the points to tackle with it, let me know if there are more:

1) it needs to spawn in every map
2) but it also has to be bext except when survivors are empty handed
2.5) making the pistol not spawn as a default weapon at all
3) have the fists be unthrowable

for 1) that can be done by modifying the melee scripts in the melee directories, but im not too sure about how to pull off 2) & 2.5) just yet...
kurochama  [author] 4 Jun @ 9:54am 
@Kouga , good to hear that you successfully edited it to work completely. About that ZOOM on primary, yeah, if you have a mod that allows ZOOM the moment you switch to primary after throwing melee, you'll go into SCOPE/ ZOOM mode.
kouga 4 Jun @ 9:37am 
now that I have the ideal functions in place I can see clearly now why my view would "scope" when I throw the melee using ZOOM. the scope actually activates as soon as the melee leaves my hands; which is also when i switch to my primaries (and theyre the ones that zoom!) funny discovery :D
kouga 4 Jun @ 9:34am 
@kurochama loud and clear! ill make sure to give proper credit if or when i post it! btw ive been familiarizing myself with editing the vpk files and whatnot, so your instructions really made things super clear to me!! after opening up my game to test, it works fantastic!!! exactly what ive been looking for all this time, thank you so much for the help!
kurochama  [author] 4 Jun @ 6:50am 
@Kouga , it's ok as long as you put the link of the original version on the mod description.
As for editing to remove ZOOM throw mode, probably it might be slightly complicated as you'll need to remove/ change some scripts like:
1. On "item_pickup" event function, remove some parts starting from "for(local entity; entity = Entities.FindByClassname" down to the end of its brackets.
2. On "weapon_fire", change the number 8192 to 524288.
kouga 4 Jun @ 4:08am 
@kurochama do you allow other people to edit your mods and republish them? because if its too much work implimenting what i mentioned, would you mind instead assisting me with modifying your addon for personal use / republishing, just to replace both RELOAD + FIRE and ZOOM to just ZOOM + FIRE as the method of throwing?
kouga 3 Jun @ 9:03am 
@kurochama got it, im testing right now. its working!! you do such an awesome job at this :DD
and regarding the combo keys, I really still want them back tbh. couldnt you add another cfg option for it that changes the other throwing button to either 1) ZOOM or 2) ZOOM + FIRE please? just so that it would fulfill both of our preferences....it doesnt have to be a full keybind customisation feature like we've discussed before, just something that lets us pick between either options :>
kurochama  [author] 3 Jun @ 8:50am 
@Kouga , I just updated, & now "Temporary Pistol on Melee Throw" also works on RELOAD + FIRE.
As for the old combo keys, ZOOM + FIRE, as you read there, they preferred ZOOM key only. The "low gravity throw" only shows up when using ZOOM key. It was a normal throw when using "ZOOM + FIRE".
kouga 3 Jun @ 8:34am 
@kurochama, I read it just now and I see!

-so the ZOOM key used to be ZOOM + FIRE initially, such a shame if im being honest! Id really like it if it returned to the original shortcut ZOOM + FIRE because it just works so well with your Scope with all guns addon. I mean think about it, ZOOM is the aim button, so using it universally as the button to aim both guns AND melee just makes sense!!
-I think choosing between "normal throw" or "low gravity throw" is a good choice, yes! but also another question, was the low gravity effect observed when it was still ZOOM + FIRE?
kurochama  [author] 3 Jun @ 8:21am 
@Kouga , you can check some comments on the prototype version of this mod here: Throwable Melee (Prototype) . There are some discussions there that becomes the reason why I added ZOOM key. Originally it's "RELOAD + ATTACK".
It would be too many features if a feature to disable one of alternative keys to throw melee is added. I'll just let people choose whether they use "normal throw" or "low gravity throw".
kouga 3 Jun @ 8:08am 
@kurochama, awesome! thank you for your hard work as always :) oh and while you're at it, ive turned around on you're idea of rebinding ZOOM --> TAB + SCOPE and i think it would be a good idea. however i also wonder why there are two buttons to throw a melee in the first place? it really would be nice to be able to choose which key/s activates the throw, or atleast only limit the throwing key to RELOAD + FIRE. what do you think?
kurochama  [author] 3 Jun @ 7:26am 
@Kouga , I'll add for RELOAD + SHOOT soon, as last time I only checked on the ZOOM part.
kouga 3 Jun @ 7:05am 
@kurochama thank you for the new feature! ive updated it and tested just now and noticed one thing, does TemporaryPistolOnMeleeThrow 0 also not work for you when throwing using RELOAD + SHOOT? Any quick fix? it seems to function as intended when using ZOOM, but I have told you before how Id much rather use the other button for this mod, as it still zooms the screen the moment I throw due to scope on all guns (i would be willing to provide a recording of that zoom behavior as well if you dont know what I mean).
kurochama  [author] 3 Jun @ 4:59am 
@Kouga , I added a new feature, "Temporary Pistol On Melee Throw". You can disable this if you don't want temporary pistol after throwing melee.
kouga 2 Jun @ 10:53pm 
@kurochama so when i threw the melee, it would switch to the Primary Weapon slot AND also give me a pistol, therefore dropping the current weapon i already had. Now I quite like the Primary Pistols, so this kind of circles back to my request of adding a feature to this mod that doesnt provide you with a pistol at all. Originally I had discussed with you about the possibility of giving the player a custom bare hands weapon after throwing the melee, and you mentioned several hurdles as to why you cant just do that. So Id like to propose one last "solution/compromise" if thats okay. How about instead of giving you bare hands or pistols, have an option in the cfg file that dictates whether or not throwing the melee would give a pistol/switch to primary slot entirely? meaning it would just produce the same effect as dropping the melee, and the secondary slot would just be empty. How does that sound?
kouga 2 Jun @ 10:42pm 
@kurochama , so the weird behavior can be observed when using either scope/zoom or reload + attack. ive been trying to narrow down which mod it conflicts with but it was weird because this wasnt something that showed up before, so it couldnt have been any of the item drop mods i had (they also didnt use reload zoom or attack). i gave it more time and found that it really *was* the Primary Slot Pistols mod that caused the behavior. turns out my L4D2 doesnt recognize what mods are active in the game unless i do a full restart now lol. (that might be because i have 380+ mods on
kurochama  [author] 2 Jun @ 1:40pm 
@Kouga , it never happened to me. My primary was still there when I threw the melee. Which buttons did you use to throw? Scope/ Zoom button, or the "Reload + Attack"? Probably certain mod about item drop might cause it. You can check your mods that allow item drop by pressing either Zoom, Reload, or Attack.
kouga 2 Jun @ 11:22am 
me again @kurochama. im noticing some weird behavior i havent encountered before. if i throw the melee while i have a primary weapon, it will drop the primary altogether. at first i thought it was a conflict with the Primary Slot Pistols mod I had installed but it wasnt. im not entirely sure why its happening but it often gets me confused because my primary would disappear from my hand after i throw the melee in the middle of combat, and that gets me to take more damage than i should be. is the same behavior present when you test it?
kouga 16 May @ 1:22am 
its not a distraction at all. I have CTRL bound to where CAPSLOCK is, so its much easier on my pinky to reach during play. My ALT key is also where my TAB originally is... as you see I do agree because I also dont use TAB as frequently and given the layout of my keyboard I put it somewhere out of way. It would be straining for my fingers to have to reach all the way down just to throw, but i know thats a specific use case. my compromise at the moment is to rebind RELOAD to Q, so my hands can reach it much more reliably, but thats besides the point👍
kurochama  [author] 15 May @ 11:52pm 
@Kouga , won't it become a distraction during play if you press CTRL for crouching & at the same time the survivor's status & maps are displayed because of the SCORE function? I usually leave TAB alone as I almost never check it unless if I forget which map I'm in when playing custom campaigns.
Normally it should be possible to combine "ZOOM + FIRE" to throw melee, but I can't see it as an effective solution. & if what your problem is the scope feature being active after melee throw, changing to "ZOOM + FIRE" won't affect much either, as the primary gun will still zoom the moment you switch to primary gun after throwing melee.
kouga 15 May @ 11:32pm 
the thing with TAB is that I personally have it bound to where the CTRL key is on the keyboard; which is more of a me-problem than anything but its definitely a factor into why id rather have SCOPE + FIRE. as for RELOAD + FIRE, that is the button ive been using as an alternative, and i rather like the lower gravity effect it has. i just wanted to ask if it were possible to update the current buttons. ✌️
kurochama  [author] 15 May @ 11:04pm 
@Kouga , instead of "SCOPE + FIRE", I think it's better to use TAB (Score) button instead as an alternative to throw melee, as this button is almost never used except only for few purposes. & actually you can also use "RELOAD + FIRE" to throw melee, but this throw is affected by gravity so it will fall to the ground earlier than when using SCOPE/ ZOOM.
kouga 15 May @ 8:00pm 
im not sure if we're on the same page xD scope on all guns + throwable weapons actually work fine. there's no bug where my melee throws when i hold my primaries. the behavior im talking about is when im holding my melee and it does two things:

1) it still zooms when I hold SCOPE/ZOOM. I should clarify that I am on ScopeZoomMode 5
2) the melee throws as soon as I press SCOPE/ZOOM, but id like it to be updated to SCOPE/ZOOM + FIRE instead.

i just dont want the melee to throw immediately when I press SCOPE/ZOOM. my reasoning is just that it feels mechanically better. sorry for the confusion xD
kurochama  [author] 15 May @ 7:41pm 
@Kouga , that's really strange then, as actually I often used this together with my m203 series mods, & as those mods also use SCOPE/ ZOOM to trigger m203, so it's basically the same zoom mechanisms as "Scope On All Guns". But I never had a bug where my melee was thrown by accident when I used SCOPE/ ZOOM on my primary guns when I was trying to use m203.
kouga 15 May @ 7:29pm 
okay, after further testing ive reconfirmed that scope on all guns really does zoom the instant i throw the melee weapon. but it seems that the behavior of throwing does originate from this mod. my request is to just have the SCOPE/ZOOM button be held and require FIRE to actually throw the melee (SCOPE/ZOOM + FIRE, the same behavior as RELOAD + FIRE) instead of just tapping SCOPE/ZOOM once. is that possible? :>>
kouga 15 May @ 6:27pm 
1. thats odd then, im not sure whats causing the issue in my game exactly but i swear that zooming launches the melee somehow. and it does that only when im holding the melee not the gun like you said. im not on my laptop rn so i cant confirm but i will do further testing.
2. ah, i see then. its a bit impractical to have it implemented because of the limit. no worries then
kurochama  [author] 15 May @ 11:17am 
@Kouga:
1. Melee is only thrown if you're holding melee when pressing SCOPE/ ZOOM. So if you're holding a gun, the melee won't be thrown.
2. The available buttons are actually limited, like there are only movement (w, s, a, d), crouch, walk, jump, shove, score, use, reload & scope/ zoom. So even if a feature is made, you can only change the button to either one of those I mentioned.
kouga 15 May @ 6:48am 
hey im back. i have two more (hopefully easier) suggestions for this mod. could you make it so 1) SCOPE/ZOOM is updated to SCOPE/ZOOM + FIRE? i have the Scope on all Guns mod installed, and so its a little jarring to have the melees fly immediately as soon as i zoom. 2) could you make it configurable which button to press/hold to throw?
kouga 9 May @ 8:17pm 
Ah, I understand. After all the current hands melee addon already requires you to have to manually precache the spawn in the missions folder so theres an added element of tediousness present already, making another addon just to do the same is not worth it for yall. But if we're talking problems with changing pitchfork, wouldnt a melee unlocker like this do the trick? im not really sure how many people will see this request and push for the same thing, so im really just trying to lower the hurdles as much as i can. if it comes down to it im going to look into modding it myself but i do want to see someone who already knows their stuff to make it a reality much sooner than i can. :DD
kurochama  [author] 9 May @ 7:53pm 
@Kouga , it would be too much of work to make an alternative version just to add bare hands as the custom melee after throwing a melee. Both methods should be possible, with their own problems, like, if it's purely a custom melee then more editing on scripts to manifest melee & missions in campaigns will be needed to add bare hands on the list of melee spawned in certain campaigns. As for changing pitchfork with bare hands, this one is way simpler but the problem for this one is, this melee will only spawn in certain campaigns. So, if pitchfork isn't available in a map, throwing a melee will completely lose the secondary, as bare hands are not available in that map.
Probably if there are many who request for this, I will think about it.
kouga 9 May @ 5:51pm 
or just make a separate version of this mod that wouldnt conflict with custom bare hands. this mod can be for those who dont want the custom hands, and the other for those who do. because i can definitely see the latter being a well sought after mod.
kouga 9 May @ 5:46pm 
if its just compatibility that's the issue, you could do what i said before and just have bare hands replace an unwanted melee like the pitchfork, and have its spawn rate on the map nonexistent so that it only appears when you are empty handed. or would that still not work?
kurochama  [author] 9 May @ 3:10pm 
@Kouga , probably I can add other modes on "Melee Warp Pickup" later, like, when it's set to value above 1, the specific distance of warp pickup will be applied instead of unlimited distance.
For bare hands, it's possible to exclude certain melee from becoming a throwable melee. But I think another problem that will be waiting ahead will be mod compatibility. Mods with custom melee require that melee to prevent model errors/ missing textures, so, if bare hands were added, other players that didn't have "Throwable Melee" enabled would see either an invisible/ missing melee or a big "Error" text when bare hands are used. So, for compatibility for other players as well, it's better not to add bare hands.
kouga 9 May @ 10:23am 
@kurochama well ill definitely play with the settings high for now like you said, but yeah up to you if you wanna go for the new mode idea

do you think it would be possible to exclude the bare hands from being thrown? like as a part of a configurable setting where you can choose what melee can be thrown or not
kurochama  [author] 9 May @ 10:04am 
Kouga , the closest result to your idea is when setting both "Melee Throw Hit Cooldown" & "Melee Throw Miss Cooldown" to high values like 9999999, then enable "Melee Warp Pickup". Melee won't return no matter if it hits or misses, & as long as you don't press E, you won't pick the thrown melee. If it's about adding the distance feature, probably that "Melee Warp Pickup" is also the feature that has potentials to be modified with a new mode that limits the melee pickup distance instead of the unlimited pickup distance.
As for bare hands, probably that may trigger another bug. Bare hands/ knuckles are registered as melee too if I'm not mistaken, so, they can be thrown too (imagine after throwing a melee weapon, you throw your hands to zombies & get new hands as the loop :steamhappy: ). & this may cause increased number of entities if the bare hands are thrown continuously.
kouga 9 May @ 8:05am 
ideally the fists shouldnt spawn on the map and that you only get them when you dont have any weapon on hand, although in case its too much hassle for you (and those who would subscribe to such a mod) to deal with custom weapon scripts, i wonder if an easier compromise would be to just replace a currently existing and less favored weapon (like the pitchfork) with the hands weapon and then alter their spawn rates to basically nonexistent chances?
kouga 9 May @ 7:59am 
I understand that the apprehension regarding the new feature idea, I just think itd be neat to have a gameplay flow where the melee wont return even on a hit if what it hit was far enough. its just really fun to have the bounciness of melees returning during a panic event but it does lean a bit on the unrealistic side at times so i just wanted to throw that new feature as a suggestion.

abt the pistol tho, this might be outside the scope of the mod (i just think it would be a good idea overall), it would be cool if survivors are given something like the Hands melee weapon so that theyre not completely helpless if empty handed. Maybe a separate mod that compliments mods like your Throwable Melee one, or your Swap and Drop by giving you fists when you dont have any primaries or secondaries? What do you think? :D
kurochama  [author] 9 May @ 5:04am 
@Kouga , normally if you don't want melee to return when missing a target, you can set "Melee Throw Hit Cooldown" to high value like 999999, so you can pick the melee manually after a successful hit. Adding a new feature like melee return when in certain range near the melee owner is possible, but I'm not sure if it's a good thing to add it, as normally people only need to change "Melee Throw Hit Cooldown" & "Melee Throw Miss Cooldown" to set whether the melee will return or not in simple ways.
As for the reason I gave a pistol, it is to prevent a situation when a survivor still doesn't have primary, like in map 1 of Dead Center. If a melee is thrown & no pistol as the temporary replacement, the survivor won't be able to defend from zombies other than manually shoving with medkits or other usable items. So, empty secondary slot can become a dangerous situation if there's no primary.
kouga 9 May @ 4:24am 
oh and another thing, is it possible that you can make it so i dont get a temporary pistol at all when i throw the weapon? just have it be empty handed
kouga 9 May @ 4:18am 
can you make an option to set the melee return dependent on distance? i want my melee weapon to return to my inventory only if the target i hit is not too far away, and at the same time i want my melee to not return if the target is too far.