I am assuming the reason you are even considering this mod is because of the problem with fast units outrunning explosion damage from regular flak?
If so, I can tell you that while I don't know exactly why this happens, I believe it is because there is a delay in the engine function DamageArea and DamageRing between the time the engine checks the explosion area for all units present and applying the damage. This is an engine problem that can't really be modded. If the engine has a delay in dealing area damage, I doubt a script could remove it (although I could be wrong!). You would most likely find this delay in the time it takes for your script to find all units in the area of effect of your unit/weapon.
However I can tell you that there is a(n approximate) formula (depending on physical in game factors) to determine if a unit will outrun the engine-driven explosion damage:
if DamageRadius/2 >= UnitSpeedAtInstantofExplosion/10 then damage will be dealt, otherwise the unit will outrun the damage.
This is why SAMs were given a damage radius of 1.5 by FAF, because spy planes have a max speed of 30 units. Therefore:
1.5*2==30/10.
Before this was figured out, FA made SAMs have no damage radius because weapons with no damage radius deal damage the same tick that Damage is called.
You or others on this forum may already know this, but I figured it was appropriate to post here so new modders could see how it worked.
Edit: It appears I misunderstood you, you meant you wanted a unit that
only hit the
x closest units in range, even if more units were in range of the explosion. That wouldn't be difficult. You could probably create a custom function in defaultprojectile.lua and do something like this:
- Code: Select all
function LimitedChainExplosionDamage(<parameters>)
for i,j in units do
<damage code>
if i == x then break
end
end,
That isn't exactly what you'd paste, or where you'd paste it, but that is the essence of what you are looking for. It would deal damage to the first x number of units in the area then stop. To do that based on distance would be more complicated but obviously still possible.
Typical Voodoo Edition Map Dialog:
Master_lee wrote:Varaxis ist loser vote all my maps 1 !!! he cant make maps noob go home !!!!!!
Padfoot141 wrote:Terrible map. Spawn with 6 commanders and there are civillians with fatboys.
Master_lee wrote:Padfoot141 go home loser ! go play thermo !