Quake doesn't support that kind of logic internally (at least, not in terms of what one can normally use in the map, other than predefined setups i.e. "open door if player has key, else don't open door"), but you can use the various entities to make physical logic gates including
if,
then, all sorts of
and,
nand, and so on, and combine them all to do all sorts of tricksy logic stuff that you'd never expect to be possible. Some of them involve other types of map hacks (info_notnulls and InitTriggers and so on), but the most basic form just needs a spike shooter trap, a door, and a button- a simple
if gate. From there everything spirals outwards, and you can even save a couple entities/edicts by using further hacks in the gate itself.
There's some great reading material to be found around, including the QuakeWiki entity pages and the QuakeC source, but here's a couple offhand:
New Logic Gate Design (2013) and
part two of the same article,, along with
Logic Gates for 2017, all hosted at the
Tome of Preach, a most excellent site run by Preach that's absolutely chock-full of crazy map hacks. Those articles primarily focus on gates themselves; there's a number of other pages on the site that go into detail about specific hacks, some of which require gates, others that don't.
Not coincidentally, the last page above also links to a
relatively ancient example of the aforementioned trap-shooter logic gate in Quake 2, penned by metlslime, whose post is a couple paragraphs up, and whose thread we're posting in, not to mention whose
board we're posting on. Maximum respect to the old guard for figuring this stuff out years ago so us noobs don't have to.
The
Teaching Old Progs.dat New Tricks thread is an enormous and fantastic source of information and hacks for the vanilla (id1) codebase, many of which aren't collected anywhere else and some of which are only discussed in the thread in throwing-science-at-the-wall form, but would be refined and used by mappers months or even years later. Ctrl+f is your friend, and sometimes stuff shows up in other threads like this one instead; if that thread doesn't have it, I find just Googling
"topic or hack you're looking for here" site:celephais.net often works very well.
Lastly, dumptruck_ds (whose videos relating to Trenchbroom you've likely seen once or a dozen times) created and runs a
Quake mapping help/discussion Discord channel along with a number of long-time or experienced mappers, if you're into the instant-response* type of help. You can't say how
fucking awesome someone's newest screenshot or mod might be, though, because apparently we aren't all consenting adults there.
*instant response may be less than instant depending on time of day and interest level of whoever's online