Source Code Project Mantis - FSSCP
View Issue Details
0001870FSSCPgameplaypublic2009-01-14 15:442012-01-09 13:07
Assigned ToGoober5000 
StatusresolvedResolutionno change required 
PlatformDELL Dimension 9200OSWindows VistaOS VersionUltimate 32-bit
Product Version 
Target VersionFixed in Version 
Summary0001870: Sometimes, hits-left is not evalued before the ship is destroyed.
DescriptionI think there's some kind of issue with this SEXP.

Warzone 6th mission. (I upload it). (Although I haven't tried, you should be able to use it with retail data, because Warzone only has one -shp.tbm used to add GTE Vidar which is not used in this mission).

SC Guari (a SC Raksasha), has the following arrival cue:

--Comm Node

After both initial SC Cains are destroyed, the Shivan Comm-Node gets heavily bombarded and beamed by allied forces. Then, approximately in about 25% of the mission runs, this SEXP is not evaluated before the Shivan Comm is destroyed and the SC Guari never arrives, breaking the mission.
TagsNo tags attached.
Attached Files? WarzoneE1M6.fs2 (89,905) 2009-01-14 15:44
? Hits_left_test.fs2 (6,255) 2009-01-15 10:27

2009-01-14 20:06   
Try the next nightly, the sexp was bailing if the ship was destroyed. I just had it return 0.
2009-01-14 22:37   
(Last edited: 2009-01-15 11:03)
I wonder why it was originally decided that you can't evaluate it when the ship has been destroyed. Seems like it should have been an obvious 0 all along if that works.

2009-01-14 23:08   
No idea, but it may also be an oversight on the mission designer

- or
   - is-destroyed-delay
      - 0
      - Comm Node
   - <
      - hits-left
         - Comm Node
      - 12
2009-01-15 10:25   
(Last edited: 2009-01-15 13:00)
Ok, I'll test it ASAP

OTOH, hits-left-subsystem is also buggy. It also doesn't return 0 for destroyed ships.

(I upload a test mission where you can bomb or laser to death two Cains. hits-left test is enabled for both at < 5%. Also "Bomb me" engine is tested at < 80% (this test training message is delayed 5 seconds)).

Nevertheless, although I really think that this is a TRUE bug because a destroyed ship does have 0 hits left in both its hull and its subsystems, maybe this fix can break old missions which were made without thinking about it. SCP crew should discuss about it...

A possible example. You have to weaken Comm below 20 while keeping your targe alive. Now there's no need for an additional check about if the ship has been destroyed or not. A destroyed ship wouldn't trigger the hits-left-subsystem (Comm) < 20 check.

Maybe, although both SEXPs are buggy in strict sense, the best thing to do is leaving them untouched. I would just add a warning in their FRED help text, telling the FREDer that they are not evaluated for destroyed ships. (A good FREDer could always fix his missions with phreak's coding).

EDITED -----

As expected, 5039 makes hits-left=0 for destroyed ships. But as told above, really wanted?

2009-01-17 19:35   
That's an interesting question.
2009-01-17 22:57   
Okay. Well, first we have coding precedent across nearly every sexp in the code (both retail and FSO) that deal with ships. And that precedent is to return NAN_FOREVER if the ship is destroyed or departed. This applies to shields-left, hits-left-subsystem, is-ship-visible, and many other sexps. It may trigger a double take in certain situations (such as hits-left when a ship is destroyed, as mentioned here) but it is well-defined and it's consistent.

So I'm declaring this as a mission bug and not a code bug. I'm reverting the "fix" and marking this ticket as "no change required".

Issue History
2009-01-14 15:44ARSPRNew Issue
2009-01-14 15:44ARSPRFile Added: WarzoneE1M6.fs2
2009-01-14 20:06phreakNote Added: 0010527
2009-01-14 20:07phreakStatusnew => assigned
2009-01-14 20:07phreakAssigned To => phreak
2009-01-14 22:37chief1983Note Added: 0010528
2009-01-14 22:37chief1983Statusassigned => feedback
2009-01-14 23:08phreakNote Added: 0010530
2009-01-14 23:08phreakStatusfeedback => assigned
2009-01-15 10:25ARSPRNote Added: 0010533
2009-01-15 10:27ARSPRNote Edited: 0010533
2009-01-15 10:27ARSPRFile Added: Hits_left_test.fs2
2009-01-15 10:45ARSPRNote Edited: 0010533
2009-01-15 10:51ARSPRNote Edited: 0010533
2009-01-15 11:03chief1983Note Edited: 0010528
2009-01-15 13:00ARSPRNote Edited: 0010533
2009-01-17 19:35Goober5000Note Added: 0010539
2009-01-17 22:57Goober5000Note Added: 0010540
2009-01-17 22:57Goober5000Assigned Tophreak => Goober5000
2009-01-17 22:57Goober5000Statusassigned => resolved
2009-01-17 22:57Goober5000Resolutionopen => no change required
2012-01-05 17:55Goober5000Changeset attached => Import 2012-01-05 17:52:05 trunk r5041
2012-01-09 13:07Goober5000Changeset attached => fs2open_websvn trunk r5041