Code: Select all
local base = piece "base"
local ltracks = {}
local rtracks = {}
-- declares all the pieces we'll use in the script.
for i=0,42 do
local tname = "lt" .. i
ltracks[i] = piece (tname)
end
for i=0,42 do
local tname = "rt" .. i
rtracks[i] = piece (tname)
end
function script.StartMoving()
movetrack()
end
function movetrack()
local i = 0
while true do
local tx,ty,tz,rx,ry,rz = GetPiecePosDir ( rtracks[i+1] )
Move(rtracks[i], x_axis, tx, 4)
Move(rtracks[i], y_axis, ty, 4)
Move(rtracks[i], z_axis, tz, 4)
if i == 42 then break
else i=i+1 end
end
end
function script.Create()
return 0
end
function script.Killed(recentDamage, maxHealth)
return 0
end
function script.HitByWeapon(x,z,weaponDef,damage)
-- This stops the unit taking damage until it's been built.
if GetUnitValue(COB.BUILD_PERCENT_LEFT)>2 then return 0
else return damage
end
end