Cleanup is going to take awhile, so the site is back up but editing has been disabled.

Dropship Dropping Troops

From HalfLife 2 Knowledge Base

Jump to: navigation, search

This tutorial will teach you how to create a dropship that will spawn on any output of your choice which will then navigate through a path and eventually land and unleash a squad of troops.

The Setup

Before you get to creating your dropship you need a rather large environment so he has room to fly through. After you have got a decent sized room, create an npc_combinedropship entity. Now go into the properties and for the crate type select Soldier Crate. Give the dropship a name of dropship1. Then goto the flags tab and select the template npc (do not spawn) flag. Next you need to create 4 npc's of which will be transported via the dropship. Give them names of d1_soldier1, d1_soldier2, and so on all the way to d1_soldier4. Setup their guns and models to your tastes. Then in their flags set the flag template npc on. Now you need to go back into the dropship1's properties and add the 4 npc's to the template npc properties. While you may be tempted to try 6 npc's. Trust me it does not work. I intially tried dropships with 6 npc deployement and it made me so fustrated that I was following how valve did theirs and it just didnt work. I changed it to a 4 and all of sudden worked perfectly. Another warning, if you have multiple dropships in one map you cannot give them all the same template npc's. This will cause the first dropship to start deploying to end up stopping when the second dropship begins deploying its troops because your having an npc recieiving multiple commands from the different dropships since they both have the same name. Therefore always have a subset of npc's for each dropship you use. Next you will need an npc_template_maker. Name it dropship1_spawner. And set the template npc to be the dropship1. Also set the max live children to 1. Now its time to set the path up.

Setting up the paths

Now before you get the dropship landing it needs a guesstimate path to which it will be travelling to its different destinations. This is done with the entity path_track. Make a path track right below where your dropship will spawn in the map and name it "path_dropship1_1". Now select it in one of the 2d views and while holding shift drag it and place it where you want the next path point to be. By holding shift and moving, it creates a new identical entity "path_track" but instead it increments the name number for you automatically and also updates the previous path_track so its next path is the new one. So the new path_track should have the name "path_dropship1_2". There should be a line from the first path_track to the second. If either of these are incorrect you did something incorrectly. Ok now you can just rinse and repeat designing your track from start to finish. And by finish I mean where you want it to head to when its time comes to be removed from the map. And be sure to have two path tracks at the end. With a long enough distance from the last node to the second to last node so that when you call the kill function it has time to kill it before it reaches the end of the track. Now comes the fun part. You need to define at each path_track how wide the radius is that entities can travel around it. The bigger the radius the more variation in how a entity may traverse the path. Use narrow radius's for tight spots, because while it wont stop the dropship it will clip into world geometry. After you have all the tracks set up you now need to setup all the entity input/output to get the bugger moving and deploying troops.

Putting it all together

Open the dropship's properties again and set the target path_track to path_dropship1_1. This will tell the dropship1 that it is to use this path for its navigation. Next we need 5 info_targets. The first one needs to go exactly where you want the dropship to land. It also needs to be at the ground level of elevation. Name it "dropship1_landzone". Next place the 4 other info_targets where you want the npc's who come out to move towards. Each target is for a seperate npc. Place them and name them respectively d1_soldier1_dustoff all the way to d1_soldier4_dustoff. Now open up your dropship's properties again and set the landing target to "dropship1_landzone" and the dustoff points to each of the 4 dustoff target entities. Now its time to do all the entity input/outputs to get the thing up and running. First thing you will need is a trigger brush set to trigger_once. For our purposes this will be how the dropship is started off. If your making a map literally anything can start a dropship. In the trigger's properties goto the outputs tab and add a new one. Set the output to "OnTrigger" then set the entity to affect to "dropship1_spawner" and have it call the input "SpawnNPC". This right here triggers the dropship to be spawned. Next we need to tell the dropship that when it is spawned it need to head to the specific path_track of which you plan to have the dropship perform the landing and dropoff at. It should be the closest path track to the landzone. So we open the dropship1_spawner's properties and goto the outputs tab and create a new one. The output should be "OnSpawn" and have it reference to entity dropship1 and have it call the input FlyViaPathtoTrack and then for the parameter put in the name of the path_track you want the dropship to do its landing at. After doing so you need to open the properties of the path_track you have chosen to do the landing at and goto its output tab and a add a new output. Have it call the output "OnPass" and have it reference the entity "dropship1" and have it call the input "LandTakeCrate" and set the parameter to 4. All this command does is tell the dropship to land and keep the crate and deploy 4 troops out of the soldier crate. Then you need to go back to the dropship's properties and goto the output tab and create a new one. Set the output to OnFinishDropOff" to reference entity dropship1 and have it call the input FlyViaPathtoTrack. For the parameter set it to the last path_track on your path. Next goto the second last path_track and give it a new output and have it call "OnPass", then reference it to the dropship1 and have it fire the Kill input. Phew. your done finally. Now add a info_player_start and run your map. When you walk in the trigger it should start the dropship moving.

I have included a vmf for this for those who have a hard time following my tutorial. http://www.hl2world.com/bbs/dload.php?action=file&file_id=493

Personal tools