Left 4 Dead 2

Left 4 Dead 2

26 ratings
Throwable Melee Weapons (Prototype) (Vscript)
   
Award
Favorite
Favorited
Unfavorite
Game Content: Weapons, Scripts, Miscellaneous
Game Modes: Single Player, Co-op
Weapons: Melee
File Size
Posted
Updated
21.370 KB
12 Feb @ 8:53am
15 Feb @ 6:09am
6 Change Notes ( view )

Subscribe to download
Throwable Melee Weapons (Prototype) (Vscript)

In 1 collection by kurochama
Unique Weapons with Special Features
57 items
Description
Actually this mod was made just to satisfy my curiosity & originally I never expected this to work (but it worked in the end lol). This mod was inspired by some requests on L4D2 discussion forum, as there's someone who kept requesting the port of "Throwable Melee" from alliedmods to a vpk mod. I didn't read the scripts on the alliedmods at all as I thought that it would take time to make me understand the mechanisms there. So, instead of reading there, I just tried to build the simple mechanisms I had in mind via "Think" function. & here's it is, a "Throwable Melee Weapon" with simple scripts that even the author (me) was so shocked that this worked by miracle :D .

So, I named the title with "Prototype", as there's still no cfg file here. I have a plan to make some features like "Damage Multiplier", "Throw Hit Cooldown", & "Throw Miss Cooldown", but maybe later if there are further requests.

The simple mechanisms of "Throwable Melee Weapon":
  • Hold RELOAD button & then press ATTACK to throw the melee you're holding. Alternatively, you can simply press SCOPE/ ZOOM button to throw.

  • You'll temporarily get a pistol after throwing your melee. If you have a primary gun, you'll switch to primary gun instead of secondary.

  • The thrown melee will have a special dynamic light following it, so it works like flare.

  • When it successfully hits zombies (CI, SI, tank, & witch), there will be a small shockwave special effect.

  • The damage is equal to normal melee attack. Here's the table of damage:
    Zombie Type
    Damage
    Common infected
    - Instant kill
    - Common infected near the target will stumble
    Witch
    - Damage is equal to 50% of current health
    (at 1000 health, 4 throws will kill witch, like the default)
    - Common infected near the target will stumble
    Tank
    - Damage is equal to 10% of current health
    - 20% chance to stumble
    - Common infected near the target will stumble
    Charger
    - Damage is equal to 80% of health when health is above 500
    (2 hits to kill)
    - Instant kill when health is below 500
    - 100% chance to stumble
    - Common infected near the target will stumble
    Other Special Infected
    - Instant kill, like the default melee damage
    - 100% chance to stumble
    - Common infected near the target will stumble

  • The thrown melee can destroy breakable objects. Custom bosses/ enemies in custom campaigns may be included as long as they can take damage.

  • When the thrown melee hits zombies, there's 1 second of cooldown until the melee automatically returns to the owner.

  • When the thrown melee hits objects or misses, there are 5 seconds of cooldown penalty until the melee automatically returns to the owner.

  • You can throw the melee at other survivor, but it will deal no damage. Instead, the survivor thrown with melee will stumble & use some voicelines to complain, or scream (don't try to throw it at Zoey or Louis, ok :D ).

  • The throwing damage can bypass riot zombie's armor.


Q: "Does this work on custom melee weapons?"
A: "As long as they're not custom melee weapons with special features/ powers like flamethrower, rocket launcher, Celestial Melee Weapons etc, it will work. Actually it also works on those custom melee weapons with special powers, but it would be funny to throw your flamethrower instead of using it to burn zombies, wouldn't it? Heheheheh..."


So, with this mod, you can have a semi-boomerang melee to support you as a melee wielder, so you can also deal long range even without pistols.


NOTES:
  • A video preview will be added later.
  • A known bug: If you use SCOPE/ ZOOM to throw the melee, the melee will be thrown farther than when using RELOAD + FIRE, as if it's thrown with lower gravity (no idea how this could happen, as the throw mechanisms are actually the same, with only different keys to press).
  • This can't be used together with "Melee Sharpshooting" mod, as this also uses SCOPE/ ZOOM button to throw melee.
30 Comments
kurochama  [author] 16 Feb @ 7:56am 
@Cory Benston , I still have no clue of how to reset the low gravity on melee throw via ZOOM key. I tried to reset via netprops but it had no effect. Probably I'll try to add some velocity later, to see if that could reset the low gravity.
As for "Melee Throw Glow Type", if you set to 1, it uses dynamic light. If it's set to 2, it uses custom glow (orange). You can test it yourself to see how it looks like.
Cory Benston 16 Feb @ 6:21am 
i hope the zoom throw is gonna be fix later. Also can you explain how does the "Melee Throw Glow Type" work?
kurochama  [author] 15 Feb @ 5:38am 
@Cory Benston , probably I'll do a quick update again soon. I'll slightly modify the scripts to remove that error on console, & also add a new mechanism to force player to switch to primary gun if they have primary gun. They'll still get the temporary pistol though.
kurochama  [author] 15 Feb @ 5:14am 
@Cory Benston , that's what I mentioned on the "Notes". When using ZOOM to throw, the melee is thrown, but somehow with lower gravity. & in fact, I didn't modify the throw mechanisms at all except by adding the ZOOM key. That error on console is also strange, because if the melee is successfully thrown, then it means that the scripts work. Probably it's triggered because I used "Think" function to check ZOOM button & whether the melee is still in player's hand (the moment it's thrown, it's no longer in player's hand so that's why the "player" there is "null").
Cory Benston 15 Feb @ 5:03am 
@kurochama i tried it and it works, but when i throw it (the zoom button), the melee has zero gravity to it. And also it gives me this in the console:


AN ERROR HAS OCCURED [the index 'GetActiveWeapon' does not exist]

CALLSTACK
*FUNCTION [GetActiveMainWeapon2()] c:/program files (x86)/steam/steamapps/common/left 4 dead 2/left4dead2/addons/workshop/3426113086.vpk/scripts/vscripts/director_base_addon.nut line [147]
*FUNCTION [unknown()] c:/program files (x86)/steam/steamapps/common/left 4 dead 2/left4dead2/addons/workshop/3426113086.vpk/scripts/vscripts/director_base_addon.nut line [157]

LOCALS
[player] NULL
[this] TABLE
[owner] NULL
[this] TABLE
kurochama  [author] 15 Feb @ 4:23am 
@Cory Benston , I just finished updating the ZOOM button. You can try it.
kurochama  [author] 15 Feb @ 3:23am 
@Cory Benston , I just finished testing, & the ZOOM button can work almost instantly (or instantly? It's triggered in 0.05 second when a player presses ZOOM buttom while holding melee). Probably I'll update this & the advanced version soon, after testing it on the advanced version too.
Cory Benston 15 Feb @ 3:12am 
@kurochama you can make a seprate addon with my idea and call it "alternate" version. (if you want)
kurochama  [author] 15 Feb @ 2:30am 
@Cory Benston , if what you meant was using ZOOM key to throw melee, I think this is also possible, but it might have a delay. For example, players need to hold ZOOM key in less than 0.1 second to throw melee (not instant throw on click/ press).
Cory Benston 15 Feb @ 2:10am 
@kurochama i dont quite think that you understood the "zoom option". What i meant is throwing the melee with the single key press.
I dont know how to enable/disable the "Melee Throw Glow Type" in the console. Also i made a mistake for calling the outline a "highlight".