Talk:User Inputs and Outputs

From Valve Developer Community
Revision as of 09:07, 13 May 2021 by SomeUntakenUsername (talk | contribs) (Special targetname output parameter bug fixed?: new section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

I need some help

I was trying to make it so one bombsite ends the round but the other doesn't. So, I made mp_ignore_round_win_conditions set to 1. The first bombsite didn't end the round, as expected. Exploding the bomb at the other bombsite should have triggered the game_round_end entity to end the round via the output "BombExplode", triggering the input "EndRound_TerroristsWin". But, instead of that, I get this:

game_round_end(gameender,EndRound_TerroristsWin) doesn't match type from func_bomb_target()

How do I fix this?

Lonkfania (talk) 22:23, 19 February 2016 (UTC)

I was trying to use UserInputs to setup a logic_relay for the purpose of controlling a light so that when the light was shot out, it would stop functioning. I connected a logic_switch to fire either User1 or User2 on the relay to set the light on or off respectively, and setup the OnUser1 and OnUser2 to turn on/off the light and appropriate models.

This all works, but when I tried to connect the OnBreak or OnHealthChanged output of the light models (prop_dynamic_override) to trigger and disable the relay, it compiles fine, but I get an error in the game engine saying there is a mismatch on the connections:

!! ERROR: bad input/output link: !! logic_relay(se_relay,FireUser2) doesn't match type from prop_dynamic(light_se_on)

This same technique works fine if I setup two logic_relays, and only use the Trigger inputs instead of the User inputs. Any ideas?


There is an easier way, place a box of func_breakable in nodraw texture around the light. Set the health at whatever, and aadd a trigger: OnBreak, [name of your light entity], Turn off, No delay Also, if there is a switch you should add another to lock it.

Here's a tutorial if your still confused


(Also sign your comments with four tildles ~ )

Spiritslayr 12:56, 11 Jun 2008 (PDT)

Better Example?

I found the main article somewhat difficult to understand, so I reworded it a bit and added what I think is a clearer example then the one in the main article. I've attached my edit below as the main article is currently locked.--Brandished 00:53, 4 Jul 2008 (PDT)

The FireUser1-4 inputs and OnUser1-4 outputs are available on every entity that can receive Inputs and Outputs. This set of controls are specially linked to work together. Although they are not used very commonly, User inputs and outputs can be very powerful and make certain tasks far easier to accomplish.

The OnUserN output simply stores an action that is not performed until it is activated by a corresponding FireUserN input. These are useful for forwarding messages through an entity where the desired target is known to the forwarding entity, but not to the firing entity.

An example can be found in the Valve map, "sdk_d3_citadel_01.vmf", found in the "sourcesdk_content\hl2\mapsrc" folder. A func_tracktrain (zapperpod1_train) with a func_door_rotating (zapperpod1_rotator) parented to it moves along a path_track (pod_bay_zapper_track).

In the "func_tracktrain" entity's Outputs tab, there's 2 settings:

My Output > Target Entity Target Input Parameter Delay Only Once
Io11.png OnUser1 zapperpod1_rotator Open 0.00 No
Io11.png OnUser1 zapperpod1_rotator Close 5.00 No

So basically, when User1 is fired, the "func_door_rotating" will open and, after a 5 second delay, close. To fire this output, one of the "path track" entities, "pod_bay_zapper_track4", has an output of:

My Output > Target Entity Target Input Parameter Delay Only Once
Io12.png OnPass !activator FireUser1 0.10 No

When the "func_tracktrain" passes the "path track" entity, it becomes the !activator and its User1 output listed above is fired.

Another Example

Here is another example, from HL2 d2_coast_08:

A logic_auto is used to tell 3 seagulls to fly away. Most mappers would specify each output individually, but using the User Inputs and Outputs, the mapper here was able to do it all with a single FireUser1 output, as shown below:

"origin" "3349.73 -2612.79 1033"
"spawnflags" "1"
"classname" "logic_auto"
"OnMapSpawn" "seagull,FireUser1,,0,-1"

"origin" "3328 -2688 2177"
"targetname" "seagull"
"spawnflags" "4"
"classname" "npc_seagull"
"OnUser1" "!self,FlyAway,bird_flightpath_a_48,0,-1"

"origin" "3319.87 -2531.21 2177"
"targetname" "seagull"
"spawnflags" "4"
"classname" "npc_seagull"
"OnUser1" "!self,FlyAway,bird_flightpath_a_48,12,-1"

"origin" "3191.87 -2531.21 2177"
"targetname" "seagull"
"spawnflags" "4"
"classname" "npc_seagull"
"OnUser1" "!self,FlyAway,bird_flightpath_a_10,12,-1"

In this case the FireUser1/Onuser1 was not required, but it did simplify the task at hand.--Fitzroy doll 13:37, 30 Oct 2008 (PDT)

Yes, but this means you can't tell each seagull do something seperately. Solokiller 13:42, 30 Oct 2008 (PDT)
No - the genius of the system is that you can do exactly that. Look at the inputs above. The first seagull flies to bird_flightpath_a_48 with no delay. The second seagull flies to the same path but waits 12 seconds before doing so. The last one also waits 12 seconds, but flies to a different path bird_flightpath_a_10. All of this is accomplished using one output and one targetname for 3 entities.--Fitzroy doll 13:45, 30 Oct 2008 (PDT)
I'm having trouble understanding how this is genius at all? It just seems pointlessly different from the normal way. --Princess 23:24, 10 April 2009 (UTC)
The point in this example is that once the the trigger has been set up to FireUser1 on each subject entity, you can then work with the timings and other parameters of the event within the subject entity itself through the OnUser1 output, and even add new subject entities, without adjusting the original trigger.
Here's another example: Let's say you want to trigger a logic_relay with a targetname "effects_relay" when an npc_combinegunship breaks a func_breakable, but not fire the output if it is broken by any other npc or the player. In the func_breakable you add an output as follows:
My Output > Target Entity Target Input Parameter Delay Only Once
Io12.png OnBreak !activator FireUser1   0 No
and on the npc_combinegunship you would add this output:
My Output > Target Entity Target Input Parameter Delay Only Once
Io11.png OnUser1 effects_relay trigger   0 No
This will trigger the relay when the npc_combinegunship breaks the func_breakable, but will have no effect if it is broken by any other entity.--Fitzroy doll 13:08, 11 April 2009 (UTC)


Why not say:

"OnMapSpawn" "seagull,flyaway,,0,-1"?

--Bit Mage 12:51, 31 May 2009 (UTC)

I figured out a good reason myself. You can have a setup like:
"OnMapSpawn" "citizen*,FireUser1,,0,-1"
and then on an entity called "Citizen1"
"OnUser1" "Ignite"
and then on an entity called "Citizen2"
"OnUser1" "StartScripting"

--Bit Mage 18:27, 12 June 2009 (UTC)

Special targetname output parameter bug fixed?

I tested this in Team Fortress 2 by setting the parent of a prop as the player using !activator through firing user input on a math counter. The player was recognized as the !activator and the prop was parented successfully. SomeUntakenUsername (talk) 09:07, 13 May 2021 (PDT)