Something little brighten up the ship deaths...
#Global Hooks
$Simulation:
[
missiontime = mn.getMissionTime()
frametime = ba.getFrametime(true)
if missiontime < 1 then
flaktexture = gr.loadTexture("lglow3")
nullvec = ba.createVector(0,0,0)
detotexture = gr.loadTexture("EXP_flash", true)
detotimes = { 2000000 }
detoinfo = {}
detoshipdead = {}
math.randomseed( os.time() )
end
for i=1,#mn.Ships do
detoship = mn.Ships[i]
detoshipname = detoship.Name
detoshiphp = detoship.HitpointsLeft
if detoshiphp < 1 and detoshipdead[detoshipname] == nil then
detoshipdead[detoshipname] = 1
detoshiptype = detoship.Class.Type.Name
if detoshiptype == "Freighter" then
detoshipvel = detoship.Physics.Velocity
detoshippos = detoship.Position
detonum = math.floor(10+2*math.random())
for k=1,detonum do
detorandtimer = 1+2*math.random()
detorandvector = ba.createVector(100*(math.random()-0.5),100*(math.random()-0.5),100*(math.random()-0.5))
detoprojection = detoshippos + detorandvector + (detoshipvel/(1/detorandtimer))
detotime = detorandtimer + missiontime
table.insert(detotimes,detotime)
table.insert(detoinfo,math.floor(detotime*10000),detoprojection)
end
table.sort(detotimes)
end
end
end
while detotimes[1] < missiontime do
detotimer = detotimes[1]
ts.createParticle(detoinfo[math.floor(detotimer*10000)],nullvec,frametime,math.random(50,200),PARTICLE_BITMAP,-1,false,detotexture)
table.remove(detoinfo,math.floor(detotimer*10000))
table.remove(detotimes,1)
table.sort(detotimes)
end
]
#End
Basically it creates series of flashes (animation) around (or inside) the ship when it dies. 'lglow3' is a standard bitmap graphic and 'exp_flash' is an animation (eff)