Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Cuttenslise on December 10, 2002, 03:24:30 am

Title: Help with destroyed-or-departed-delay
Post by: Cuttenslise on December 10, 2002, 03:24:30 am
Note that this is a re-starting of a previous thread. I have asked for the previous thread to be closed as it is far too confusing.

I have just spent four hours this weekend attempting to debug a FRED 2 mission, and the reason for it not working was because destroyed-or-departed-delay was not working the way I though it would. I thought that it would work like this:

Or
- Is-Destroyed-Delay
Ship X
0
- Has-Departed-Delay
Ship X
0

which is what you would expect from the description. However, in all cases that I tested, the above Or sexp returned a value of true when it should have done, when destroyed-or-departed-delay did the square root of naff all (Replace with suitable swearword).

PhReAk says that it works, but it didn't for me.
Title: Help with destroyed-or-departed-delay
Post by: vyper on December 10, 2002, 06:21:39 am
I will explain the sexp only:

If the ship in question is destroyed, a value of TRUE is returned. If the ship departs, then a value of TRUE is returned.

Breakdown:
First, is-destroyed: A ship has lost all hull integrity, and the engine considers it "destroyed".
Second, departed: The ship has "warped" off the battlefield
Thirdly: If EITHER of these conditions is met, a value of true is returned.


ergo: destroyed-or-departed-delay

Now, can I ask what u are actually doing in the mission with this? :) (Shouldn't this be  Modding?)
Title: Help with destroyed-or-departed-delay
Post by: Cuttenslise on December 10, 2002, 08:23:29 am
Thanks for the reply. Firstly, you may be right - I don't know where this thread belongs. If it doesn't belong here, maybe an administrator will move it.

Regarding the sexp, the purpose was to check to see if there were any ships remaining in the area. When clear of the area, a ship exists in one of three states.

Not Arrived (i.e. it never entered the engagement)
Destroyed
Departed.

Therefore, for the ship to be clear of the combat zone, one of these must be true.

Therefore, the sexp

Or
-destroyed-or-departed-delay
--Ship X
--0
 
-not
--has-arrived-delay
---0
---Ship X

Should return true when any of the above conditions are met.

(Note - the syntax may not be perfect - I don't have my reference cards to hand.)

AND the above sexps together for every ship or wing, and you have the test.

This never returned true when I used destroyed-or-departed-delay, but the Or sexp that I used to replace destroyed-or-departed-delay (from my first post) worked within the above sexp every time.
Title: Help with destroyed-or-departed-delay
Post by: vyper on December 10, 2002, 02:56:19 pm
Suddenly I see your problem, and I think you actually might be better off in the source code section since a programmer might take a quick glance at the code for this sexp. Afraid you'll have to wait till a greater mortal than myself looks at this, because I don't see why it won't work. :D
Title: Help with destroyed-or-departed-delay
Post by: Cetanu on December 10, 2002, 09:15:54 pm
the "departed" part gets true whenever the ship is not around - so even when the ship hasn't arrived yet!

so any event like:
( when
   ( destroyed-or-departed-delay
      0
      "testship"
   )
   ( whatever )
)

will turn true right after the mission started

to prevent this either make it a chained event, where the previous only gets executed when the ship in question is already around for sure

or like
( when
   ( and-in-sequence
      ( has-arrived-delay 0 "testship" )
      ( destroyed-or-departed-delay
         0
         "testship"
      )
   )
   ( whatever )
)
Title: Help with destroyed-or-departed-delay
Post by: Galemp on December 10, 2002, 10:22:45 pm
Ahhhhhhummmmmm..... I never knew that.
Title: Help with destroyed-or-departed-delay
Post by: Cuttenslise on December 11, 2002, 03:30:41 am
Um, it didn't work for me.

In what I was attempting to do, I would not have minded if destroyed-or-departed-delay returned true if the ship had not arrived; this is actually beneficial because it means that you do not require to test if the ship has arrived with has-arrived-delay. My problem is that the statement destroyed-or-departed-delay never appeared to return true, even if the ship was destroyed or had departed.

Nobody else appears to have experienced this?
Title: Help with destroyed-or-departed-delay
Post by: Cetanu on December 11, 2002, 11:17:03 am
maybe you made it part of another check that didn't get true or false? hard to tell without seeing the other mission events you used
Title: Help with destroyed-or-departed-delay
Post by: DTP on December 11, 2002, 02:23:31 pm
Quote
Originally posted by GalacticEmperor
Ahhhhhhummmmmm..... I never knew that.


it´s all logic

has ship arrived, nope = false

and not false must be true, since neutral does not exist in the world of logic.

and logic is the world of FRED2 SEXP.

:).
Title: Help with destroyed-or-departed-delay
Post by: Galemp on December 11, 2002, 09:32:20 pm
I thought it was the process of departure that triggered it. Hence -departed-delay and not is-present-delay.
Title: Help with destroyed-or-departed-delay
Post by: Cuttenslise on December 12, 2002, 05:10:04 am
Quote
maybe you made it part of another check that didn't get true or false?


It was initially, but the problem was frustrating me so much that eventually I tried monitoing just two ships.

The sexp looked like this

when
 - And
 - - destroyed-or-departed-delay
 - - - Ship X
 - - - 0
 - - destroyed-or-departed-delay
 - - - Ship Y
 - - - 0
 - send message
 - - etc.
 - Error

Kept very simple to test the expression.

The ships that were being monitored (A Juggernaut and Ravana, they were both very hard to miss) were destroyed, but no message and error. I also tested it by letting the ships depart, but again no message or error.
Title: Help with destroyed-or-departed-delay
Post by: Cetanu on December 12, 2002, 05:52:37 am
this sexp only triggers to your liking if both are already around when the mission starts

if one arrives later try my suggested check using and-in-sequence
Title: Answered
Post by: Cuttenslise on December 24, 2002, 03:13:02 am
This solves my problem. Initially, the Ravana was not present. Thanks. :yes:
Title: Help with destroyed-or-departed-delay
Post by: Cetanu on December 24, 2002, 03:41:37 am
glad that I could help :)