Scripting Tank (Vehicle) Paths

Post your scripting questions / solutions here

Moderator: Moderators

Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

I'm not going to bother with looping until I can get the path to work. I can't get the tank to drive using that path-making script that has so far only worked for AI. This is what my .scr looks like.
thread ufftank1pathspawn
exec global/ai.scr
exec global/exploder.scr
exec global/loadout.scr "maps/m5l1b.scr"

$intro_door notsolid

fadeout .1 0 0 0 1

for (local.i=1;local.i<$tank_block.size+1;local.i++)
$tank_block[local.i] notsolid

$player.health = 50


level waittill prespawn
local.model = spawn models/vehicles/panzer_tank_europe.tik "origin" "-4019.53 -2732.03 251.86" "angles" "0 270 0" "targetname" "UFFtank1"
$UFFtank1 removeondeath 0
$UFFtank1 thread panzer_target
//$UFFtank1.start_health = 3600
//$UFFtank1.health = $UFFtank1.start_health
$UFFtank1 immune explosion
//$UFFtank1.gun = $UFFtank1 QueryTurretSlotEntity 0
//$UFFtank1.gun turnSpeed 30
$UFFtank1 thread ufftank1drive

- - - - - - - - - -

ufftank1drive:
self.driving = 1
self drive $ufftank1path 5 10 100 256
self waitTill drive
end

ufftank1pathspawn:
local.coords = "-3555.57 -3650.93 163.93"::"-2127.98 -5066.30 91.90"
local.lastPath = spawn info_vehiclepoint "origin" local.coords[1] "targetname" "ufftank1path"
for(local.i = 2; local.i <= local.coords.length; local.i++)
{
local.newPath = spawn info_vehiclepoint "origin" local.coords[local.i] "targetname" ("ufftank1path" + local.i)
local.lastPath.target = local.newPath.targetname
local.lastPath = local.newPath
}
end
That right there doesn't work, so I'm either doing something wrong, or someone could just tell me how to spawn info_vehiclepoints individually.
Does the first part of the tank's path need to be right on top of the tank? I've already tried it, and it didn't work, either.
Does the tank need to be facing the first part of the path? I can't imagine how I'd manage that.
Image
Post Reply