Hate the current system, wanna bash something together with either lua ProjectileCreated callin or ShotX in lus, and LUPS.

Info on colours: … c=157610.0 … 12320.html … ur&f=false



tracerCache = {} – {weaponDefID = {params}} params contains colour, thickness, length

for weaponDefID, weaponDef in pairs(WeaponDefs) do
if weaponDef.customparams.tracer then
tracerCache[weaponDefID] = loadstring(weaponDef.customparams.tracer)

local roundNumber = {} – {unitID = {weaponNum = roundNum}}
ProjectileCreated(proID, proOwnerID, weaponDefID)
if tracerCache[weaponDefID] then
– problem is determining which weapon fired if unit has multiple copies of one weapon
– e.g. aircraft we want tracers to be per gun, not per weaponDef
local weaponNum = magic()
if not roundNumber[unitID] then roundNumber[unitID] = {} end
local roundNum = roundNumber[unitID][weaponNum] or 1
if roundNum == 5 then – customparam this later too
AddToSendToUnsyncedCache(proID, tracerCache[weaponDefID]) – creation calls are batched to reduce synced->unsynced communication
roundNumber[unitID][weaponNum] = 0
roundNumber[unitID][weaponNum] = roundNumber[unitID][weaponNum] + 1

I think doing it from the unit script’s Shot() callin is your best way for getting the weapon fired.
Batching may be slightly more difficult, but it’s probably possible.

The problem is that Shot() doesn’t know the projectile ID… The LUS could set a rulesparam or some other synced message to communicate the most recently fired weapon… that will work if the order of execution doesn’t result in anything awful happening, which it might. Alternatively the gadget could use GetUnitWeaponInfo to look at reload frames and see which one had just fired (like ammo gadget) but it is possible for 2 weapons to fire in the same frame, basically the same problem as above.