Garry's Mod

Garry's Mod

281 ratings
Improved Crossbow Bolt
2
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Entity
Addon Tags: Fun, Realism
File Size
Posted
Updated
133.997 KB
30 May, 2023 @ 6:16am
17 Apr @ 7:53am
34 Change Notes ( view )

Subscribe to download
Improved Crossbow Bolt

Description
Description:
This addon builds upon the Half-Life 2 crossbow bolt, adding new features, that are fully customizable, to make it more interesting and fun to play with while still mantaining its characteristic feeling.

Some of the new features:
  • Uncapped top movement speed: makes it significantly easier to hit fast moving targets from afar and turns the Crossbow into the sniper weapon it's supposed to be

  • Bolts will stick to NPCs, players and props, a feature the Half-Life developers intended to implement, but ultimately didn't. NPCs and ragdolls can be pinned to nearby walls and props. Sandbox's 'Keep Corpses' option should be turned on to have the best experience with this addon

  • Better integration with the physics engine: the impact force will push the target more realistically, taking into account the body part that was hit



Full addon settings list:
As an alternative to the developer console, a configuration menu is provided to quickly edit the addon's options.

Server ConVars
    General settings
  • improved_crossbowbolt_ragdoll (0, 1) : Pin serverside ragdolls to walls and props when hit. Warning for server admins: while it is perfectly fine to keep this option on during regular play, you might want to disable it when hosting an open server as it can be exploited to cause massive lag under certain circumstances

  • improved_crossbowbolt_preview_allow (0, 1) : Allow clients to activate the trajectory preview feature

  • improved_crossbowbolt_hipfire (0, 1) : Bolts are shot from the crossbow's tip instead of the shooter's eyes

  • improved_crossbowbolt_lifetime (-1, 0, 1) : Choose when bolts will be removed after an impact, by setting this ConVar to one of these values:
    • 0: bolts are removed after one minute; this is the default option
    • 1: bolts will not stick to their targets, they will instead be removed
    • -1: bolts will stick indefinitely to what they hit

    Damage
  • improved_crossbowbolt_incendiary (0, 1) : Bolts will lit flammable props on fire

  • improved_crossbowbolt_hitgroupdmg (0, 1) : Damage will be scaled depending on the target's body part hit. How much it will change is up to the active gamemode to control, but it usually means that headshots will deal more damage, whereas hits to the limbs will inflict less

  • improved_crossbowbolt_playerdmg (100, numeric) : The amount of damage inflicted by player-fired bolts

  • improved_crossbowbolt_npcdmg (20, numeric) : Same as the above, but for bolts fired by anything that is not a player

    Movement/Physics
  • improved_crossbowbolt_velocity (3500, numeric) : The distance (in Hammer units) that a bolt covers each second. The default value of 3500 is the maximum speed allowed by the game's physics engine, but this addon allows to go beyond that with no issues

  • improved_crossbowbolt_gravitymul (0.05, numeric) : Multiplier of the world gravity ('sv_gravity' game ConVar) for this entity. When set to 0, bolts will fly with no drop

  • improved_crossbowbolt_pushscale (1, numeric) : Multiplier of the impact force that is applied to an entity after a direct hit. This is scaled further by the 'phys_pushscale' game ConVar

  • improved_crossbowbolt_spread (0, numeric) : The randomized inaccuracy angle of each shot, in degrees

    Trails
  • improved_crossbowbolt_trail (0, 1) : A purely cosmetic option, bolts leave a trail as they travel

  • improved_crossbowbolt_trail_startsize (16, numeric) : Width the trail will start at

  • improved_crossbowbolt_trail_endsize (1, numeric) : Width of the trail as it disappears

  • improved_crossbowbolt_trail_lifetime (0.2, numeric) : How many seconds it takes for the trail to disappear

  • improved_crossbowbolt_trail_color ("220 100 5 255", string) : Color of the trail, in the format "RED GREEN BLUE ALPHA", where each color component is an integer in the interval [0, 255]
    A few examples, for reference:
    • "255 128 0 255": Orange
    • "255 0 0 255": Crimson red
    • "0 128 255 64": Semi-transparent Cyan

  • improved_crossbowbolt_trail_texture ("trails/laser", string) : Path to the texture to use as a trail, relative to the materials/ folder

Client ConVars
    General settings
  • improved_crossbowbolt_ragdoll_cl (0, 1) : Each player can decide to toggle on or off the pinning of clientside ragdolls on their world

    Trajectory preview
  • improved_crossbowbolt_preview_lines (200, numeric) : The maximum number of trajectory segments that can be rendered. A lower value impacts less on the performance, but shortens the trajectory's length

  • improved_crossbowbolt_preview_color ("255 255 255 255", string) : Color of the trajectory and the hit entity class name. See the 'improved_crossbowbolt_trail_color' ConVar for details on the color string format. Because of rendering limitations, the color's alpha value is ignored

Console Commands
  • improved_crossbowbolt_menu : Opens up the addon's configuration window

  • improved_crossbowbolt_preview (0, 1): Activates or deactivates the shot trajectory preview, depending on the argument (1 starts previewing, 0 stops). Warning: preview activation must be allowed by the server host



Credits:

The Dev team
  • ValsdalV [Author] : Lua code - Translations - Testing
  • gianpaolodema [Contributor] : Testing - General help and support

The Garry's Mod Community
Huge thanks to all the players that contributed with their ideas, bug reports and encouraging comments, you helped shape this addon into what it is today



Enjoy!
Popular Discussions View All (2)
71
6 Apr @ 3:37am
PINNED: Suggestions / Bugs
ValsdalV
119 Comments
vortigaunt 5 Jul @ 7:29am 
another great thing about this mod is that admin cleanup actually deletes the bolt meaning you don't have a bunch of unremoveable bolts in your game
ValsdalV  [author] 3 Jun @ 12:44pm 
You can try setting all bolt damage options (both player and NPC) to an immense value. If crossbow bolts are still inflicting only 10 damage when the options says 1000000, then no doubt you have an addon that Is completely resetting the damage value to what it wants. In that case, until you figure out the culprit, nothing more can be done I'm afraid.

You are right that my addon does not touch VJ crossbow bolts, as they are a different entity from HL2 bolts
Birthday Boye 3 Jun @ 11:52am 
So an override damage script would be nice if its ever possible, forcefully referring the convars dmg to your addon.
Birthday Boye 3 Jun @ 11:46am 
exactly, (edited as 165 but does not applied unlike every npc>ply dmg convars, still at 10) by the time i want to add some enemy variety for my mindless hardcore combine horde fight, testing weapons and bumping up the damage for them. Notice that it won't apply the modified damage for anything no matter type of work around i took, finding conflicting addon that somehow tampering the crossbow damage for npc and so on. I think "vj base crossbow" works best for now with its high damage output (100), but minimal reload time per shot (almost rapid fire without mere mininal spread, down right aimbot) and yet high velocity steel rod are still left to be desired for it... (npc VJ hl2 crossbow does not effected by this mod)
ValsdalV  [author] 3 Jun @ 11:15am 
It definitely sounds like something is interfering with the damage calculations... Try to deactivate the 'hitgroup damage' option of this addon, if you have it set, and see if it changes anything.

Also, did you have this damage issue before installing this addon?
Birthday Boye 3 Jun @ 10:24am 
It already was in skill 2, typed in the convar in game console to skill 4 to refresh the issue i'm having before swtiching back to 2, worst mistake of my life... had to redo skill config all over again, but no matter modifying the damage in game or cfg text, it still does 10 damage no matter what... (only players to npc, not vice-versa) I thought this addon would atleast remedy this issue but it nullified.the crossbow damage completely instead... Looking back, this addon looks dope as hell and i think i can't live without it. But can't in my life be able to fix that oddly specific issue, perhaps i need to data mine little bit more to find the root cause of it. Though I wonder it if can be done to forcefully applying the said damage with own script than referring to the convar, think it was possible do such thing?
ValsdalV  [author] 3 Jun @ 1:39am 
@Birthday Boye
NPC damage inflicted to players is scaled by the 'skill' ConVar. If you want them to inflict the same damage you have set in this addon's options menu, the 'skill' ConVar has to be set to 2 (Normal difficulty).

I've just tested this in Sandbox with some NPCs just to make sure, they were all equipped with a crossbow: Enemy Rebel, Metro-Police and Alyx (turned hostile with a mod) all inflict the expected amount of damage on Normal difficulty. Combine soldiers don't know how to use a crossbow by default, so most of the time they just stand there being pacifists
Birthday Boye 2 Jun @ 1:02pm 
I came to subscribe this addon for the sole reason of skill.cfg didn't do jack shit on crossbows damage modifiers. Oof
Birthday Boye 2 Jun @ 12:57pm 
Is it just me or the rebel and combine npc (with retail-like animation addon so they don't t-pose) didn't inflict any damage to me? (wanting to add a certain combine as if they were snipers in zippy's horde addon, but with them dealing zero damage to me at all is ruining my day in adding interesting enemies... Care to patch it out maybe? thanks
Sanders 29 Apr @ 5:38am 
ok cool and thank you