Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Zacam on June 13, 2009, 11:07:34 pm

Title: Fixing SM2-08 {Solved}
Post by: Zacam on June 13, 2009, 11:07:34 pm
Retail SM2-08 causes a Sexp Overflow.

I'm working on trying to fix it, and maybe my approach is overly complicated.

First, I fixed the breaking debrief with the following:
Code: [Select]
$Formula: ( and
   ( is-event-true-delay
      "Killed A Turret"
      0
   )
   ( is-event-true-delay "All Good" 0 )
)

And added a new event "Killed A Turret":
Code: [Select]
$Formula: ( when
   ( is-event-true-delay
      "Any Turrets 1"
      0
   )
   ( or
      ( is-event-true-delay
         "Any Turrets 2"
         0
      )
      ( is-event-true-delay
         "Any Turrets 3"
         0
      )
      ( is-event-true-delay
         "Any Turrets 4"
         0
      )
   )
   ( do-nothing )
)
+Name: Killed A Turret
+Repeat Count: 1
+Interval: 1

In each of the referenced events "Any Turrets #" (1-4) I split up the 52 "( is-subsystem-destroyed-delay "Sathanas"  "turret##" 0 )" into groups of 13.

I need to set up each of these events so that destroying the subsystem only validates the event IF it also happens with "( is-event-true-delay "However" 0 )"

Example (does not work):
Code: [Select]
I are a moron. See below.

Working Code:
Code: [Select]
$Formula: ( when
( and
( or
( is-subsystem-destroyed-delay
"Sathanas"
"turret02"
0
)
( is-subsystem-destroyed-delay
"Sathanas"
"turret03"
0
)
)
( is-event-true-delay
"However"
0
)
)
( do-nothing )
)
+Name: Any Turrets 1
+Repeat Count: 1
+Interval: 1
Title: Re: Fixing SM2-08 {Solved}
Post by: karajorma on June 14, 2009, 02:33:47 am
I take it that the reason for the complications are due to you wanting this to still work with Retail FS2, right?
Title: Re: Fixing SM2-08 {Solved}
Post by: Zacam on June 14, 2009, 03:06:08 am
Correct. Hence why, upon discover of the losution, I posted a fied Retail copy.

It is also committed to the FSU SVN for the MediaVP version.

I could have avoided a lot of headaches by using non-retail sexps, I'm sure.

Sadly, something with the mission is still screwed up. You can still get the Medal of Valor, even if you lose the Maahes.
Title: Re: Fixing SM2-08 {Solved}
Post by: karajorma on June 14, 2009, 04:12:13 am
That's odd. I can't see how that could happen.
Title: Re: Fixing SM2-08 {Solved}
Post by: Zacam on June 14, 2009, 06:13:26 am
Neither can I.

But in testing, both, I lost the Maahes every time, but still got the Medal of Valor.

Re-Edit:
It might be because the following:
Code: [Select]
$Formula: ( when
( and
( is-event-true-delay
"Mission  Accomplished"
0
)
( is-event-true-delay "All Good" 0 )
( not
( is-destroyed-delay 0 "Maahes" )
)
)
( grant-medal "Medal of Valor" )
)
+Name: Medal of Valor
+Repeat Count: 1
+Interval: 1

Should be:
Code: [Select]
$Formula: ( when
( and
( not
( is-destroyed-delay 0 "Maahes" )
)
( is-event-true-delay
"Mission  Accomplished"
0
)
( is-event-true-delay "All Good" 0 )
)
( grant-medal "Medal of Valor" )
)
+Name: Medal of Valor
+Repeat Count: 1
+Interval: 1

Unless I have gotten something totally backwards. Which, since I am not a FREDer by any means is entirely possible.

Triple Edit: I was right. Or something. With the above change, if the Maahes is dostroyed, no Medal. If it is not, you get a medal.

Updated fixed Retail version available here (http://www.hard-light.net/mantis/file_download.php?file_id=37&type=bug).
Title: Re: Fixing SM2-08 {Solved}
Post by: karajorma on June 14, 2009, 09:18:58 am
:wtf:

There's no way that should happen. The order of arguments in an AND SEXP shouldn't have the slightest effect on the outcome.

I'm going to have to take a long look into this one.
Title: Re: Fixing SM2-08 {Solved}
Post by: Mobius on June 14, 2009, 05:39:03 pm
:wtf:...?

Is this issue potentially connected to the build you're using? Everything should be fine with those conditionals and SEXPS...
Title: Re: Fixing SM2-08 {Solved}
Post by: FUBAR-BDHR on June 14, 2009, 05:41:52 pm
Everything but the length.  It's too long for the engine to handle it was just never caught until a check for the length going over the limit was implemented.