Improved Crossbow Bolt
Description:
This addon builds upon the Half-Life 2 crossbow bolt, fixing old bugs and adding new features to make it more interesting and fun to play with while still mantaining its characteristic feeling.
A summary of the new features:
- The main addition is the uncapped top movement speed, making it significantly easier to hit fast moving targets from afar and turning 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 players’ and NPCs’ corpses more realistically, taking into account the body part that was hit. Speaking of body parts, bolts are now capable of scoring headshots to deal increased damage
- Bolts interact better with water, displaying gunshot-like splashes when hitting liquid surfaces. The trail of bubbles bolts leave when underwater is now a particle effect, lighter on the server’s CPU and in network usage
Addon Settings: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_lifetime (-1, 0, 1) : By setting this ConVar to one of the following values, you can choose when bolts will be removed after an impact
- 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) : Crossbow bolts will inflict burn damage, causing flammable props to be lit on fire when hit
- improved_crossbowbolt_hitgroupdmg (0, 1) : Bolt damage will be scaled depending on the target’s body part hit. How much the damage 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 NPCs, turrets and any other entity that is not a player
Movement/Physics- improved_crossbowbolt_velocity (10500, numeric) : The distance (in Hammer units) that a bolt covers each second. Setting this to a high enough value will basically turn the bolt into an hitscan bullet. For reference, the original crossbow bolt travels at a top speed of 3500 units per second, which is also the maximum speed allowed by the game’s physics engine
- improved_crossbowbolt_gravity (4.05, numeric) : Setting this to 0 will make the bolt move in a straight line, 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 inaccuracy angle of each shot, in degrees. Setting this to 0 makes each shot perfectly accurate
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. This option is merely cosmetic, has no impact on the shot simulation’s result
- 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 CommunityHuge 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!