Script - Death Flash

From FreeSpace Wiki
Revision as of 17:51, 13 August 2006 by Wanderer (talk | contribs) (initial commit)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Function

Creates a bright flash after ship is destroyed. Sort of similar to the one seen in Wing Commanders.

Table Entry

#Global Hooks

$HUD:

[

-- MISSION INIT

missiontime = mn.getMissionTime()

if missiontime < 5 then
   shipdet = {}
   if flashani == nil then
      flashani = gr.loadTexture("Btest",true)
   end
end

for i=1,mn.getNumShips() do
   ship = mn.getShipByIndex(i)
   shiphp = ship.HitpointsLeft
   shipname = ship.Name
   shipclass = ship.Class.Type.Name
   if shiphp < 1 and shipdet[shipname] == nil and missiontime > 5 then
      if shipclass == "Fighter" then
         ts.createParticle(ship.Position,ship.Velocity,ba.getFrametime(),100,"bitmap",-1,false,flashani)
      end
      if shipclass == "Bomber" then
         ts.createParticle(ship.Position,ship.Velocity,ba.getFrametime(),200,"bitmap",-1,false,flashani)
      end
      if shipclass == "Freighter" then
         ts.createParticle(ship.Position,ship.Velocity,ba.getFrametime(),1500,"bitmap",-1,false,flashani)
      end
      if shipclass == "Cruiser" then
         ts.createParticle(ship.Position,ship.Velocity,ba.getFrametime(),2500,"bitmap",-1,false,flashani)
      end
      if shipclass == "Corvette" then
         ts.createParticle(ship.Position,ship.Velocity,ba.getFrametime(),4000,"bitmap",-1,false,flashani)
      end
      if shipclass == "Capital" then
         ts.createParticle(ship.Position,ship.Velocity,ba.getFrametime(),10000,"bitmap",-1,false,flashani)
      end
      --ADD MORE OR REMOVE SHIPTYPES AS NEEDED
      --Numerical value is the effect radius in metres.
      shipdet[shipname] = 1
   end
end

]

#End

Notes

Requires an additional effect to be downloaded (courtesy of DaBrain). Download link to Filefront. The effect needs to be placed to data/effects directory.