Login x
User Name:
Social Links Facebook Twitter YouTube Steam RSS News Feeds
Watch MODSonair

Members Online

0 Active | 160 Guests


Mohaa maps on Cod2?
CoD2 MP Mapping
is this place alive?
CoDBO3 Mapping
Call of DutyŽ: WWII
CoD WW2 General


CoD Mapping
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
Moving and Shooting Tanks in SP
Versions: You must be logged in to view history.
Nimrod shows us how it's done

Moving the Tank

I've just taught myself how to work with tanks in SP and I've seen one or two posts regarding tanks so I thought I would write a tutorial for them.

First off, I prefer to put a script model tank in the actual map as apposed to using a script to spawn one to a node.

Get yourself a skybox and the usual basic map stuff (don't forget your playerstart).

Right click in the 2D view and go down to model and choose vehicle->tank_tiger from the list. Then press n to bring up the entity window and give it the classname of script_vehicle. Then give it a targetname of tiger and a vehicletype of tiger. All of your keys and values for the tank should look liek the following:

KEY:classname VALUE:script_vehicle
KEY:model VALUE:xmodel...whatever it is for a tiger tank
KEY:vehicletype VALUE:tiger
KEY:targetname VALUE:tiger

Next tight click in 2D view and go info->vehicle_node. Press n and set the keys and values of the node to:

KEY:targetname VALUE:tiger_start
KEY:speed VALUE:10 (you can use whatever but 8/9/10 are ok for a tank)
KEY:lookahead VALUE:0.6

Then check the start_node check box in the entity window.

Now create another info vehicle_node with the same lookahead and speed values. Duplicate this however many times you wish, obviously the more you have the longer the path of the tank. Then select the start_node vehicle_node and then the next vehicle_node and press ctrl-K. The two are now connected and a red line with arrows should appear connecting them following the path the tank will take. Next simply connect all of the nodes to oneanother.

Now for the scripting:

maps_load::main();\loads the global scripts
maps_tiger::main();\loads the tiger script in the pak4.pk3

precachemodel ("xmodel/vehicle_tank_panzeriv_machinegun");

level.player takeallweapons();
level.player giveWeapon("panzerfaust");
level.player giveWeapon("thompson");
level.player giveWeapon("colt");
level.player giveWeapon("fraggrenade");
level.player switchToWeapon("thompson");

thread tiger()
tank thread maps_tiger::init();
my_tank thread maps_tankgun::mgon();\turns the mg42 on
tank.health = 1000;\the health of the tank

my_tank = getent ("tiger","targetname");\gets the script model you put in the map
path = getvehiclenode ("my_tank","targetname");\gets the vehicle start node
my_tank attachPath (path);\attaches the tank and start node
my_tank startPath();\starts the tank on it path


The first way is to get the tank to shoot at a target is to right click in the 2D window and go script->origin. Give this origin a target name of tank_shoot, or whatever just remember to change the targetname of the origin in the .gsc file if you use a different targetname.

Now the script is:

tank setTurretTargetEnt( getent ("tank_shoot","targetname"), ( 0, 0, 50 )\sets the turret to aim at the origin with that targetname
wait 4;\waits 4 seconds
tank waittill( "turret_on_vistarget" );\waits until the turret is on the target
tank FireTurret();fires the turret

This bit goes in the tiger() function of the .gsc file along with all of your other tank bits and pieces.

Another way is to get your tank to aim at the targetname of the origin of a script_vehicle (or any other model), like an enemy tank. To do this simply stick another tank and all of its nodes and script stick the script models targetname in the following script:

tank setTurretTargetEnt( getent ("t34","targetname"), ( 0, 0, 100 ) );\t34 is the targetname of the other tank in my map
tank waittill( "turret_on_vistarget" );\waits until the turret is on the target
wait 3;\waits 3 seconds
tank FireTurret();\fires the turret

Instead of waiting for the turret to be on the target (turret_on_vistarget) you can wait for your tank to reach its last node. This script is:

tank waittill ("reached_end_node");

If you want your tank to start a new path after firing the script is:

path2 = getvehiclenode ("tank_start2","targetname");
tank attachPath (path2);
tank startPath();

If you want a T34 in your map all you have to do is stick in a t34 script_vehicle with the vehicle type of t34 with its nodes etc. Then use the same script as with the tiger tank but under the function t34(). This time replace the parts from the tiger's script where it says tank to tank2 and if you have a 3rd tank put it as tank3.

NOTE: If you make a second tiger or a second t34 etc. you still must keep the second t34 or whatever under the same function as the original t34/tiger/whatever because you can not have multiples of a function.

Any feedback on improvements/corrections for this tutorial would be much appriciated.


If any one wants a copy of the short map I made with two t34 and 1 tiger fighting in email me at someonestolemynameagain2000@yahoo.com

Latest Syndicated News

Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends