Is it possible to modify the way the red HUD effect works with certain guns?
19 replies, posted
I have this idea for a weapon that does low damage, but has a lasting red screen effect. Is there a way to modify when the effect happens and/or how long it appears for individual guns?
Any ideas would be great.
Red HUD effect?
[QUOTE=code_gs;44690025]Red HUD effect?[/QUOTE]
when you get shot and your screen turns red
[QUOTE=Onion Wizard;44690084]when you get shot and your screen turns red[/QUOTE]
In what gamemode? That doesn't happen in Sandbox.
[QUOTE=Aeternal;44690865][URL="http://coderhire.com/scripts/view/227"]Like this?[/URL][/QUOTE]
Yeah, that. I was thinking I could use something from that, but I was wondering if there was a way I could make it happen when shot from a certain weapon and last a while.
Oh I see, when you get shot there's a momentary red flash on your screen, he wants to make this last longer than a fraction of a second with a certain weapon
[QUOTE=Milkshaker;44693339]Oh I see, when you get shot there's a momentary red flash on your screen, he wants to make this last longer than a fraction of a second with a certain weapon[/QUOTE]
Exactly
bumb
If its possible to make why wouldn't it be possible to modify? What the fuck is up with people thinking if its possible when its already been made in one way.
So does anyone know of a way about doing this?
[QUOTE=Nick_515;44725140]So does anyone know of a way about doing this?[/QUOTE]
Hey guys lets make something very similar to Pepsi.. oh we don't know the recipe so making it very similar it extremely hard.
You have not provided us the code so we don't even know how the "Red HUD effect" works and therefore we can't help you if we don't want to make us own.
I think veins is just drawing a texture over your screen as you're forced to download some textures from it (I never looked at veins as I never bought it :) ).
[QUOTE=SarahKerrigan;44726684]Hey guys lets make something very similar to Pepsi.. oh we don't know the recipe so making it very similar it extremely hard.
You have not provided us the code so we don't even know how the "Red HUD effect" works and therefore we can't help you if we don't want to make us own.
I think veins is just drawing a texture over your screen as you're forced to download some textures from it (I never looked at veins as I never bought it :) ).[/QUOTE]
You realise the HUD effect in question is in the game by default
[QUOTE=Milkshaker;44727237]You realise the HUD effect in question is in the game by default[/QUOTE]
Yeah, I figured it'd be easy, because it's already there, but I wouldn't actually know how to do that or where to begin.
Source C++ coded it in. You could probably MAYBE override functions, but I think it might become too hacky. I find the "red flash" annoying especially in TTT. If I get shot, my screen goes red and I cant really fight back because I get blind
[LUA]
if SERVER then
util.AddNetworkString( "dmg_indicator" )
hook.Add( "PlayerHurt", "send damage etc", function( ply, att )
if not att:IsPlayer() or not IsValid( att ) then return end
net.Start( "dmg_indicator" )
net.WriteVector( att:GetShootPos() )
net.Send( ply )
end )
end
hook.Add( "HUDShouldDraw", "no_its_actually_fairly_simple", function( element )
if element == "CHudDamageIndicator" then return false end
end )
local lastshot = {}
local lifespan = 3
local alpha = 255
local function drawDamageIndicators()
local me = LocalPlayer()
if not me:Alive() then
draw.RoundedBox( 0, 0, 0, ScrW(), ScrH(), Color( 255, 0, 0, 100 ) )
return
end
if not lastshot.draw then return end
if lastshot.time + lifespan > CurTime() then
-- get our current angles and position, compare them against lastshot.pos, rotate accordingly
-- draw trapezoid (surface.DrawTexturedRectRotated would probably be best, but you could use drawpoly)
-- base it on time, fade out. something like
if lastshot.time + lifespan < CurTime() then
alpha = Lerp( .1, alpha, 0 )
end
else lastshot.draw = false; alpha = 255 end
end
end
hook.Add( "HUDPaint", "Draw our lua things", drawDamageIndicators )
net.Receive( "dmg_indicator", function() lastshot = { draw = true, pos = net.ReadVector(), time = CurTime() } end )
[/LUA]
fairly simple really, if someone else wants to finish it (keep in mind this is just a 5 minute example, no idea if it would work)
Whoa. Thanks for the effort. Not sure if it works, but I'll try it tomorrow.
It won't work, I'm just saying it's possible and showing how. You could probably ask/hire someone with more free time
Oh. I see that now. :P I could probably hire someone, though. I mean, if anyone sees this that's interested, they could reply or message me.
Sorry, you need to Log In to post a reply to this thread.