Hammer Tutorial: Output and Inputs. Npcs and ai_relationship explained

Hammer Tutorial 1: Outputs and Inputs and Ai_relationship

I made this so people would stop asking about it.
Outputs
Hammer is fairly simple to learn, so is the new input output system involved. Basically, an object is read by hammer when in game, and its outputs are examined. Outputs are functions that the object sets off, such as a button having an output to turn on or off a light when pressed. To add outputs to objects, just bring up the objects properties(Alt+Enter) and click on the outputs tab. While there, click add output, then fill in the fields. Say you named a light light1. From there, you would have OnPressed for the first field, then light1 for the second, and LightOn for the 3rd. That would have it so that when the button is pressed, the light is turned on. You can also add a delay so that when the button is pressed, the light turns on after a certain amount of time. With this understanding, this example can be applied to almost anything, from making a wall break to making a sound play.
Inputs
Following up the previous example, inputs are directions an object receives from other objects or places in the game world. An example would be light1 would have an input that read from Button, OnPressed, light1, turn on. Theyt are fairly simple, and the only way to change them is to change the source of the directions outputs.
Ai Relation ship entity
To start off, place a npc_metropolice in your map, along with an info_player_start. Now, place an entity titled ai_relationship. Now go into its properties, and add its target as npc_metropolice and its subject as !player. That means this is effecting the combine cop. Now set the disposition to like, and if you are affecting to different npcs, then setting reciprocal to yes means that the subject will feel the same way about the target. Set start active to yes, then compile it and you should see that the cop and the citizen like each other and the cop will not attack the citizen.
Please comment on this small tutorial, and ask questions if you have any.

2 Likes