Post tutorial RSS Hammer Logic Tutorial

In this tutorial I will be talking about the use of logic entities and the Hammer I/O (Input/Output) system.

Posted by on - Intermediate Mapping/Technical

Hello everyone In this tutorial we will be talking about the logic entities:

And also in what context and manner they can be used through the I/O system.

The logic_timer will count from a minimum number you specify to a maximum number that you specify
and then start from the minimum number again.
(This can be reversed by ticking the flag "Oscillator")

It will fire outputs on reaching its minimum and maximum numbers which will allow you to do things like making steam activate procedurally or for making other procedure events.

If "Use random time" is set to yes the logic_timer will fire randomly between the maximum and minimum number you specify.

This could be used to make effects like steam springs bursting at random times.

This logic entity is used to pass off logic events to keep things in your map more organized and understandable with complex logic events.

It is also useful for directing outputs for one event in a specific logic_relay so that the I/O chain can be broken if you don't want a specific event to happen in your map at any given time.

A logic_auto is used to fire events majorly when your map starts e.g. Making a console command "give item_suit" to give the player his suit at the start of the game or to set exposure levels.

The logic_auto is also used for Background menu commands like enabling the background menu camera on background menu start =D

basically enabling the camera on Mapspawn.

This is the Hammer Boolean entity working on whether something is True or False.

The way to explain this entity is to show a trap made in hammer:

If the logic_branch was initially set to false and the trap (A cage falling on the player or the ground breaking) is unactivated with yet no inputs:

make a trigger so that when the player touches it the logic_branch becomes true and the trap is activated.

Doing this will also help organize your map because the trigger wont be doing multiple events at once, there is nothing wrong with this if you think you can manage but it is better then having the trigger adjust contrast, start scenes and breaking floors.

logic_compare will compare its initial value to the specified compare value or changed compare value
firing in many different cases like if initial value is equal to compare value do this or if
initial value is less then compare value do this.

This entity Is good for things like possible relationship changes,
If initial value is equal to compare value ai_relationship: npc_combines like !player

but If initial value is not equal to compare value disable ai_relationship.

The math_counter entity is used to count up and fire an output on its minimum or maximum number it can also fire on a specific number specified by the mapper.

This entity can be used to count the amount of battery's powering something and when there is enough turn on the lights as featured in half-life 2.
Or it could be used to count the amount of fuel cans found like in the mod "Zombie master"

The math_counter can be used in combination with the logic_timer to add a number to the counter every 10 second while firing its own events.

e.g. With the logic_timer when it reaches every 60 seconds spawn some more NPC's and add one to the math_counter to eventually open a door or something.

The logic_case is an event checker that will make something happen based on the case that is it set to.

Event 1 The player breaks some ammo crates that changes the logic_case to case 1 and spawns some zombies.

Event 2 the player walks past the crates and through a trigger to change the logic_case to case 2 and start some rappelling combine.


This entity is used to listen to the player actions like checking if his flashlight is on or off or checking if the player is out of ammo.

Small things you can do with this entity are things like giving the player ammo if he has depleted it or lowing the players weapon if he is out of ammo or if his flashlight is on.

Thanks, i hope this helps some of you out there and i decided to make a logic tutorial because the area seemed to be lacking in tutorials.

if something did not make sense or you want something else explained message me over Mod DB or email me at



usefull like a cheat sheet =]

Reply Good karma Bad karma+2 votes

Wow, some nice info. We need more of these.

Reply Good karma Bad karma+3 votes

Cool looks good Necro

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.