Garry's Mod

Garry's Mod

173 ratings
Improved Crossbow Bolt
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Entity
Addon Tags: Fun, Realism
File Size
Posted
Updated
126.004 KB
30 May, 2023 @ 6:16am
27 Jun @ 2:00am
30 Change Notes ( view )

Subscribe to download
Improved Crossbow Bolt

Description
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

    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 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)
61
30 Jul @ 8:18am
PINNED: Suggestions / Bugs
ValsdalV
93 Comments
ValsdalV  [author] 12 Jul @ 12:50pm 
I copied your settings and it still doesn't crash for me, it has to be one of the settings of the zetabots that creates a conflct.

What if you leave the crossbow bolt settings the same as you just posted, but only change the 'Player damage' to 0? Does it still crash?
Solar 12 Jul @ 11:04am 
pin serverside ragdolls - ON
cleanup time - Never remove
Player damage - 200
Npc damage - 200
velocity - 10.000

these are the settings that im using
ValsdalV  [author] 12 Jul @ 10:58am 
Perfect. All that's really left to do is try changing only one of these options at a time to see what causes the crash.

I would have done this myself, but the game works as it should here, leaving me no way to properly test your issue
Solar 12 Jul @ 10:19am 
yep that worked, no crash
ValsdalV  [author] 12 Jul @ 5:08am 
Ok, since the game is still is not crashing on my end, I ask you to try this:

change your host settings like so:
Pin serverside ragdolls -> off
Cleanup time -> Remove immediately
Player damage -> 0

If it no longer crashes with the settings changed like so, then there's hope to fix this issue
Solar 12 Jul @ 3:41am 
when i shoot them with the crossbow both single and multiplayer it just abruptly crashes instantly, and i do have keep corpses enabled
ValsdalV  [author] 12 Jul @ 3:16am 
@Solar If you mean this addon here:
https://steamproxy.net/sharedfiles/filedetails/?id=2773405248
I've been shooting at them for quite some time, with no crashes. I'm using the default options for the bots if that matters and, as the author suggests, I'm playing in singleplayer mode.

I've however noticed a bug with that addon, zeta players spawn a double ragdoll corpse when the sandbox option 'Keep corpses' is toggled off. The double ragdoll spawns regardless of the weapon used to deal the lethal hit, so maybe your crash has something to do with that.
Solar 10 Jul @ 2:16am 
so far ive seen it crash with the zetabots
ValsdalV  [author] 9 Jul @ 10:27am 
Can you list some of them so I can check?
Solar 9 Jul @ 3:56am 
some nextbots crash the game instantly upon being shot at with this mod enabled