• Creating Brush Entities
    5 replies, posted
[b]SOLVED MY OWN THREAD[/b] How can I turn: [t]http://cloud-4.steampowered.com/ugc/564395174934733441/2CBA811B913EDFC3B1063EB0695ECA3B0416B18E/[/t] Into a brush entity? My code to spawn it thus far is [LUA] local FinishPos = ents.Create("trigger_mapend") if !IsValid(FinishPos) then MsgN("FUCK") end FinishPos:SetPos( Vector(0,0,0) ) FinishPos:SetAngles( Angle(0, 30, 0 ) ) FinishPos:Spawn() [/LUA] And my shared file in deathrun\entities\entities\trigger_mapend\shared.lua is: [LUA] ENT.Type = "brush" AddCSLuaFile("shared.lua") function ENT:StartTouch() MsgN("TOUCH") end function ENT:EndTouch( ) MsgN("NOTOUCH") end [/LUA] I'm mainly looking for more info on how the brush entity really works, but also how to specify its dimensions. Any help is appreciated, I've never worked with creating entities before. [b]SOLUTION[/b] deathrun\entities\entities\trigger_mapend\shared.lua [LUA] AddCSLuaFile("shared.lua") ENT.Base = "base_brush" ENT.Type = "brush" function ENT:StartTouch(asdf) MsgN("TOUCH") end function ENT:EndTouch(asdf) MsgN("NOTOUCH") end function ENT:SetBounds( width, length, height ) self:SetSolid( SOLID_BBOX ) self:SetCollisionBounds( Vector(-width/2, -length/2, -height/2), Vector(width/2, length/2, height/2) ) self:SetTrigger( true ) end [/LUA] Spawning it [LUA] local FinishPos = ents.Create("trigger_mapend") FinishPos:Spawn() FinishPos:SetPos( pos ) FinishPos:SetBounds( width, length, height) FinishPos:SetAngles( angle ) [/LUA] [b]I hope this can help someone out in the future, or me when I forget how I did it the first time[/b]
Nice job, I think I asked killburn about something similar to this and he said it couldn't be done. Are you able to make it physical as well?
I imagine changing it's collision group and making it not a trigger could turn it into an invisible wall. Not sure about drawing it though, I'm under the impression brushes cant be drawn since they're mainly serverside(?) I'll test it when I'm able to and report with results.
I'd love to hear the results and see if it can be physical (not worried about drawing it.) Also, Arro Pablo :) I didn't notice it was you till I saw your deathrun screenshot's with ya name in the other thread. Taking another attempt at deathrun eh?
Yeah, started coding everything from scratch about a week ago. Admin mod + Gamemode is done so far ( The reason this thread was made was to create a finishpoint that didn't use timers/findInBox, making a more optimized system ) Hoping to get Store/Achievements/Jukebox done within the next 2-3 weeks.
If you want a cheap server that's customisable chat to me on steam, I'll do ya a good deal if I can :) (seeming you've already got a community there.)
Sorry, you need to Log In to post a reply to this thread.