I'm working on a weapon that shatters all glass within a 30 foot radius, the problem is I can't think of a way to have it do that without using something like a controlled explosion. Someone suggested that I should use the shatter command [QUOTE]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.[/QUOTE] but I have no idea how to implement this. any help would be appreciated on where and how to do this.
Locate all window entities in the radius using ents.FindInSphere and use Entity.Fire to fire the shatter input.
Sounds about right but how do I implement that? Sorry I'm really bad with programming.
-snip-
And does that go under the primary attack function or some other function? And what do I replace with units? 30*HOW MUCH IS A FEET IN UNITS, or just the HOW MUCH IS A FEET IN UNITS leaving the 30*?
[QUOTE=thejjokerr;23597490][lua]for k, v in pairs( ents.FindInSphere(self.Owner:GetPos(), 30*HOW MUCH IS A FEET IN UNITS) ) do
if( v:GetClass() == "CLASSOFGLASSENTITY")then
v:Fire("shatter");
end;
end;[/lua]
Thats exactly what Quebec said, I'm just not sure if it's the right fire.
EDIT:
Replace CLASSOFGLASSENTITY with:
func_breakable or func_breakable_surf, I'm not sure which one it is.[/QUOTE]
func_Breakable_surf is the one that will shatter in shards and the func_breakable is the one that just breaks.
But does it go under the function SWEP:PrimaryAttack() or what?
30 Feet = 540 Units
Sorry, you need to Log In to post a reply to this thread.