Code: Select all
-- by KR
--pieces
local body = piece "base"
local baclthigh = piece "leg2thigh"
local baclshin = piece "leg2"
local bacrthigh = piece "leg3thigh"
local bacrshin = piece "leg3"
local flare1 = piece "build"
local forlthigh = piece "leg4thigh"
local forlshin = piece "leg4"
local forrthigh = piece "leg5thigh"
local forrshin = piece "leg5"
local sa = piece "leg1thigh"
local sb = piece "leg1"
--signals
local SIG_AIM = 1
local SIG_AIM_SEC = 5
local walk_go = 4
local walk_stop = 8
local SIG_AIM = 5
local SIG_BUILD = 4
function script.Create(unitID)
end
function script.StartBuilding(heading, pitch)
Signal(SIG_BUILD)
SetSignalMask(SIG_BUILD)
Turn(body, y_axis, heading, math.rad(90))
WaitForTurn(body, y_axis)
SetUnitValue(COB.INBUILDSTANCE, 1)
return 1
end
function script.Querybody() return flare1 end
function script.AimFromWeapon() return body end
function script.StopBuilding()
Signal(SIG_BUILD)
SetSignalMask(SIG_BUILD)
SetUnitValue(COB.INBUILDSTANCE, 0)
Turn(body, y_axis, 0, math.rad(90))
WaitForTurn(body, y_axis)
Sleep(1)
return 0
end
function script.AimFromWeapon() return flare1 end
function script.QueryWeapon() return flare1 end
function script.Queryflare1Piece() return flare1 end
function script.Killed(recentDamage, maxHealth)
return 0
end
function script.Create()
end
local function RestoreAfterDelay(unitID)
Sleep(5500)
Turn(body, y_axis, 0, math.rad(150))
end
local function Walk()
SetSignalMask( walk_go )
Sleep(30)
while ( true ) do
Turn( forrshin, x_axis, 5, 5 )
Turn( baclshin, x_axis, -5, 5 )
Turn( sb, x_axis, -5, 5 )
Turn( forlshin, x_axis, 0, 5 )
Turn( bacrshin, x_axis, 0, 5 )
Turn( sb, x_axis, 0, 5 )
WaitForTurn( bacrshin, x_axis )
WaitForTurn( forlshin, x_axis )
WaitForTurn( forrshin, x_axis )
WaitForTurn( baclshin, x_axis )
WaitForTurn( sb, x_axis )
Sleep(30)
Turn( forlshin, x_axis, 5, 5 )
Turn( bacrshin, x_axis, -5, 5 )
Turn( sb, x_axis, -5, 5 )
Turn( forrshin, x_axis, 0, 5 )
Turn( baclshin, x_axis, 0, 5 )
Turn( sb, x_axis, 0, 5 )
WaitForTurn( bacrshin, x_axis )
WaitForTurn( forlshin, x_axis )
WaitForTurn( forrshin, x_axis )
WaitForTurn( baclshin, x_axis )
WaitForTurn( sb, x_axis )
Sleep(30)
end
end
local function StopWalk()
Signal( walk_go )
Turn( forrshin, x_axis, 0, 5 )
Turn( baclshin, x_axis, 0, 5 )
Turn( sb, x_axis, 0, 5 )
Turn( forlshin, x_axis, 0, 5 )
Turn( bacrshin, x_axis, 0, 5 )
Turn( sb, x_axis, 0, 5 )
end
function script.StartMoving()
StartThread( Walk )
end
function script.StopMoving()
StartThread( StopWalk )
end
function script.QueryWeapon1() return flare1 end
function script.AimFromWeapon1() return body end
function script.AimWeapon1( heading, pitch )
Signal(SIG_AIM)
SetSignalMask(SIG_AIM)
Turn(body, y_axis, heading, math.rad(150))
Turn(body, x_axis, -pitch, math.rad(100))
WaitForTurn(body, y_axis)
WaitForTurn(body, x_axis)
StartThread(RestoreAfterDelay)
return true
end
function script.FireWeapon1()
Sleep(30)
end
function script.Killed(recentDamage, maxHealth)
Sleep(30)
end