Snarkpit Articles


This tutorial will show you how to create a television showing what's going on in another part of your map, and that is plugged into the wall- so that when you try to run off with it, it'll switch off.

So, first of all we will build the TV. Create a prop_physics, name it tv, and give it a suitable model- for example, props_c17/tv_monitor01.mdl. In the same space, make the glass front for realism- create a prop_dynamic with the props_c17/tv_monitor01_screen.mdl model, and set the parent to tv. Setting the parent field basically sticks objects together, so when you move the TV box the screen will go with it.

Create a func_brush using the toolsnodraw texture, and name it tv_screen. Texture the viewing side with an appropriate monitor material- this might require you play around to find which is best, but we will use tv_monitor1a here. Now fit the monitor texture to that face with the texture application tool, so that the image shown on the TV is the right size. Now move it into the TV, and place it slightly behind the screen. Set its parent to tv.

Finally, create another func_brush, but texture it with a black texture, and place it ever so slightly behind the other func_brush already inside your TV. This is because later on we will kill the screen in front showing the picture, so all we will see is a black screen. Also set the parent to tv.



Now we will setup the camera itself. Create a point_camera entity, facing what you want it to film, and name it tv_camera. Make sure the start off flag isn't checked, and configure any other properties you want.

Create an info_camera_link entity, named tv_link. This entity will draw what the camera is recording on what we want it to. Set entity Whose Material Uses _rt_camera to tv_screen, and camera name to tv_camera.

Provided you used a suitable monitor texture earlier, you'll now have a working TV which you can throw around. If you want some kind of "news cast" or TV show, simply create a scene elsewhere in your map with the camera and relevant NPCs running around inside. Note how the TV screen will "draw off into infinity" (well, only 3 times) if you can see it in the camera!



And now for the rest of the setup. First of all, make a plug socket using whatever textures you can find (e.g. decals/decalpoweroutlet001a) and turn it into a func_brush entity. Name it plug. Next, create a keyframe_rope entity behind the TV box where the wire will plug in, and name it tv_plug. We don't really need this entity (though we could use an info_target instead) but it stops the wire from looking like it's attached to the front of the TV when you start moving it around. Also set the parent to tv.

Now we will make the wire. Create a move_rope entity, called cable. Note that the wire that this entity makes starts at its origin, so place it inside or just in front of the plug socket. Set the next keyframe to tv_plug, which makes the wire trail between the socket and the back of the TV. Give it some slack (e.g. 24) though the value will depend on your setup and you will have to play around with it. Set the type to rope, and make the width 1.

At this stage, it might be worth compiling to check that your rope is setup correctly, as it can be a bit tricky to get working.

Finally, we need a phys_lengthconstraint entity to "break" the wire when it's pulled too far. Set entity 1 to plug, and entity 2 to tv- these are the two points that this entity will judge the distance between (note that our TV itself is specified here instead of the tv_plug, as it won't work otherwise!). Set the force limit to break to some small number, e.g. 50, and choose a nice spark sound for the play on break property. Set the additional length to the extra distance you have to pull the TV for it to break, e.g. 32 units.

Now we need the effects for when you break the cable. Click the "outputs" tab of your phys_lengthconstraint, and add a new output to break the cable: OnBreak target cable via Break. Add another new output to turn off the TV screen: OnBreak target tv_screen via Kill.

Finish off by placing your TV on a nice prop_physics table, and compile!



Post ReplyView Topic
Discussion
0 starsPosted by mbs357 on Tue Jan 24th 2006 at 1:28am

I have three monitors close together with three cameras and three links and for some awful reason I can only get the monitors to display one camera's feed at a time. =(
My mind boggles, I can't figure out what I'm doing wrong.
Great tutorial though.
0 starsPosted by Corrupt on Tue Aug 9th 2005 at 10:16pm

Can this be done with a monitor? A computer monitor?
0 starsPosted by SNAFU on Sat Jul 30th 2005 at 1:59pm

NIce tutorial, I have tried this in CSS thou and i can't find point_camera entity! Any ideas?
0 starsPosted by $loth on Tue Jun 14th 2005 at 7:43am

I think nearly all of these entities used a part of the source engine and not HL2 specific, so It should work in CSS.

Very well explained tut lep, and a very good use aswell.

Baddog, there is a func_brush, both in hl2dm and css.
0 starsPosted by StixNStonz on Tue Jun 7th 2005 at 1:16am

Need to mention if these work in CSS or not
Post ReplyView Topic