Outputs on a Togglable Light Switch

Ok, now for a more detailed description… I’m making an RP map, a very very detailed one… I’m starting it off with a Hospital and a Power Plant I’ve already completed… Now what I mean by detailed is that EVERY light in the map will have a light switch… This means that they will be able to turn off whenever someone wants em off, simple, but the question is, HOW can I make it so that when I press a button, Everything I’ve associated with the Power Plant Main Grid shuts off, leaving no power at all through the whole map… So every light’s off, and the Light Switches cannot be used to turn the lights back on…

So far, I’ve managed to get the whole light ordeal done, so is there a way to make the light switches unusable if you press a button, and usable if you press it again? If you’d like pictures, I can post em…

If you’re using a suitable naming scheme for all of your lights and buttons, example: house_light1, house_button1 etc, you can use wildcard outputs on your power plant button to turn all of them off and lock the buttons. Example: OnPressed -> _button -> Lock, OnPressed -> _light -> TurnOff (or whatever the output is to turn them off.)

Yea, well, when I shut off the power, Lights are on a toggle, so that they turn off when pressed once, on again, but i’ll do the turn off now that I see some problems with it… The light switchs are locked, but when I press it again, they continue locked and the lights are on…

Ah, you know what, nevermind, I’m going to make 2 indivitual switches that turn power off and power on… And add delay times so that they aern’t abused on the server…

You could use a Logic_Branch entity. Set true to lock the buttons, set false to unlock the buttons or whatever, and have the button in the power station use the toggle function for the logic_branch to toggle between the two.

I’d recommend this method for the lights too as using toggle straight off the button means that any lights that are off when pressed will turn on. Use TurnOn and TurnOff instead of the Toggle on the lights.

Yea, I just solved the problem with the two power buttons, with this, everything will be in sync now, NOW i’ve got to put outputs on the Back Up Power Generator for the Hospital… Holy shit I hate doing outputs…

Also, you realise the lightmaps alone will be hundreds of megabytes if you do this, nevermind ordinary map stuff.

Assuming the lights all share the same name, and only turn on or off, it won’t be too bad.

When i did my power setup for rp_sanctuary (pm me and i’ll upload the vmf if you like) was to have one button linked to 2 logic relays. The button essentially switched between the logic relays, and the logic relays dealt with the outputs. I used a variation of this tutorial on cameras:
http://www.halfwit-2.com/?page=tutorials&id=47

This is how i would have done it:

Every light on the powerplant main grid is called “powerplantmaingrid_light_001”. Replace the name of the second light with 002, third light 003 etc etc. And you just add switches on them as much as you like. You name the switches in the same way: “powerplantmaingrid_switch_001” and go on with 002, 003, 004… etc

Now, when the powerplant shuts down, you add an output on the entity which causes the lights to turn off (like a button or timer).

In this output, we will use a wildcard: . So outputs for powerplantmaingrid_light will match any targetnames that start with powerplantmaingrid_light.

It goes as follow:

You press the button which shuts off the powerplant’s grid.

The following 2 outputs output will be activated:

  • The output to turn off the lights:

OnPressed (if it is a button)
powerplantmaingrid_light*
Turnoff

This will turn off all of the lights with “powerplantmaingrid_light” in it.

  • The output to disable the switches:

OnPressed
powerplantmaingrid_switch*
Lock

This causes to lock, or disable if you will all the buttons of the maingrid.

I hope this will help!

EDIT:

I just noticed someone already said this. Ill rate my self bad reading for this.