How do you detect if all turrets have been killed/disabled
- OnExplode
- OnRetire
- OnTipped
There is no OnKilled and therefore it does not detect when, for example, a turret is dropped into a pool of deadly goo. Can anybody suggest a way to create a trigger when the last turret of a group of turrets is killed/disabled (regardless of the way they have been killed/disabled). No doubt I'm missing a more obvious way of doing it (I hope!).
Thanks
OnExplode and OnTipped will detect when they die that way. For goo, there's a trigger_multiple in there already to kill objects - you can just piggyback off of that. I suggest using the user in/outputs to make sure a turret can't be counted as dead twice (if you knock it over, then drop into goo that would count.)
On every turret, add an OnUser4 output to Add 1 to your math_counter. Set it to trigger once only. The OnExplode and OnTipped outputs should FireUser4 on "!self" (special targetname). The goo trigger should also FireUser4 on "!activator". Delay the other outputs on the trigger (by 0.1s or so) to ensure the turrets aren't deleted before they finish their outputting.
TeamSpen210 wrote:
(This isn't the most obvious way, but it'll be more robust.)OnExplode and OnTipped will detect when they die that way. For goo, there's a trigger_multiple in there already to kill objects - you can just piggyback off of that. I suggest using the user in/outputs to make sure a turret can't be counted as dead twice (if you knock it over, then drop into goo that would count.)
On every turret, add an OnUser4 output to Add 1 to your math_counter. Set it to trigger once only. The OnExplode and OnTipped outputs should FireUser4 on "!self" (special targetname). The goo trigger should also FireUser4 on "!activator". Delay the other outputs on the trigger (by 0.1s or so) to ensure the turrets aren't deleted before they finish their outputting.
Thanks for the reply but... wooh
... this is a bit (aka, a lot) beyond my level of knowledge (I should have mentioned that I'm not quite a newbie - but I'm not far off!). I haven't explored the user in/outs and I don't understand the piggy-backing thingy. I also don't follow the "trigger_multiple in there already to kill objects" and "special targetname" bits (basically, you lost me after the first sentance!
).
I think I'm going to need a step by step guide but I'm prepared to do some homework and preparation first. To start with, and cover some of the basics, can you point me at any tutorials that will explain the use of user in/outs and then I'll try and progress to the next stage.
Step 1: Count the amount of turrets in your chamber. There is no way to detect whether or not there are any surviving turrets, you will have to have the enities count the turrets that are killed and see if it matches up with your specified total.
Step 2: Create a Math_Counter entity. In the Class Info tab, Give it a name, and change the "Maximum Legal Value" to your total number of turrets.
Step 3: Next to each turret, create a logic_relay. The logic relay will be useful for making sure that one turret's death will not count for multiple deaths. In the output's tab on each of these logic_relays, give it the output: "OnTrigger >> <name of math_counter> >> Add >> 1". Be sure to check the box that says "Fire Once Only". Also, be sure to give each of these logic_relays a different name.
Step 4: On each turret, create an output for each way the turret can die that "Trigger"s the nearby logic_relay you made in step 3.
Step 5: On the Math_counter you made in Step 2, Give it the output: OnHitMax >> <Whatever you want killing all the turrets to do>. Once the math counter hits the number you assigned to the Maximum Legal Value property, it will trigger any outputs started by OnHitMax.
I hope this helps.
Goldenknighttim wrote:
Step 4: On each turret, create an output for each way the turret can die that "Trigger"s the nearby logic_relay you made in step 3.
There does not appear to be an output for OnKilled (there's only outputs for OnExplode, OnRetire and OnTipped).
TeamSpen210 wrote:
...you can just piggyback off of that. I suggest using the user in/outputs to make sure a turret can't be counted as dead twice (if you knock it over, then drop into goo that would count.)
But the bit I don't understand is the function of the user in/outs and how you set them up to be able to detect when a previously tilted turret is dropped onto the trigger. I've looked at the page in the Valve Developer Community:
https://developer.valvesoftware.com/wiki/User_Inputs_and_Outputs
but I'm having a bit of difficulty following it (only half life examples). Any pointers to other articles or tutorials would be useful
The reason I'm suggesting using FireUser4 not 1 is that cube droppers use the first input to only fizzle the cube fhat's not sitting inside the dropper whenever the dropper dispenses a new cube. When a cube falls outside the dropper logic adds an output with the AddOutput command (another very powerful command) to make FireUser1 dissolve the cube. The one inside the dropper has't had this happen yet, so it won't dissolve.