Removing the default effect and sound when using a stool.

Okay so as most of you know, when you left click or right click using most stools (if not all) you will have an effect that draws a “laser” like beam to the area you clicked on. It also plays that annoying sound every time you do a stool action.

I recently downloaded NPC Control, and there is a stool that moves the npc to the area you selected on the world. Well moving the npc is fun but seeing that laser beam effect and hearing “BING” over and over gets really annoying. Is there a simple way to override the effects and sounds?

Code for the stool:
(This is just the right click function which moves the npc, I want to remove the default stool effects/sound from it)
[lua]function TOOL:RightClick( trace )
if SERVER then
if (selected_npcs_movement[self:GetOwner()] == nil) then selected_npcs_movement[self:GetOwner()] = {} end
if (trace.HitWorld && !trace.HitSky && SERVER) then
local action = SCHED_FORCED_GO
if (self:GetClientNumber(“dorun”) == 1) then action = SCHED_FORCED_GO_RUN end
for k, v in pairs(selected_npcs_movement[self:GetOwner()]) do
if (v != nil && v:IsValid() && v:IsNPC()) then
v:SetLastPosition( trace.HitPos )
v:SetSchedule( action )
end
end
end
end
return true
end[/lua]

Any help would be great :slight_smile: thanks.

I’m not positive, but I’m pretty sure that the effect/sound you witness when using a tool/stool is not able to be removed.

EDIT : Don’t do any of this! Read further down!

This bit of code won’t help you, as you can see it only deals with NPC movement. All STools are derived from a STool base, this is the one you’d need to change tough doing so would affect every other stool.

You need to edit gamemodes/sandbox/entities/weapons/gmod_tool/shared.lua. If it doesn’t exist you can create it from scratch (Source) or use GCFScape to extract it from the garrysmod GCF.

To disable the sound and effect you need to remove or comment out the whole SWEP:DoShootEffect() function from line 188 to 211.

edit : Alternatively you could possibly edit that function to filter out certain toolmodes.

You don’t have to do that.
If you return false in a stool’s primary or secondary attack function it doesn’t run the SWEP.DoShootEffect function.
So all you have to do is to replace the stool’s RightClick function with this:
[lua]function TOOL:RightClick( trace )
if SERVER then
if (selected_npcs_movement[self:GetOwner()] == nil) then selected_npcs_movement[self:GetOwner()] = {} end
if (trace.HitWorld && !trace.HitSky && SERVER) then
local action = SCHED_FORCED_GO
if (self:GetClientNumber(“dorun”) == 1) then action = SCHED_FORCED_GO_RUN end
for k, v in pairs(selected_npcs_movement[self:GetOwner()]) do
if (v != nil && v:IsValid() && v:IsNPC()) then
v:SetLastPosition( trace.HitPos )
v:SetSchedule( action )
end
end
end
end
self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
return false
end[/lua]

Oh damn, you’re right. Maybe I should try not to over-think things. :slight_smile:

Thanks a lot, much appreciated! I’ll test it out.