Tutorial: Tankrockets Last edited 1 year ago2019-04-23 06:54:36 UTC

Download attachment

On several occasions during the game Gordon gets to use, or gets shot at by, turret-mounted weapons. In WorldCraft, these are all referred to as tanks, and there are four types:

The Structure

In this tutorial I will be dealing with the func_tankrocket, but all the 'tank...' entities are similar so you should be able to apply this tutorial to the other types quite easily.

First you should create a basic structure. The only thing you really need is some kind of barrel, but I made mine into a double-barrelled launcher with a tripod base. Anything can be used to make up the barrel, but the one requirement is that it has an origin brush somewhere - usually in the middle. An origin brush is simply a brush (use a cube) with the 'origin' texture on all its faces. Once created, simply select it along with the rest of the barrel, right-click, and select Tie to Entity.

Setting up the Tank

Choose func_tankrocket from the entity list and give it the following settings: Most of those properties can be customised to how you want them. On the flags page, set Controllable on. The tank entities can be used to create non-controllable weapons - i.e. weapons that shoot at the player. For this you should set Controllable off and Active on.

You can also change the pitch settings to make the weapon move up and down as well. The most confusing thing about these things is the way they are aligned. The side of the barrel that you intend the rockets to emerge from means nothing to the game engine, so you need to make the rocket-launching side of the barrel face 0° in WorldCraft, and use the little Angle compass in the Properties sheet to set the direction you want it to appear in the game. For example, my barrel has to face 0° in WorldCraft, because that's where the engine is going to make the rockets shoot from. But I want it to be facing the other way in the game, so I set the compass on the Properties sheet to 180°. That sorts it out.

When the game starts the tank will face the direction you set, and the axis it rotates on will be the middle of the origin brush.

Taking Control

There's one last thing to do - create a control for the tank. This can be any brush, but it should be large enough to allow the player to move around a little and still have control. You can either make the brush right on the end of the barrel, so that it is as if the player is holding the gun, or you can put it in front of a control panel or something, so that it appears to be remote controlled. The game engine takes the position of the player at the point he presses Use, and alters the position of the barrel according to movements the player makes while he is still in control (i.e within the brush, which is invisible). Make the brush you created a func_tankcontrols entity, and set its target to rocket (or whatever you called the tank). Because in the game the entity is invisible, it can have any texture, but it's usually given the 'AAATrigger' one.

Thats it! Your tank should now be ready to kill things. Something you might want to try is to target an ambient_generic sound effect from the func_tankrocket to create a 'launching' sound.
Brush-based death anyone?Brush-based death anyone?


Commented 10 years ago2010-03-08 23:33:43 UTC Comment #100494
You can also add gun shot sounds and ejecting shells to your turret very simply. Just place an ambient_generic by the turret with a gun shot sound and give it a name. Check the not toggled flag. Give it a name and set the turret's target to the sound's name. To make shells eject from your turret place a env_shooter next to it. For model name put models/shell.mdl. On the compass select which direction you want them to shoot and give the env_shooter the same name as the sound.
Commented 10 years ago2010-03-08 23:35:25 UTC Comment #100495
For number of gibs on the env_shooter select 1 unless your turret is a shotgun. Also check the repeatable flag.
Commented 9 years ago2011-01-25 01:47:33 UTC Comment #100496
hey thanks i have a laser gun now in counter strike 1.6 but i have a question like is it possible to make a moveving laser in valve hammer 3.4 or 3.5

i found this http://developer.valvesoftware.com/wiki/WiseLaser but this is for valve hammer 4.1 or is it valve hammer source sdk ?
Commented 9 years ago2011-01-25 10:29:57 UTC Comment #100497
Take a look at env_beam (tutorial, entity guide).
Commented 9 years ago2011-01-26 03:14:00 UTC Comment #100498
Commented 9 years ago2011-04-15 17:45:05 UTC Comment #100499
Good tutorial
Commented 1 month ago2020-08-23 12:43:16 UTC Comment #102870
i did everything the tutorial told me to but the gun still spins around all the time. help me plz

You must log in to post a comment. You can login or register a new account.