【单兵云梯】
@afjahgja

function onMissionStart()
x=0
y=0
z=0
th=0
target=''
g=false
ds={}
end
function onMissionTime_00x00x10(missionTimeInMilliSeconds)
OFP:forceDismountVehicle('t','override')
end
function updateFrame(currentTime, frameNo)
if g then
if math.mod(frameNo,3)==0 then
if y>=th then
_,y,_=OFP:getPosition(target)
OFP:spawnEntitySetAtLocation('e',x,y,z)
else
y=th-1
if #ds>0 then
OFP:destroyEntitySet(ds[#ds])
table.remove(ds,#ds)
else
OFP:setInvulnerable(target,false)
g=false
end
end
end
end
end
function onSpawnedReady( setName, setID, tableOfEntities, errorCode )
if setName=='e' then
ds[#ds+1]=setID
end
end
----------------------------------------------------------------------------------------------------------------------
function onDismount(vehicleName, unitName, echelonName)
if isAir(vehicleName) and OFP:getHeight(vehicleName)>=10 then
if isSoldier(unitName) then
target=unitName
x,y,z=OFP:getPosition(target)
th=OFP:getTerrainHeight(x,z)
OFP:setInvulnerable(target,true)
OFP:addTimer('start',500)
end
end
end
function onTimer_start()
g=true
OFP:removeTimer('start')
end
function isAir(name)
return OFP:getBroadUnitCategory(name)=='BROAD_UNIT_AIRCRAFT'
end
function isSoldier(name)
return OFP:getBroadUnitCategory(name)=='BROAD_UNIT_SOLDIER'
end