• Lua brush entity not working
    6 replies, posted
I made a brush entity called uu_forcefield, I also made a simple map with a textured brush which I tie to an entity with the class uu_forcefield as well. Problem is when it's the uu_forcefield and I play the map, there is no actual brush there, but without tying it to an entity it is fine. How do I make it so lua brush entities are properly compiled as actual brushes? (no typos, for real this time)
The brush entities in GMod Lua are actually trigger entities, they cannot be displayed. I don't know why Garry called them brush entities, it just spews confusion like this, sadly it's too late to change that. As for your actual issue, the easiest way to get around the issue is to make an "anim" type entity. It can still use brush models, even though it's not what it's for.
[QUOTE=Robotboy655;50350120]The brush entities in GMod Lua are actually trigger entities, they cannot be displayed. I don't know why Garry called them brush entities, it just spews confusion like this, sadly it's too late to change that.[/QUOTE] I'm fairly certain that you can still use brush entities for non-trigger uses. Several years ago, I was trying to create a brush entity that behaved like a func_door. There were no examples of working non-trigger brush entities that I could find, so I created something that (almost) worked through trial and error. Here's the important bits from that effort: [code] ENT.Type = "brush" ENT.Base = "base_brush" function ENT:Initialize() self:SetNotSolid(false) self:SetSolid(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_NOCLIP) self:SetUseType(SIMPLE_USE) self:SetNoDraw(false) end [/code] I haven't tested that code since 2012, so there's a chance it might not work anymore.
The texture is still not showing up using Jcw87's code. Any idea why?
Afaik brush entities in gmod aren't networked to the clients, this is mainly because like robotboy said, they're used as trigger entities and so they don't need to be draw.
I got it to draw, now I can't make collision work. Even with EnableCustomCollisions...
[QUOTE=RonanZer0;50404785]I got it to draw, now I can't make collision work. Even with EnableCustomCollisions...[/QUOTE] In my code, I used MOVETYPE_NOCLIP, which allowed me to test the movement of the door. It moved properly, but it would happily move into spaces occupied by players (just like a noclipped player can). What I wanted to use was MOVETYPE_PUSH, but it turned out to be a royal bitch to get working. That's where the 'almost worked' part comes in. Since then, I have found a way to get MOVETYPE_PUSH working, but it's really convoluted. You may just want to go with Robotboy's suggestion though, as 'anim' based entities have more features (like [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/ENTITY/OnTakeDamage]ENT:OnTakeDamage[/url]), and apparently support brush models.
Sorry, you need to Log In to post a reply to this thread.