Entity Input/Output

- By Raeven0
This tutorial was last updated on Feb 26, 2006.

Entity I/O--entity input/output--is a system for allowing what happens to one entity to affect what happens to another. For instance: when a player picks up a certain gun, the action of picking up the gun can cause an explosion elsewhere in the map. When another player opens a door, the ceiling can fall on him; when the door is closed again, the ceiling can mysteriously rise back into place...

One thing must be cleared up before we go further. The input is what's sent, and the output is what happens to cause the input to be sent. A player pressing a button is the output named OnPressed: "when I am pressed, I will send my inputs." Complain to Valve if you want to know why outputs are what comes in and inputs are what goes out.

The I/O system is much easier to pick up by example than any other means. Suppose you have two entities, EntityA and EntityB. EntityA can send commands to EntityB via inputs. For instance, one input is called Kill. When EntityA sends EntityB the Kill input, EntityB is removed from the map completely. Another example is the TurnOn input. If EntityB is a light or some other entity that can be turned on, the TurnOn input will turn EntityB on. (There's also a TurnOff input for turning EntityB off, and a Toggle input for switching it to whatever state it's not currently in.)

Okay, so EntityA can send inputs to EntityB... but how does EntityA know when to do that?

Anything that can happen to EntityA is referred to as an output. For instance, the entity called trigger_multiple (which sends inputs when a player touches it) supports the output OnStartTouch. With this output, any time a player touches the trigger_multiple, the input associated with the OnStartTouch output is fired. (Inputs and outputs always come in pairs. One output can send one input. Outputs can be used more than once in the same entity, though.)

The following is a sample output for a trigger_multiple:



1) A table of all of the outputs you've set for this entity.
2) The description says "my output named," but this is the condition under which the input below it will be fired. OnTrigger means "when I am triggered, do this."
3) The name of the entity to send the input to. If an entity doesn't have a name, it can't accept inputs.
4) The input to send. Some entities support special inputs, but some inputs are accepted universally.
5) There are a few special inputs that cause the target entity to be active for X seconds, or that change the properties of the target entity. The Parameter Override field is the field in which the number of seconds or the properties to change will be entered. If the input you've chosen doesn't require additional parameters, this box will be greyed out. Also, some outputs already provide parameters--for instance, an entity called math_counter stores in its memory a certain number, and can pass that number along as a parameter to any input it sends. The parameter override should only be used to override the parameter sent automatically by an output.
6) Rather obvious: how long to wait before firing this input.
7) Sometimes it's necessary to make sure that an input can only be fired once (the AddOutput input is a prime example). Checking this box will allow the input to fire only once.

At the bottom of the Output tab are five buttons. You can add, delete, copy, or paste outputs, or you can select an output and go to the entity it targets with the Mark button.

[The Inputs tab looks like Part 1 of the Outputs tab. It contains a list of every input you've marked the selected entity to receive.]



Still need help? Ask your questions in one of our HELP FORUMS
Post A Comment
Name:
Email: Links Not Allowed In Comments
Comment:
What is the capital of France? Need Help?
Comments
Outseeker - Aug 2, 2009
Are you aware of the method used in PAWN to trigger a button in a map? For example, trigger a door open button when you say the password? I am hoping to add that fuctionality to a map that is already built. Any chance?
MBD - Aug 21, 2006
Have the func_button trigger a point_servercommand
Waterpistol - Aug 19, 2006
hey i want to creat a secret room in which has buttons that change the gravity is this possible. i know how to make the room and all but how do i make it so when a button is pressed it lowers the gravity?
All original content ©2006 EditLife.net. All Rights reserved. All files property of their rightful owners.
Get Firefox! Get Thunderbird! Get Notepad++!