quake2 - func_clock, target_character, target_string, target_explosion

These entitys are probably the one that gave me the most trouble out of any of them. They are not easy to use(except for the target_explosion). The func_clock acts like a time of day clock and in most instances it will be used with a target_character and target_string. It was used in the biggun level and the last level where you have to escape before in a certain amount of time.

In this example we will make a button that you press and it will make a counter appear on the wall that will count down from 10 and when it gets to 0 then the room will explode killing you and everything else..

The first thing you need to do is make a somewhat small room and put a player_start and a light in it.

Next you need to create a func_clock entity. You can put this entity anywhere you want. It will not show up in the level. This will control the clock. The key value pairs that you can set are count, pathtarget, and style. count determines the amount of time that the func_clock will count. Pathtarget is the target that will be triggered once count runs out. Style is for the actual visual clock that we will explain later. There are 3 styles. 0(xx), 1(xx:xx), and 2(xx:xx:xx). In this example we are going to set count to 10 and we are going to use style 2. We also need to specify the pathtarget which we will set to bang. Pathtarget bang. This will be the targetname of the target_explosion that we will make later that will kill everything. Now set the target to string which will be the target_string that we will make next. Also give the func_clock a targetname of clock so we can use a button that we will make later to trigger it into action.

There is also a variety of spawnflags for the func_clock. They are timer_up, timer_down, start_off, and multiuse. Timer_up makes it so the counter will count up and timer_down makes it so the counter will count down. This is basically just for looks. It does'nt effect the outcome. Start_off should be set if the clock will be triggered into starting. If this is off then the func_clock will start when the level starts. Multiuse should always be on. I'm not sure what it does but I do know that I have never ran into any problems when I keep it on. For this example we will set the timer_down, start_off, and multiuse spawnflags.

The next thing we will do is make a target_string entity. It does'nt matter where this entity is placed either. It will not be shown. Give it a targetname of string so that the func_clock will be targeted to it. Also give it a team key value pair of countdown. team countdown. This is all you have to do for the target_string.

Now we need to make 8 small brushes 8x16 right next to each other and turn them into target_characters. These will represent the 8 characters that will be used from the style key value pair that we set on the func_clock. xx : xx : xx

You then need to turn all of these 8 brushes into target_strings. There are 2 key value pairs that you can set. They are count and team. The count is the position of the string that this the brush is and the team is the team that the entity is on. So on all 8 of these target_strings the team needs to be countdown. The count must be different for each of the 8. The one on the far left needs to start with 1. count 1. and the one on the far right needs to be set to 8.

Now the tricky part that I could'nt figure out till EutecTic told me. You must have the texture of all these target_strings set to num_0 that is in the test.wal file. If you don't have this texture set then the countdown will not be printed.

Now we have to make the func_button that will trigger the func_clock into action. Make a button on the wall and set the target of it to clock and the wait to -1 so you will not be able to press the button again.

The final thing we need to do is to make the explosion that will kill everything. For this we will use a target_explosion. What a target_explosion does is when triggered creates a visual explosion that can be set to do any amount of damage. There are 2 key value pairs that you can set. Dmg and delay. Dmg is the amount of damage the explosion will cause and delay is the amount of time after triggered that the explosion will take place. For this example we will put the target_explosion in the middle of the room and give it a targetname of bang and a damage of 10000. This extreme high value will make sure everything is dies when it is triggered. If you have a larger room or a huge level then you will need to use multiple target_explosions all with the same targetname. and we are done. Be sure to check out the [example .map].

You can also use a func_clock without the visual countdown, just don't create any target_strings. You still must have a target_character though. As you can see this is a somewhat difficult entity to master but can come in handy for quite a few things. Any other questions please post them in the discussion board.

Return to Tutorials Page...

Copyright Crap