I’m working on a machinima and need a SWEP that when the mouse is clicked shatters all glass in say a 30 foot range. I’ve checked garrysmod.org and fpsbanana but neither had anything close to what I what I was looking for. Even if you aren’t willing to make it some advice on how one could would be greatly appreciated. Alternatively if you are willing to make it I would prefer it look like a remote or detonator of some kind but its not strictly necessary as I think I do have just enough skill to skin it. Thank you for any help.
You could probably use explosives, but if you don’t want an explosion, you’d have to code something that sends the ‘break’ signal to all glass windows in a certain radius. The problem with that is that the windows will just shatter and the glass will fall straight down.
Well that would be fine. I don’t need it to shatter outwards dramatically. I just need something that breaks them even if it just falls downwards.
I don’t think you can get the glass to entirely go away with a single function, but there is a Shatter input that accepts a vector ( in the “x y z” format ) if I recall that will break it.
Shatter <vector> Shatter the window. The input parameter, which must be provided, is a vector. The first two coordinates are the X,Y center of the shattering (as values from from 0-1). The third coordinate is the radius of the shatter, in inches. The format is simply x y z.
If that doesn’t work correctly with the shatter input, you could simply use util.BlastDamage to blow out the glass.
That sounds about right but how would I program that? I’m sorry if I sound stupid but I’ve never done any coding in Lua before.
Could you use a gun with invisible bullets?
Oh thats a good idea. But the bullets couldn’t leave a mark on wood or metal or anything, but I could code that. And it needs to shatter the glass in one shot so it’d have to be pretty powerful, or really big.
“Okay, I need 50 willing me with pistols, and good aim!”
for k, v in pairs( ents.FindInSphere(self.Owner:GetPos(), 30*HOW MUCH IS A FEET IN UNITS) ) do if( v:GetClass() == "func_breakable")then v:Fire("shatter"); end; end;
okay this is what i’ve had suggested to me but where does it go? Under the Primary Attack function or somewhere else?