Fire Triggered by Button Created 18 years ago2006-12-17 03:09:21 UTC by alpha alpha

Created 18 years ago2006-12-17 03:09:21 UTC by alpha alpha

Posted 18 years ago2006-12-17 03:09:21 UTC Post #206633
Hello, just a quick question here. In my CSS map I have an env_fire. Now I would like to know what to do to allow, say for example the player to "use" (with e, toggleable) a box made of the nodraw texture, which will act like a button. This button should instantly enable and disable the fire, preferably with accompanying sound. How should I do this? Thanks.
Posted 18 years ago2006-12-17 14:15:41 UTC Post #206668
Simple. Give the env_fire a name. Then, go into the button's outputs tab, and tell it to "On Pressed", target "nameofenv_firehere" to "Toggle" after "0.00" seconds.
Posted 18 years ago2006-12-17 14:39:16 UTC Post #206674
Ok I have all that setup, except I cannot do Toggle for "Via this input" My only options are:
Kill
KillHierarchy
AddOutput
FireUser1-4
SetParent
SetParentAttachment
SetParentAttachmentMaintainOffset
ClearParent
Enable
Disable
StartFire
Start the fire.
Extinguish
ExtinguishTemporary
Posted 18 years ago2006-12-17 15:02:55 UTC Post #206677
Fire is a bastard to get started...Try messing with my example:

http://twhl.co.za/mapvault_map.php?id=2620

Firing at the env_microphone triggers the fire to enable.
Habboi HabboiSticky White Love Glue
Posted 18 years ago2006-12-17 15:55:46 UTC Post #206682
You say you want to enable and disable the fire. Enabling and disabling only allows the fire to be started and extinguished.. not the same thing.

Set the env_fire StartDisabled to No if you want to be able to use it from the start. Set the duration to something much longer than you will ever want, like 10000 or so (the Infinite Duration flag doesn't appear to have effect).

Also, set the ignition point to 0. That's used for fuel barrels taking damage and the like before the fire starts.

Now you can trigger the env_fire with the inputs StartFire and Extinguish Fire Temporary. The Extinguish Fire Temporary has to have it's parameter set to some length of time (say 0.1 to extinguish quickly, 1.0 to take one second to die out).

You can't restart the fire if you use the input Extinguish Fire. That's a permanent "extinguish."
Posted 18 years ago2006-12-17 17:46:43 UTC Post #206693
Ok thanks BJ, your method worked perfectly. One more thing, do you know how I would have the fire play a "burning" sound only when the fire is active? Thanks.
Posted 18 years ago2006-12-17 19:13:49 UTC Post #206703
I can answer that ;)

Make the trigger that turns the fire on also target an ambient_generic with the burning sound and there you go.
Habboi HabboiSticky White Love Glue
Posted 18 years ago2006-12-17 20:21:56 UTC Post #206717
Umm, ok, I tried what you said and it didn't work. What would happen was the fire would start and the sound as well, but the sound would only last 1/4 of a second and then repeat itself. I also could no longer disable the fire nor the sound. This is what I did.
I created an ambient_generic and picked a sound and assigned the name "fire sound" to it. The sound name is ambient/fire/fire_small_loop2.wav For flags I have only "Start Silent" checked out of a possible "Play Everywhere" and "Is NOT Looped"
On my "Button" (a nodraw brush with the two outputs assigned already to start and end the fire) I created another output.
My Output Named: OnPressed
Targets entity named: fire sound
Via this input: Togglesound

And like I said above is what happens. What should I change to have the sound loop when the flame is burning and then turn off again when you stop the fire? Thanks.
Posted 18 years ago2006-12-18 12:23:22 UTC Post #206762
I can't tell how you're triggering things. A func_button?

In any case, I'd suggest using the ambient_generic inputs StartSound and StopSound instead of togglesound.

If you're using a func_button, set Don't Move and Toggle. Then use 2 OnIn outputs to start the fire and start the sound (PlaySound). Use 2 OnOut outputs to stop the fire and stop the sound (StopSound).
Posted 18 years ago2006-12-18 22:44:01 UTC Post #206859
Hmm ok I did what you said and now i use the button, but no fire appears, nor any sounds, but I get 1 damage. Also each time I "use" it I get another 1 damage.
Some info:

ambient_generic:
sound name: ambient/fire/fire_small_loop2.wav

inputs:
source: oven button
output:onin
my input: playsound
delay:0
once: no

and

source: oven button
output:onout
my input: stopsound
delay:0
once: no

func_button
name: oven button
delay before reset: 0
sounds: none(silent)

outputs:
my output: onin
target entity: oven fire
target input: start fire
delay: 0
only once: no

my output:onin
target entity: fire sound
target input: playsound
delay: 0
only once: no

my output:onout
target entity: oven fire
target input: extinguishtemporary
parameter: .1
delay: 0
only once: no

my output:onout
target entity: fire sound
target input: stopsound
delay: 0
only once: no
Posted 18 years ago2006-12-19 15:05:30 UTC Post #206936
You had the fire working before so nothing should have changed. Sounds like you don't have the button setup correctly.

Do something simple like turning a light on and off that's very obvious and get the button working correctly. Then add to the button just the fire start and make sure that works. Then add the fire extinguish temporarily, etc.

If you get entirely frustrated, perhaps you should post the map to the problem map vault and let someone take a look at it.
Posted 18 years ago2006-12-19 17:26:53 UTC Post #206957
Ok, I tinkered with it but couldn't get it to work. I know I had it working before, so that's why I don't understand what's wrong now. :/ Anyways here is an example map with a working fire (on the left) and supposed to work with sound (but non-working) on the right.

http://twhl.co.za/mapvault_map.php?id=4326

Please take a look at it an tell me what you think. Thanks.
Posted 18 years ago2006-12-19 19:08:57 UTC Post #206977
I finally figured out what was wrong. The "Damage activates" flag cannot be enabled for the func_button because I think when you first use it it senses that damage and "activates" it again, which would turn it off, so before you can even see it, it is shut off. Also make sure you don't have 0.50 for parameter override for the extiguish temporary- I set it to 0.51 and it worked fine. I dunno why this is but instead of making the fire completely vanish immediately, setting 0.51 makes it go in just about half a second. Thanks everyone for all your help, especially BJ. :)

PS: The problem map is now an example map if anyone would like to check out just what the heck I've been talking about. :P
www.twhl.co.za/mapvault_map.php?id=4326
Posted 18 years ago2006-12-19 19:17:45 UTC Post #206978
Glad you got it working to your satisfaction!
You must be logged in to post a response.