Garry's Mod

Garry's Mod

759 ratings
Better Flashlight [v1.0]
2
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Effects
Addon Tags: Fun, Roleplay, Scenic
File Size
Posted
Updated
376.202 KB
13 Feb @ 11:43am
20 Jul @ 3:55pm
8 Change Notes ( view )

Subscribe to download
Better Flashlight [v1.0]

Description
A simple script to enhance the HL2 flashlight, in third person the flashlight will always come from the player's view instead of the player model's hand, gives players the ability to choose a custom color and texture for it, and some more

For Developers
This addon overrides the behavior of the default flashlight, but I made sure you can still check for the player's flashlight.

Instead of using Player:FlashlightIsOn() you can use Player:GetNWBool("FlashlightIsOn"), Player:FlashlightIsOn() will always return false if the user is using this addon

The addon respects the Player:CanUseFlashlight() property and runs the PlayerSwitchFlashlight event to check if the player can switch it's flashlight on or off.

As for sound, it does not use or add a custom sound, it uses the default HL2 soundscript "HL2Player.FlashLightOn" and "HL2Player.FlashLightOff", so basic sound replacements should work.

Client ConVars
Name
Default
Purpose
cl_betterflashlight_local_player_only_shadows
1
If set to 1, only your flashlight will cast shadows
cl_betterflashlight_local_player_only_hl2_style
0
If set to 1, only your flashlight will "pullback" when too close to a wall or object, ignoring other players settings
cl_betterflashlight_glow
1
If set to 1, player flashlights will emit a glow when looked at
cl_betterflashlight_beam
1
If set to 1, player flashlights will emit a visible beam
cl_betterflashlight_beam_alpha
100
The transparency of the beam of a player flashlight
cl_betterflashlight_config_r
255
Your flashlight's color. Red component
cl_betterflashlight_config_g
255
Your flashlight's color. Green component
cl_betterflashlight_config_b
255
Your flashlight's color. Blue component
cl_betterflashlight_config_a
255
Your flashlight's color. Alpha component. NOT USED.
cl_betterflashlight_config_near_z
96
Your flashlight's extra near-z distance, this will try to avoid casting your own shadow
cl_betterflashlight_config_angle_lerp
0
Your flashlight's smooth turning factor, 0 is disabled
cl_betterflashlight_config_fov
60
Your flashlight's field-of-view
cl_betterflashlight_config_texture
"effects/flashlight001"
Your flashlight's texture.
cl_betterflashlight_config_hl2_style
1
Your flashlight's HL2-style setting.

Server ConVars
Name
Default
Purpose
sv_betterflashlight_override_default
1
Enable or disable overriding the default flashlight
sv_betterflashlight_follow_viewpunch
1
If set to 1, player flashlights will follow their viewpunch
sv_betterflashlight_disable_in_vehicle
0
Not recommended, buggy. If set to 1, flashlight is always off when in a vehicle
sv_betterflashlight_disable_in_vehicle_only_driver
1
Works with setting above, the restriction will only apply if you are the driver of the vehicle
sv_betterflashlight_debug
0
Debug overlays, only works with sv_cheats and developer ConVars
102 Comments
thatrandom1one1guy 25 Aug @ 3:53pm 
cuz i cant see that far when playing in the dark
thatrandom1one1guy 25 Aug @ 3:53pm 
is there a way that you can make the flashlight go farther?
Liokindy  [author] 16 Aug @ 8:48am 
Is it really a surprise a flashlight addon may conflict or break the flashlight functions of other addons...
mayonnaise licker 15 Aug @ 11:40am 
This mod seems to break TFA weapon flashlights
Liokindy  [author] 9 Aug @ 6:59pm 
@Zelen the kiwi I looked in the source engine's code and the behavior you're talking about is all hard-coded and can only be triggered by using the default flashlight. If there is a way to do it, it's probably way beyond my skill
Zelen the kiwi 8 Aug @ 12:20pm 
they do not. my best guess is the game tells alyx when your flashlight turns on but if a flashlight mod changes the flashlight at all the game cant tell when its on
Liokindy  [author] 8 Aug @ 8:38am 
@Zelen the kiwi I don't think I can, I think that's hard coded behavior. Do other mods work there?
Zelen the kiwi 7 Aug @ 9:11pm 
can you please make it work with ep1_c17_00 and ep1_c17_01? the areas with alyx break if your mod, or any other flashlight mod is installed
necro 5 Aug @ 12:55am 
Nevermind, I just went through my addons to make sure nothing was fucking with it, and Dynamic Flashlight was, oopsie
necro 5 Aug @ 12:52am 
It's not working, even when I apply the config the flashlight doesn't change