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?
Single-hit noncolliding weapon | projectileID in unitDamaged
Moderator: Moderators
Single-hit noncolliding weapon | projectileID in unitDamaged
Last edited by Anarchid on 21 Mar 2013, 15:13, edited 1 time in total.
Re: Single-hit noncolliding weapon | projectileID in unitDam
We will soon have a way to emit projectiles. So on hit having a shot on hit emit a new shot in the same vector out the back is not beyond possibilities.
Re: Single-hit noncolliding weapon | projectileID in unitDam
... and also requires reimplementing colvol handling in lua to fugure out where the "back" of the unit is - with added load of actual projectiles. That's what i meant with projectile juggling under #3.We will soon have a way to emit projectiles. So on hit having a shot on hit emit a new shot in the same vector out the back is not beyond possibilities.
It also will likely look uglier due to snapping, so still worse than doing it in lua completely.
Re: Single-hit noncolliding weapon | projectileID in unitDam
Shameless self bump from out of unabridged insolence.
Re: Single-hit noncolliding weapon | projectileID in unitDam
Thank you very much!
(maybe wants a ! in the release log though, because shifts attacker parameters, which could break some scripts)
(maybe wants a ! in the release log though, because shifts attacker parameters, which could break some scripts)