Well, it'd be more appropriate to do it with something like:
#Conditional Hooks
$Version: 3.7
$On Game Init: [
--Setup variable g_Shooters[][], which is a multidimensional array of shooters and objects
addWeaponObject = function(object)
--Indexes array of shooters, then indexes array of objects for that shooter;
--Adds weapon to array if not found
end
getWeaponObjectIndex = function(object)
--Indexes the above array, and gets what the object's index is,
--ie how many weapons the ship has fired
end
cleanupWeaponObjects = function()
--Run once per frame to get rid of dead weapons in the array
end
]
$On HUD Draw: [
for i=1,#mn.Weapons do
addWeaponObject(mn.Weapons[i])
end
--Ideally, you would use a flag or something to mark each weapon,
--that still exists this frame, in the above pass.
cleanupWeaponObjects()
]
$Version: 3.7
$Weapon Class: My Tracer Weapon
$On Object Render: [
--Empty function
]
+Override: [
if getWeaponObjectIndex(hv.Object.Parent, hv.Object) % 5 == 0 then
return false --Render weapon
else
return true --Don't render weapon
end
]
This would allow you to deal with tracer weapons more or less transparently, so each weapon wouldn't need any extra table entries. I'm not sure if it'd actually be faster or slower than Wanderer's method.
Ideally, you'd want a $On Weapon Create or $On Object Create or $On Weapon Fire hook of some kind for this sort of thing, to get rid of the tedious and wasteful iteration of mission objects.
Switching rendering on and off is how I was planning on doing it, but now I see that there's actually a request to switch weapon types, so hmm.