[SOLVED] How do I Trigger a TouchTest from an Instance?

Avatar
taco
504 Posts
Posted May 09, 2012
I have an instance of non-standard automated stairs to be used in a chamber I am creating. They are triggered by an external trigger_multiple; however, part way though the activation, I need to run a TouchTest to see if the player is in one of two areas.

At the same time that I need to run the TouchTest, a logic_relay is being triggered inside the instance - I'm just having trouble figuring out how to let the map know that it's time to run the TouchTest.

Should I be using AddOutput to add the triggering of TouchTest to the logic_relay in the instance? Or passing a value from the instance to the map another way?

NOTE: The rig in the instance works perfectly - I have tested it as an instance and a non-instance. I just don't know how to pass the information that the logic_relay has fired. Also, using it as a non-instance isn't a practical option since I need 5 copies of it in the map and it is made up of a number of uniquely named objects, 4 logic_relays, a logic_auto and 30 total outputs.

Advertisement
Registered users don’t see ads! Register now!
Avatar
josepezdj
2,386 Posts
Posted May 09, 2012
Replied 1 hour later
Why don't you just add the output "touchtest" with the delay you want into THAT relay inside the instance so it checks out if the triggered is being touched? This way, you take advantage that this relay is launched and firing outputs...
Avatar
taco
504 Posts
Posted May 09, 2012
Replied 39 minutes later

josepezdj wrote:
Why don't you just add the output "touchtest" with the delay you want into THAT relay inside the instance so it checks out if the triggered is being touched? This way, you take advantage that this relay is launched and firing outputs...

That sounds good but I'm at a loss for how to actually do that.

I constantly get the error: AddOutput input fired with bad string. Format: ,,,,

I have tried that format as well as the format listed on the wiki: ::::

Below is my full case:

In the instance I have a logic_relay (relay_stairs_up02) that I want to add the output to.
I also have a func_instance_io_proxy for: OnProxyRelay relay_stairs_up02 AddOutput

In my map I have a logic_auto:
My output named: OnMapSpawn
Targets entities named: stairs_01 (this is the Fix Up Name of the instance)
Via this input: instance:relay_stairs_up02;AddOutput
With a parameter override of: OnTrigger trigger_stairs_02:TouchTest::0,-1

I have no idea how to get the right format for the parameter so I don't know know if that is my only issue or not.

Avatar
josepezdj
2,386 Posts
Posted May 09, 2012
Replied 1 hour later
First of all, I really think you shouldn't put "instance:" in "via this input". Change the name of your relay inside the instance adding a "@" prefix. That should allow you to refer to that entity when it's inside an instance, ok?

Now try:
Via this input: @relay_stairs_up02;AddOutput

To be frank, dude, I tried the addoutput output with some triggers in one of my maps without success in many ways... For me that output is also a pain in the ass! ... I found a workaround for my case...

Anyway, I was referring to add an output to the relay, not with the addoutput output, but a normal one:

OnTrigger > [trigger_stairs_02] > TouchTest / delay: 2.00

I would like to know more in detail what you want to get, because I think I don't really get it, mate.

Avatar
taco
504 Posts
Posted May 09, 2012
Replied 50 minutes later
Adding the @ to the names to refer to them accomplishes the same thing from what I can tell, no? It is shorter though so I'll probably start using that. Thanks for that tip.

For the life of me I cannot find a syntax that works with the AddOutput output and I have tried close to 10 different styles. Adding the Output directly won't work since I need different names for different instances. I'll try to explain in more detail what I am trying to accomplish:

What I currently have (and it works):
I have an "automated" section of stairs consisting of two steps (4 arm64x64_interior.mdl's in a 2x2 configuaration).

The stairs have 2 animations:
Stairs (rampa_stair01_up or rampa_stair02_up depending on the step)
Raised-flat(64_out_straight)

These two animations share only 1 position: their down (or starting) position. So to get the animations to work together, I set SetPlaybackRate to -1 then, when the reverse-animation is complete, I trigger the other animation.

In my map there are 2 trigger_multiple for the stairs: one at the top and one at the bottom. If the player is at the bottom, the stairs animate into (or remain) as stairs. When the player is at the top, the stairs animate into (or remain) as a raised flat-platform.

Video with visible trigger_multiple showing issue
ZBfSS_r7BJs
The problem is this:
If the player triggers the top trigger_multiple and the platforms start to rise and then they jump into the bottom trigger_multiple before the platform reaches it's down neutral position, the bottom trigger multiple will not fire unless the player leaves the trigger_multiple and re-enters it OR I run a TouchTest.

At the neutral-down position, a logic_relay fires inside the instance to start the proper animation - this is when I want to trigger a TouchTest.

NOTE: The reason the trigger_multiple doesn't fire when I jump into it early is because the relay for it inside the instance is disabled until the platforms are all the way down. Because the stairs are using 2 animations, this was the best way I could find to avoid animation glitching (I tried many methods).

Avatar
taco
504 Posts
Posted May 10, 2012
Replied 1 day later
This issue now partially solved, with one current problem:

Solved:

The properly formatted parameter override for AddOutput will look like:
'OnTrigger trigger_stairs_02:TouchTest::0:-1'

In this case:
OnTrigger is the Output name.
trigger_stairs_02 is the target entity (a trigger multiple).
TouchTest is the target input.
Parameter is left blank.
0 delay.
Only once is set to No (-1).

Problem:

Right now I am adding the new output to the target entity: @relay_stairs_touchtest

This works perfectly; however it is not instance-specific and I need it to be.

If I instead add @relay_stairs_touchtest to a func_instance_io_proxy with a target input of AddOutput, I always get the error:
AddOutput input fired with bad string. Format: <output name> <targetname>,<inputname>,<parameter>,<delay>,<max times to fire (-1 == infinite)>

But I am using the exact same format as the other method!

Is there a way to make @relay_stairs_touchtest target a specific instance? Or another method all together? This is so close to working.

Avatar
taco
504 Posts
Posted May 10, 2012
Replied 2 hours later
Only useful when you want to interact with all versions of an instance in a map:
If you use names in an instance that start with @ (as josepezdj suggested), any time you interact (ie. trigger) it outside of the instance, every version of that instance you have in your map will be sent the instruction. This did not work for me since I need 5+ version of the same instance in my map all with the ability to receive unique interactions.

A problem specific to using AddOutput in a func_instance_io_proxy:
The other "obvious" method is to use a func_instance_io_proxy inside the instance. I set up:
My Output: OnProxyRelay
Target Entity: relay_stairs_touchtest
Target Input: AddOutput

This allowed me to add a Target Input of 'instance:@relay_stairs_touchtest;AddOutput' when the Target Entity was my instance fixup name (stairs_01).

This DOES NOT WORK. It will tell you: AddOutput input fired with bad string. Format: <output name> <targetname>,<inputname>,<parameter>,<delay>,<max times to fire (-1 == infinite)>

This appears to be an error with AddOutput since you can use this method for Trigger, Disable, Enable and any other number of Target Inputs.

The Solution:

For your target entity, use the fixup name of your instance followed by a hyphen and then the name of the entity inside the instance that you want to add the output to.

Example (this example is adding an output from a logic_auto):
My Output: OnMapSpawn
Target Entity: stairs_01-relay_staris_touchtest
Target Input: AddOutput
Parameter: OnTrigger trigger_stairs_01:TouchTest::0:-1

Avatar
RustyDios
154 Posts
Posted May 11, 2012
Replied 2 hours later
Did you try setting the name of the relay to; @relay_stairs_touchtest_$name ?
Add a func_instance_parms to your instance. Open it's properties. Click apply. You should see; ParmX > $name, select that. Pick "string" from the drop down menu on the right. Input a default value.
Then when you load the instance, select it again. One of the "replace" fields will have the $name field. Put something in there ie, 1etc. This will now let you reference that particular relay from outside the instance as a trigger/etc target with @relay_stairs_touchtest_1etc. Thus making that relay instance specific. Hammer will show this as a broken link, do not worry.

I know this works because when I was first playing with instances I couldn't get anything to work because I didn't know (or more couldn't figure out!) how to use func_instance_io_proxy !! So I developed this method to interact with specific instances (namely a logic_case > InValue , with the logic_case cases to do what I wanted)...

... try it out and see how it works out for you... ((Upto 10 things inside an instance can be given a $wildcard and changed for each instance, per instance. Useful for door direction of movements (angle), speed settings (integers), rendercolours/lights (color255), boolean choices (true/false states, anything with a yes/no input field/keyvalue) ))

Avatar
taco
504 Posts
Posted May 11, 2012
Replied 41 minutes later
That seems to work for me too, though I'm not sure I see the advantage over using the method of:
<fixup name>-<entitiy name>

That lets me reference an unlimited number of entities inside my instance and my instance doesn't require a func_instance_parms or a func_instance_io_proxy.

Is there an advantage to this other method that I'm not understanding?

Avatar
RustyDios
154 Posts
Posted May 11, 2012
Replied 5 hours later
Nope, it was just another way of doing it... I started writing it out, feel asleep at the keyboard, posted it when I awoke briefly, before taking myself to bed...

Looks like your way works a lot better... We all learn something new, well I did...

Advertisement
Registered users don’t see ads! Register now!
Avatar
taco
504 Posts
Posted May 11, 2012
Replied 4 hours later
Okay, I just wanted to make sure I didn't miss something. It's good to know that there are multiple ways to do it but that I don't have to change my instance again - haha. Thanks guy!