Single-hit noncolliding weapon | projectileID in unitDamaged

Single-hit noncolliding weapon | projectileID in unitDamaged

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Single-hit noncolliding weapon | projectileID in unitDamaged

Post by Anarchid »

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?
Last edited by Anarchid on 21 Mar 2013, 15:13, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Single-hit noncolliding weapon | projectileID in unitDam

Post by smoth »

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.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Single-hit noncolliding weapon | projectileID in unitDam

Post by Anarchid »

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.
... 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.

It also will likely look uglier due to snapping, so still worse than doing it in lua completely.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Single-hit noncolliding weapon | projectileID in unitDam

Post by Anarchid »

Shameless self bump from out of unabridged insolence.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Single-hit noncolliding weapon | projectileID in unitDam

Post by Anarchid »

Thank you very much!

(maybe wants a ! in the release log though, because shifts attacker parameters, which could break some scripts)
Post Reply

Return to “Feature Requests”