Page 2 of 2
Posted: 29 Jul 2007, 19:47
by FLOZi
break is generally seen as a bad way of programming.
Posted: 29 Jul 2007, 21:16
by imbaczek
omg since when? knuth didn't like goto, but break...?
Posted: 29 Jul 2007, 21:18
by FLOZi
If you have to break out of a loop that generally means either;
The condition for the loop is flawed.
or
you're forcing your way out of an infinite loop, which implies that the condition for the loop is flawed.
Posted: 29 Jul 2007, 22:55
by rattle
Code: Select all
while (true) break;
if (true) {
this=that;
break;
that=this;
}
for (a=0; a < 10; ++a) {
if (a == 5) break;
}
Break does have it's uses, i.e. if you go through a list (or an array) to find a member of it and then want to literally break out of the loop (not the function, break doesn't work like that) instead of going through all the remaining elements. Or switch, which Cavedog should have added to COB, ffs. :P
Posted: 30 Jul 2007, 05:29
by manored
How about making falling units health bars to not go crazy and anyoing then they are falling too? :)
Also, why stop at aircraft? Death animations for ships and big ground units would be cool too :)
Posted: 30 Jul 2007, 05:50
by Peet
Death animations for everything else are easily scripted; the only reason the aircraft one is there is because it is not possible to implement through the script.
Posted: 30 Jul 2007, 06:07
by j5mello
isn't that what Killed() is for???? (the uber death anims for surface units)
Posted: 30 Jul 2007, 06:11
by Peet
Precisely.
Posted: 30 Jul 2007, 08:34
by yuritch
Ok,
here is the patch. I cannot test it now as I made it at work (and my boss won't understand why I need to start something that looks surprisingly like a game on a workstation), so if somebody could compile and test it, please do so.
Basically it introduces a new set/get constant, CRASHING (96).
returns 1 for a crashing plane, 0 otherwise.
starts a plane's crashing sequence. I'm not sure whether
will abort it or not.
Posted: 30 Jul 2007, 08:55
by Argh
Yay!
Posted: 30 Jul 2007, 18:39
by Snipawolf
Oh yeah baby!
Flinging part off, emit-sfx, and more!
Posted: 30 Jul 2007, 21:49
by manored
Now how about pilot kbots jumping off the cockpit? :)
Posted: 30 Jul 2007, 21:55
by Neddie
manored wrote:Now how about pilot kbots jumping off the cockpit? :)
Spawning a new unit using LUA, then animating a fall of it, unhiding the real one when it hits earth.