Hey. I’m trying to get a func_button which makes an object spawn, kills it, then respawns it, and so on. So far, I can only get it to spawn. I am not sure how to toggle the command. Any suggestions?
What do you mean? Do you want the object to instantly be killed or what?
Explain better, please
can’t help if I don’t know what you’re trying to accomplish
You could always try the Mapping Question Megathread. That’s where the smart people live.
You probably shouldn’t go there then.
ok…based off the info-
Func button is linked to two logic_relays (via i/o’s on trigger). One is set up to start disabled, lets call it logic relay 1, and one enabled (logic_relay 2).
Logic_relay 1 contains three inputs, all ontrigger. one disables the logic raly 1, one enabled logic relay 2, and one kills a certain prop.
Logic_relay 2 contains three inputs, on disables lr2, one enables lr1, one sends a spawn command to a point_template.
Yeah. There is a button that makes a model appear on my map. When you hit the button once, the model appears. When you hit it a second time, it’ll go away. When you hit it a third time, it’ll reappear. When you hit it a fourth time, it’ll go away (and so on). That is my dilemma.
Is it a brush or entity?
If you want it to kill the old as it respawns the new I think you just have two functions, spawn and kill, but delay spawn like 1 second so it doesn’t kill the new one.
Or make it so that when the model is destroyed, the model tells the spawner to spawn another, so all the button does is kill the existing model.
IronPhoenix described how to do this in the post above your post.
There’s an easier way using a logic_branch
Make a logic_branch with OnTrue set to disable the prop, and OnFalse set to enable it.
And then you just have the button output “ToggleTest” to the logic_branch.
The way this works is a logic_branch can have two states, False and True. In this case, When it’s state is “True” and it’s tested (triggered) by the “ToggleTest” input, it toggles, and fires whatever output we have assigned to false (in this case to enable the prop).
Thanks a ton man, it finally works.
Did I miss something here? Wouldn’t it be easiest with a simple toggle button using the OnIn and OnOut outputs?