So for my server, I have a thing where you take drugs, doubles your Hp, and plays some music, but I also want the motion blur effect, and the blur effect to happen, right now, this is what I have, and it doesn't work. Am I missing something? When I try the bloom and blur in a separate function, it happens globally. Any help?
[lua]
function SWEP:PrimaryAttack()
self.Owner:SetHealth(200);
self:EmitSound (ShootSound);
self:TakePrimaryAmmo(1);
DrawBloom( 0, 0.75, 3, 3, 2, 3, 255, 255, 255 );
DrawMotionBlur( 0.1, 0.79, 0.05 );
end
[/lua]
[code]
local function DrawBlur()
DrawBloom( 0, 0.75, 3, 3, 2, 3, 255, 255, 255 );
DrawMotionBlur( 0.1, 0.79, 0.05 );
end
function SWEP:PrimaryAttack()
self.Owner:SetHealth(200);
self:EmitSound (ShootSound);
self:TakePrimaryAmmo(1);
hook.Add( "RenderScreenspaceEffects", "MMotionBlur", DrawBlur )
end
[/code]
Wrote it in chat here, let me know if calling that hook in the PrimaryAttack doesn't work.
Also thank you, you just answered my question :)
Hey thanks! Also, would you know how to disable the blur and stuff after 30 seconds? And what question did I answer? :dance:
[QUOTE=Cowan108;42329846]Hey thanks! Also, would you know how to disable the blur and stuff after 30 seconds? And what question did I answer? :dance:[/QUOTE]
Make a timer in PrimaryAttack that removes the hook after 30 seconds?
hook.Remove( "RenderScreenspaceEffects", "MMotionBlur" ) to remove the hook.
Did I do something wrong here? This errors out when I run it.
[lua]
local function DrawBlur()
DrawMotionBlur( 0.1, 0.79, 0.05);
end
local function EndBlur()
hook.Remove( "RenderScreenspaceEffects", "MMotionBlur" )
end
function SWEP:PrimaryAttack()
self.Owner:SetHealth(200);
self:EmitSound (ShootSound);
self:TakePrimaryAmmo(1);
hook.Add( "RenderScreenspaceEffects", "MMotionBlur", DrawBlur )
timer.Simple( 30, Endblur )
end
[/lua]
[QUOTE=Cowan108;42329846]Hey thanks! Also, would you know how to disable the blur and stuff after 30 seconds? And what question did I answer? :dance:[/QUOTE]
I was just about to make a thread asking how to do screen effects because I had never done anything with them. And you answered my second question how to remove them!
Thanks bud :p
You wouldn't happen to know about timers would you? :tinfoil: [QUOTE=Swiftone;42330102]I was just about to make a thread asking how to do screen effects because I had never done anything with them. And you answered my second question how to remove them!
Thanks bud :p[/QUOTE]
not tested done in browser:
[code]
local function DrawBlur()
DrawBloom( 0, 0.75, 3, 3, 2, 3, 255, 255, 255 );
DrawMotionBlur( 0.1, 0.79, 0.05 );
end
function SWEP:PrimaryAttack()
self.Owner:SetHealth(200);
self:EmitSound (ShootSound);
self:TakePrimaryAmmo(1);
hook.Add( "RenderScreenspaceEffects", "MMotionBlur", DrawBlur )
timer.Simple( 20, function()
hook.Remove( "RenderScreenspaceEffects", "MMotionBlur" )
end)
end
[/code]
Thanks man, worked perfect. [QUOTE=Swiftone;42330174]not tested done in browser:
[code]
local function DrawBlur()
DrawBloom( 0, 0.75, 3, 3, 2, 3, 255, 255, 255 );
DrawMotionBlur( 0.1, 0.79, 0.05 );
end
function SWEP:PrimaryAttack()
self.Owner:SetHealth(200);
self:EmitSound (ShootSound);
self:TakePrimaryAmmo(1);
hook.Add( "RenderScreenspaceEffects", "MMotionBlur", DrawBlur )
timer.Simple( 20, function()
hook.Remove( "RenderScreenspaceEffects", "MMotionBlur" )
end)
end
[/code][/QUOTE]
Sorry, you need to Log In to post a reply to this thread.