Single-hit noncolliding weapon | projectileID in unitDamaged
Posted: 07 Mar 2013, 18:28
It has always been so that non-colliding weapons damaged units a number of times, depending on victim's collision volume, orientation of such volume, vector of attack, and possibly more - like, whether projectile also bounced against ground and lost some speed, proceeding to spend additional time inside the colvol space.
There should, in my humble opinion, exist a way to create a single-hit noncolliding weapon.
An obvious idea towards making this a bit closer, is, of course, Lua. A few basic approaches have been suggested, some tried:
1) Handling projectiles - tracking 'single-hit' weapons via SetWatchWeapon, registering the projectiles on ProjectileCreated, and then remembering each victim in a table on UnitPreDamaged. This doesn't work: UnitPreDamaged does not report the projectile ID.
Some logic might be used to circumvent this, but all approaches i imagined have glaring flaws such as not allowing multiple singlehit weapons per unit, or not allowing multiple projectiles from one unit to be in air at the same time.
2) Reimplementing collision checks in lua and doing a projectile interpolation all on script's own. This has a few obvious drawbacks, not the least of which having to handle each collision volume type. In short, it's an ugly hack - and it doesn't even come into "what if i have per-piece colvols".
3) Doing some imaginative juggling of projectiles mid-air - such as using a not-really-noncolliding projectile, but respawning it on each Explosion; doing zero-damage projectile that spawns multiple Explosions to let the script somehow group the victims, etc. As imaginative as those are, they also fail just as badly.
TL:DR: can we please have a single-hit tag for not having to hack around so much, or at least a projectileID in unitDamaged / unitPreDamaged callbacks so that it's lua'ble without too much hassle?
There should, in my humble opinion, exist a way to create a single-hit noncolliding weapon.
An obvious idea towards making this a bit closer, is, of course, Lua. A few basic approaches have been suggested, some tried:
1) Handling projectiles - tracking 'single-hit' weapons via SetWatchWeapon, registering the projectiles on ProjectileCreated, and then remembering each victim in a table on UnitPreDamaged. This doesn't work: UnitPreDamaged does not report the projectile ID.
Some logic might be used to circumvent this, but all approaches i imagined have glaring flaws such as not allowing multiple singlehit weapons per unit, or not allowing multiple projectiles from one unit to be in air at the same time.
2) Reimplementing collision checks in lua and doing a projectile interpolation all on script's own. This has a few obvious drawbacks, not the least of which having to handle each collision volume type. In short, it's an ugly hack - and it doesn't even come into "what if i have per-piece colvols".
3) Doing some imaginative juggling of projectiles mid-air - such as using a not-really-noncolliding projectile, but respawning it on each Explosion; doing zero-damage projectile that spawns multiple Explosions to let the script somehow group the victims, etc. As imaginative as those are, they also fail just as badly.
TL:DR: can we please have a single-hit tag for not having to hack around so much, or at least a projectileID in unitDamaged / unitPreDamaged callbacks so that it's lua'ble without too much hassle?