Triggered func_breakable creation

Alizée Fan

L1: Registered
Dec 1, 2008
13
0
My apologies if this has been addressed, I couldn't locate a discussion on it with any of the search terms I could think of. I am trying to find a way to have triggerable creation, or recreation, of a func_breakable entity.

Specifically, I have some glass targets that can be shot out as part of a target shooting gallery. Each one, when broken, activates one or more additional effects. They're working beautifully, but I would like to be able to install a button that, when pressed, will recreate the broken targets, complete with their outputs. Right now, the only way I can figure to get the targets back is to reload the map, which obviously isn't something I want.

I've tried using the AddHealth input to bring the target "back to life" so to speak, but that does nothing. I didn't see anything remotely resembling a "create new brush" output either. I'm think there's a way to do it, as I'm pretty sure triggered spawns of things are possible, but alas my meager skills aren't enough to figure it out at this point.

Any assistance would be greatly appreciated!

My thanks.
<eVa> Alizée Fan
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
Use a point_template for each one. Specify the func_breakable in the first key and turn both flags on (don't remove and don't fix names). Then send the point_template a ForceSpawn input to respawn the glass.

If you want one button to respawn all the broken glass, but obviously not duplicate ones that aren't broken, you'll need a logic_relay for each one as well.
func_breakable > OnBreak > logic_relay > Enable
logic_relay > OnTrigger > point_template > ForceSpawn
func_button > OnDamaged > logic_relay > Trigger
func_button > OnDamaged > logic_relay > Disable (with a 0.1 delay)

You can cut down on the number of outputs in the button by using wildcards. If all your relays are named like glassrelay1, glassrelay2, etc, then each breakable can specifically enable it's own relay, and the button can trigger/disable all of them at once using glassrelay* as the target.
 

Tehrasha

L3: Member
Nov 5, 2009
115
28
If you want one button to respawn all the broken glass, but obviously not duplicate ones that aren't broken, you'll need a logic_relay for each one as well.

func_breakable > OnBreak > logic_relay > Enable
logic_relay > OnTrigger > point_template > ForceSpawn
func_button > OnDamaged > logic_relay > Trigger
func_button > OnDamaged > logic_relay > Disable (with a 0.1 delay)


Would anyone even notice that unbroken glass was replaced with new?

OnPressed> Glass_Entities> kill
OnPressed> point_template > ForceSpawn
 

l3eeron

L8: Fancy Shmancy Member
Jan 4, 2008
593
88

Alizée Fan

L1: Registered
Dec 1, 2008
13
0
Ok, new question! With the above method working wonderfully (thank you again, Snark!), I've run in to a bizare problem in terms of getting the buttons to function. If I simply load the map, either from "run map" in Hammer or simply creating a server, they will not respond to my use key in any way (they are flagged for it, and all that). Seeing that, I loaded up another map I made a while back, which has buttons I know work, and they refused to work with "use" either. Finally, I loaded a map somebody else made which has a button you have to "use," and after that, my use key works on everything on my own maps again.

I have to repeat this process, creating a server with the other person's map prior to creating one with my own, every time I close and open TF2. Is there something I'm missing in a setting somewhere that causes this? I don't recall it ever being an issue with the other buttoned map I made.

-----

@ Tehrasha: I'm not sure, to be honest. Either way though, it was the use of the point_template to get ForceSpawn that I was missing, so it works either way :) The logic relays and point templates are doing the trick beautifully now!

@ |3eeron: What's up, B! Good to see you. As you said, I've got this one licked, but I'm sure I'll be back for more! Way to many automatic functions here for me not to mess up something :p I've got some screenies of the map I'm working on on our forum :-D

<eVa> Alizée Fan
 
Last edited:

l3eeron

L8: Fancy Shmancy Member
Jan 4, 2008
593
88
Hmmmm


Double check every setting on button in the map that works right matches the new map's button. When you're done, triple check it. Make sure all the flags are ticked the same as well..... etc etc, normal troubleshooting stuff.

If I remember right, there isn't a "USE" key in T2. The normal "E" is bound to "Medic!". So, first make sure your key is bound to "+use". On my little melee with the cart that goes back n forth with button, i set the flag to "touch activates" instead of use. Think of it as a button for dummies! :)


Still doesn't explain why it would work in some maps, and not in others. Are you picking the same class? Maybe you have a class .cfg that has a key bound to +use while other classes don't?
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
It's because awhile ago valve locked down the +use command because of "exploits" with physics props and provided a server option (tf_allow_player_use) for servers to reallow it if they wish. That's why I said to use OnDamaged and just have the buttons shootable, you don't need to worry about the server setting and people don't need to bother binding the command.
 

Alizée Fan

L1: Registered
Dec 1, 2008
13
0
Ah ha, I was wondering why you prefered the shootable buttons :p Hmm, interesting. There must be something in the map file that can default the server setting to tf_allow_player_use 1 or something, because it's only after I load up that particular other map that it suddenly is available for me on all my maps. I'll have to inquire with the mapmaker for that other one.

Thank you again for the info :)
 

l3eeron

L8: Fancy Shmancy Member
Jan 4, 2008
593
88
easy:

You load the map (I'm assuming it's masa's purple paradise?) wich has a point_servercommand > tf_allow_player_use > 1 in it. When you change maps to your map (with out killing the server), the setting is still set to allow. If you were to kill the server completely and reload the map, it wouldn't work. In other words: The server's "temp" .cfg file is still in use that has the allow setting still active.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
Except those kinds of things are annoying, because as you've found, they persist and don't reset when the map changes. You should really avoid using point_servercommand to alter server settings whenever you can.
 

Alizée Fan

L1: Registered
Dec 1, 2008
13
0
Thanks, both, for the explanations and advisements. I'm learning lots in this thread :-D