Is there a way to make a toggleable looping circuit? Created 6 days ago2024-07-10 00:25:59 UTC by BugDug BugDug

Created 6 days ago2024-07-10 00:25:59 UTC by BugDug BugDug

Posted 6 days ago2024-07-10 00:25:59 UTC Post #348971
I am trying to make a shower that when you press a button it targets an env_blood entity that is supposed to be repeated indefinitely until the button is pressed again which stops it. I have seen that you can do it with a multi_manager that targets itself but I can't seem to be able to turn it off, so does anybody know if there's a way to make it toggleable, or better yet, if there's a better alternative to making a shower.
Posted 6 days ago2024-07-10 02:29:32 UTC Post #348972
i think you can do that with featureful SDK
awkook awkookaka vhetutor
Posted 5 days ago2024-07-10 07:54:47 UTC Post #348973
In your typical multi_manager loop, you set the Multi-threaded flag and have it target whatever is supposed to repeatedly trigger, and after some delay it'll trigger itself.
User posted image
Triggering the multi_manager again will only create more loops, so instead of a button to start the loop we can use a trigger_auto to start it from the beginning of the map, and instead of triggering the target directly we can use a trigger_relay, but we'll leave the relay's target empty to begin with.

To connect the target to the loop, we let the button target a trigger_changetarget (we can name it turn_on) to change the relay's target to our env_blood. We can use another trigger_changetarget (sharing the same name as the first) that will change the button's target to turn_off.
Now we create another pair of trigger_changetarget, both named turn_off. One will change the relay's target back to empty, and the other will change the button's target to turn_on.
User posted image
It might be a bit complicated, but here's an example map for such a toggled loop:
Loading embedded content: Vault Item #6924
Posted 5 days ago2024-07-10 19:46:36 UTC Post #348977
It worked! Thanks so much for the help, I was really confused for a moment but the drawing and the example map really helped a lot. You're a legend! :biggrin:
Posted 5 days ago2024-07-10 20:10:52 UTC Post #348978
An easier way to achieve this is to use an env_beam to periodically strike a func_button. The button can then trigger the env_blood to emit particles. The beam can be toggled (or explicitly enabled or disabled by sending it an 'on' or 'off' signal with a trigger_relay) to toggle the particle effect.

The button's health and the beam's damage must be set to something higher than 0 (1 health and 0.1 damage will do just fine). This ensures that the button gets activated when it's hit by the beam. You'll also need to make sure that the beam goes through the button. The easiest way to do that is probably to let the beam use itself as starting entity and to place an info_target behind the button as ending entity. The beam's Life + Strike again time determine how often the button will be hit (if Life is 2 and Strike again time is 0, the button will be hit once every 2 seconds). Set the button's 'Wait before reset' to something low (0.1 or so) so that it can be hit again before the beam strikes again.

I'm using this setup in my mtl_trigger_periodic template entity.
You must be logged in to post a response.