• Entering Area Script Help [If in area then output]
    1 replies, posted
Hey everyone first of all I would like to start out saying I have [B]Minimal[/B] Glua Experience. I am looking for help on script I would like to make. The script activates a output upon entering a area of the map. This output would be a action such as "Kill Weapons <boolean>". Something I found that would aid me in my script is Vector:WithinAABox and Vectors Is this the best way to make the script at hand? Any suggestions,Ideas or criticism is helpful but remember don't fight! Thanks for reading ~Memeface (On a side note this is one of my first times posting on face punch so if I did anything not in the normal way please tell me!)
The easy and obvious way to do this is to check every tick if each player is within the boundaries you want. This is also pretty slow. A slightly more clever way to do it is to create a trigger brush entity, and hook the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/ENTITY/StartTouch]ENT:StartTouch[/url]call [CODE] ENT.Base = "base_brush" ENT.Type = "brush" -- Updates the bounds of this collision box function ENT:SetBounds(min, max) self:SetSolid(SOLID_BBOX) self:SetCollisionBounds(min, max) self:SetTrigger(true) end -- Run when any entity starts touching our trigger function ENT:StartTouch(ent) if ent:IsPlayer() then ent:Give("weapon_crowbar") end end [/CODE]
Sorry, you need to Log In to post a reply to this thread.