Page 1 of 2

Tired Annihilation 0.07 Saboteur Bug

Posted: 21 Aug 2007, 01:04
by bwansy
See for yourself:
Image

What I did:
1. Plant a bomb on a fink (I think it works for any vtol, though)
2. Order the fink to takeoff.
3. Wait...
4. Boom! And that's it.
You can still control it afterwards, as if it's still alive (in fact, it is).

Posted: 21 Aug 2007, 01:11
by SwiftSpear
Does this make the plane invincible?

Posted: 21 Aug 2007, 01:36
by imbaczek
it should die after one shot, I think spring code checks for health <=0 instead of 0.

Posted: 21 Aug 2007, 01:42
by REVENGE
lol That's a bigass red bar right thar. :lol:

Posted: 21 Aug 2007, 02:09
by bwansy
SwiftSpear wrote:Does this make the plane invincible?
No. It's exactly what Baczek said.

Posted: 21 Aug 2007, 13:04
by Foxomaniac
Why would anyone plant a bomb on a fink instead of a juicy fusion anyway O.o.

Cool bug, nonetheless.

Posted: 21 Aug 2007, 13:52
by jK
:roll:

Explanation:
I used Spring.SetUnitHealth to increase the damage of a corroach selfd, so the explosion can kill a krog. The script doesn't not recheck it for and it don't need to (in most cases it works). -> that causes the -xyz% healthbar

But the real problem is that the corroach selfd on the ground and not in the air as it should...
And atm i don't have any idea how to fix it, except that airs planes selfd themselves (->no fancy corroach explosion :()

PS: I said Tired, that the script is still beta. That's why there isn't yet a thread in the Lua forum ...

Posted: 21 Aug 2007, 14:18
by imbaczek
shouldn't selfd effects and damage be set in unit's fbi?

Posted: 21 Aug 2007, 14:28
by jK
the problem is that i can't take selfd for ground units, cause:
1. the bomb would always have a different sizes -> odd
2. some units have a too huge selfd like adv. fusions, krog, ...

that's why i take a corroach and deploy it in the unit and let it selfd -> fancy explosion. but it doesn't always do enough damage on krogs, etc. that's why i reduce manually the health.

But that doesn't work in the air :(

Posted: 21 Aug 2007, 14:31
by imbaczek
mhm. until LuaRules get a explict DoDamage call (instead of just setting health), your best bet is to fake damage somehow ( e.g. create a tiny invisible unit and blow it up), or reduce heath of units in radius just before explosion.

Posted: 21 Aug 2007, 14:43
by trepan
LuaRules can kill units too. Adjust the unit's health,
then DestroyUnit() if the unit's health is <= 0.

Posted: 21 Aug 2007, 14:47
by imbaczek
trepan saves the day, as usual.

Posted: 21 Aug 2007, 14:51
by trepan
This also seems like a good opportunity to try an all-LUA explosion ;-)
Spring.GetUnitsInSphere(), do the damages, send the DestroyUnit()s,
and make a pretty explosion (with a shader, if available)

P.S. At some point, raw weapons access will probably be added to the
lua interface. It isn't a top priority for me at the moment, but it's just of
matter of doing the grind work.

Posted: 21 Aug 2007, 14:55
by jK
imbaczek:
That's what I have done

But the real problem is ....
jK wrote:... that the corroach selfd on the ground and not in the air as it should...
I tried to lift it with Spring.MoveCtrl, but the explosion+damage is still on the ground, only a small (cob) part of the animation (w/o damage) is in the air.

trepan:
DestroyUnit can kill units, but you still can't do damage and raise an UnitDamaged event afterwards ... (though not a probleme here, in general it is)
and as mentioned before, I can't use DestroyUnit cause it always would give another explosion -> very odd

Posted: 21 Aug 2007, 14:58
by trepan
chain explosions -- there's precedence

P.S. You could generate the UnitDamaged() calls yourself.
(I may add a third parameter to SetUnitHealth() to have it
optionally generate UnitDamaged() call-ins, or simply add a
DoDamage() call-out).

Posted: 21 Aug 2007, 15:05
by jK
chain explosions?
that doesn't solve the problem nor does it matter here at all x:

and
P.S. You could generate the UnitDamaged() calls yourself.
how should i raise a luaUI event in luaRules? ...

Posted: 21 Aug 2007, 15:08
by trepan
synced -> unsynced relay
Script.LuaUI.UnitDamaged(...)

I don't see what your problem is with having a lua explosion and
unit death explosions (for those whose health drops enough).
Chain explosions probably wasn't the right example, but having
a projectile explosion effect and a unit's death explosion caused
by the damage is a common sight, no?

P.S. To avoid confusion, by "all-LUA" explosion, I'm talking
about not using a corroach unit to make the bomb's explosion.

Posted: 21 Aug 2007, 15:16
by jK
trepan wrote:synced -> unsynced relay
Script.LuaUI.UnitDamaged(...)
it is (crash) bugged >_>
and iirc, only your widget would recieve it not all ones ...

and atm my problem is/was that I can't raise the corroach explosion into the height. Btw it is not that i don't workaround it (A selfd on planes do it too), nor that it annoys me, it only wonders me ;)

PS: my (nearly finished) LuaParticleSystem can easily extended to an explosion system (only round troughs will be a problem).

Posted: 21 Aug 2007, 15:18
by trepan
1. Post your code so that the crash can be fixed
(preferably with an explanation on how to reproduce the crash)

2. A Script.LuaUI.UnitDamaged() call is sent to all LuaUI widgets that use it.

P.S. My quick test was simply this (needs the cmd_doline gadget):
.luarules urun Script.LuaUI.UnitDamaged(0, 0, 0, 0, false)

Posted: 21 Aug 2007, 15:31
by jK
1. I commited a while ago a version of the morph gadget + a new rank gadget in ca sandbox, which crashs after the usage of Script. and it seems >Maelstrom< found the reason why it does so.

2. I always thought you need to use "Handler:RegisterGlobal()" to catch such events :oops: