How to add a condition


I’m thinking about creating a gamemode with a custom map, but i have a question. If i have 2 brush(n°1,n°2) on my map, and i want when these 2 brush are destroyed to create a brush n°3. Is there a way to do it with a function in hammer, or is there an another way to do it?

You couldn’t ‘create’ the third brush per se, but you could have it already made in the map, make it a func_brush, and set it to start disabled. When Brush 1 and Brush 2 are destroyed, set the outputs to enable Brush 3.

Thank you for answering,but this third brush need to be unfrezze

What specifically does it need to be used for?

if you mean “be a physics object” by unfreeze, then the third brush has to be a func_physbox

Ok this problem is solved, thank you ! But hum and last question i hope.

If a brush “a” is destroyed then i want it to print something in the console, how can i make a link between the map brush and a lua files?

You could always create entities and put them in an .FGD. Other than that, I personally don’t know.

lua_run from Garry’s Mod’s .fgd works. This code should do it, but avoid using double quotation marks ("") in Hammer, or else your .vmf will get corrupted.

for k, v in pairs(player.GetAll()) do v:SendLua([[print('stuff')]]) end

Replace the print(‘stuff’) with any clientside code you want. Try to keep it under 254 characters, as SendLua() is limited to 254 bytes. For longer commands, you may need to split the string into several ones and assemble them together at the client.