#Global Hooks
$Simulation:
[
if missioninit == nil then
-- // MISSION INIT //
-- define and load anitexture01.. anitexture10
anitexture01 = gr.loadTexture("blast_0001")
anitexture02 = gr.loadTexture("blast_0002")
anitexture03 = gr.loadTexture("blast_0004")
anitexture04 = gr.loadTexture("blast_0006")
anitexture05 = gr.loadTexture("blast_0008")
anitexture06 = gr.loadTexture("blast_0010")
anitexture07 = gr.loadTexture("blast_0017")
anitexture08 = gr.loadTexture("blast_0008")
anitexture09 = gr.loadTexture("blast_0004")
anitexture10 = gr.loadTexture("blast_0002")
-- define nullvec
nullvec = ma.newVector(0,0,0)
missioninit = 1
end
-- // PER FRAME // Simulation
-- get the proper weapons
for i = 1,mn.getNumWeapons() do
frametime = ba.getFrametime()
weapon = mn.getWeaponByIndex(i)
weaponname = weapon.Class.Name
if weaponname == "Hammerhead" then
lifetime = weapon.LifeLeft
-- calculate the required frame number
modulolife = math.mod(lifetime,0.3)
remntlife = ((modulolife - math.floor(modulolife)) / 0.3)
-- get proper animation frame
-- '10' is the number of frames
remntlife = 10 * remntlife
if remntlife > 9 then
anitexture = anitexture01
elseif remntlife > 8 then
anitexture = anitexture02
elseif remntlife > 7 then
anitexture = anitexture03
elseif remntlife > 6 then
anitexture = anitexture04
elseif remntlife > 5 then
anitexture = anitexture05
elseif remntlife > 4 then
anitexture = anitexture06
elseif remntlife > 3 then
anitexture = anitexture07
elseif remntlife > 2 then
anitexture = anitexture08
elseif remntlife > 1 then
anitexture = anitexture09
elseif remntlife >= 0 then
anitexture = anitexture10
end
-- finally, be nice and draw the particle
ts.createParticle(nullvec,nullvec,frametime,10,"bitmap",-1,false,anitexture,weapon)
end
end
-- Odd method is used for rendering to prevent all the effects from being in the same 'phase'
-- Also this is to avoid possible issues of having too long affects that would 'keep' on the
-- effects course but which would not actually be attached to it
]
#End