Enable and Disable a func_physbox [Solved]

Avatar
Marise
249 Posts
Posted Sep 10, 2011
I have a func_physbox which is enabled by one button and disabled by another (both run through logic relays). It starts out enabled (visible). Each time I press the button to disable (vanish) it, it works fine. But sometimes the button to enable it works, and other times it does not. I am unsure why this is happening.

The output of one relay disables the physbox on a delay of 2 seconds. The other enables it on a similar delay. I don't think the delay is the problem, because I wait until it appears or vanishes before pressing the other button.

I want the player to be able to toggle it at will using the buttons. Any ideas on why I am having a problem?

Advertisement
Registered users don’t see ads! Register now!
Avatar
MasterLagger
1,695 Posts
Posted Sep 10, 2011
Replied 3 hours later
You want player's to enable and disable the physbox? Did you try the "toggle" output? If the button has multiple "OnPressed" Outputs, it might randomly fire an output command. I'm just throwing ideas out since I never used a physbox.

Maybe instead of using logic_relay, have the physbox start enabled, and for the button that enables/disables the physbox, try this output on the button:
OnPressed/<physbox_name>/Toggle
I'm not absolutely sure this will work but try it anyway.

Avatar
Marise
249 Posts
Posted Sep 10, 2011
Replied 35 minutes later
Currently it's two separate buttons. I'll see if there is a toggle option.
Avatar
MasterLagger
1,695 Posts
Posted Sep 10, 2011
Replied 5 hours later
Oh, it's two buttons? Then you don't even need a logic_relay to enable or disable the physbox. Just tie the outputs to the buttons.
Avatar
Marise
249 Posts
Posted Sep 10, 2011
Replied 29 minutes later
I used the logic_relays in case I decided I want to disable the buttons temporarily (because of the delay).

Don't expect that the logic_relay is causing the problem, though. It's so weird... sometimes it works, sometimes it doesn't.

Avatar
Random
171 Posts
Posted Sep 10, 2011
Replied 9 minutes later
You can disable the buttons with a "lock" input, so only one can be active at a time. I don't know that that would cause your problem, but I would prefer that over creating excess relays.
When it doesn't work, do you have to reload the map to get it to work, or does the button randomly work when you press it again?
I personally haven't tried flat-out disabling a physbox, it might have some problems due to it's properties... I guess there are reasons that it is necessary to use one instead of just a brush?
Avatar
ChickenMobile
2,460 Posts
Posted Sep 11, 2011
Replied 3 hours later
The better would be to make the enabling and disabling done with one button, removing the chance for this error, unless of course having the two buttons are actually part of a puzzle element.

You can do this by either using a math_counter and a logic_case or a logic_branch which 'Toggletests' with outputs firing 'OnTrue' and 'OnFalse'.

If you want a delay between enabling and disabling the physbox, just increase the delay keyvalue inside your prop_button.

Avatar
Marise
249 Posts
Posted Sep 11, 2011
Replied 7 hours later
The two buttons are part of the puzzle.

When it doesn't work, I have to reload the map. Sometimes this fixes it and other times not. I haven't been able to identify any circumstance that could be related to the problem; it seems to be random each time I load the map.

Is it possible to make it a brush and enable/disable it in the same way? I need to to totally disappear when disabled.

Avatar
MasterLagger
1,695 Posts
Posted Sep 11, 2011
Replied 18 minutes later

Marise wrote:
The two buttons are part of the puzzle.

When it doesn't work, I have to reload the map. Sometimes this fixes it and other times not. I haven't been able to identify any circumstance that could be related to the problem; it seems to be random each time I load the map.

Is it possible to make it a brush and enable/disable it in the same way? I need to to totally disappear when disabled.

Yes it is, I did that with my boss's shield (Portal Bomber). Try that and see if it works.

Advertisement
Registered users don’t see ads! Register now!
Avatar
Marise
249 Posts
Posted Sep 11, 2011
Replied 12 hours later
So far so good with the func_brush instead of a func_physbox. I'll have to do more testing tomorrow, but I think it's working fine.

Thanks, all.