Adding Drivable Vehicles
Versions: You must be logged in to view history.
Tutorial by Flipsen and Bodger2 explains how to add usable vehicles in your SP map
1: make a big skybox with a single brush (just as a test)
2: put a
"script_vehicle" in your map and assign the following key/value's to it (in the
entity window)
model/"you can put any model of the respective vehicle you
want (so of you'd want a t34 tank in your map put the vehicle_tank_t34 model in
your map"
vehicletype/here's a list of the names of the value's that can
be put
here:
Flak88
FlakVierling
T34
PanzerIV
tiger
Targetname/
this is to match the above
list
flakvierling
flak88
t34
panzer
tiger
spawnflags/1
(you can also check the "usable box in the entity
window)
then put this in your script (in the "main" section
of your script, this is for example if i'd put a flakvierling anti air turret
from the airfield level in my map):
flakvierling = getent("flakvierling","targetname");
flakvierling
maps\_flakvierling::init();
here's what entity's i'd have to put in my map for the flakvierling to work:
classname script_vehicle
model xmodel/artillery_FlakVierling
spawnflags
1
targetname flakvierling
vehicletype FlakVierling
Important other stuff:
1: the sounds dont work very well yet
2:
NOTE THE CAPITAL LETTERS, LEAVE THEM or it wont work
Bodger2 adds:
...scripting for the Flak 88
Its has much more scripting because its not included in _flak.gsc
You need
to create a script vehicle Flak 88 and check the USABLE spawnflag.
Give it a
targetname and a vehicle type.
KEY:classname
VALUE:script_vehicle
KEY:xmodel VALUE:xmodel/turret_flak88
KEY:spawnflags
VALUE:1
KEY:targetname VALUE:blabla
KEY:vehicletype
VALUE:Flak88
Heres the GSC scripting part
main()
{
maps\_load::main();
thread
player_flak88();
}
player_flak88()
{
flak1 =
getent("blabla","targetname");
flak1 thread flak88_init();
flak1 thread
maps\_flak::flak88_playerinit(flak1);
vec = (7600, -310, -720); //origin
to face at start (x,y,z)coords
flak1
setTurretTargetVec(vec);
}
flak88_init()
{
self.health =
250;
thread flak88_kill();
thread
flak88_shoot();
}
flak88_kill()
{
self.deathmodel =
"xmodel/turret_flak88_d";
self.deathfx = loadfx(
"fx/explosions/explosion1.efx" );
self.deathsound =
"explo_metal_rand";
maps\_utility::precache( self.deathmodel );
self
waittill( "death", attacker );
self setmodel( self.deathmodel );
self
playsound( self.deathsound );
self clearTurretTarget();
playfx(
self.deathfx, self.origin );
earthquake( 0.25, 3, self.origin, 1050
);
}
flak88_shoot()
{
while( self.health > 0 )
{
self
waittill( "turret_fire" );
self FireTurret();
wait 1;
self playsound
("flak_reload");
}
//destroy the shell hudelem
if (isdefined
(level.fireicon))
level.fireicon destroy();
}
And for the CSV file
name,sequence,file,vol_min,vol_max,pitch_min,pitch_max,dist_min,dist_max,channel
,type,probability,loop,masterslave,loadspec,subtitle
null,,null.wav,,,,,,,,,,,,,
Flak88_fire,1,weapons/flak/flak88_fire.wav,1.5,1.5,0.9,1.1,800,6500,weapon,,,,,!yourmapname
Flak88_fire,2,weapons/flak/flak88_fire02.wav,1.5,1.5,0.9,1.1,800,6500,weapon,,,,,!yourmapname
Flak88_fire,3,weapons/flak/flak88_fire03.wav,1.5,1.5,0.9,1.1,800,6500,weapon,,,,,!yourmapname
flak_reload,,weapons/flak/flak_reload.wav,1.5,1.5,0.9,1.1,120,500,,,,,,yourmapname
and before anyone asks this is for SP ONLY
some other side notes to mention - the T34 and Flackvierling work really well compared to the other script vehicles because they were part of the SP misions and had to be good - the other tanks are somewhat hard to control
also - due to (what i thought would be - but aren't) obvious reasons - you CANNOT copy and paste the code from this tutorial into your own gsc. your gsc must be text only and a copy and paste wont produce that
retype the info into your gsc for NO PROBLEMS