Author Topic: Help with destroyed-or-departed-delay  (Read 3237 times)

0 Members and 1 Guest are viewing this topic.

Help with destroyed-or-departed-delay
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.

 

Offline vyper

  • 210
  • The Sexy Scotsman
Help with destroyed-or-departed-delay
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?)
"But you live, you learn.  Unless you die.  Then you're ****ed." - aldo14

 
Help with destroyed-or-departed-delay
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.

 

Offline vyper

  • 210
  • The Sexy Scotsman
Help with destroyed-or-departed-delay
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
"But you live, you learn.  Unless you die.  Then you're ****ed." - aldo14

 

Offline Cetanu

  • 27
    • http://165thbdhr.com/
Help with destroyed-or-departed-delay
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 )
)
Work is the curse of the drinking class
Keeper of BDHR's Holy Grail of Beer

Valid PXO/F2NETD multiplayer missions - mirrors: 1,2
Additional valid F2NETD multiplayer missions - mirrors: 1,2
Voicefiles for these missions - mirrors: 1,2

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
Help with destroyed-or-departed-delay
Ahhhhhhummmmmm..... I never knew that.
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 
Help with destroyed-or-departed-delay
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?

 

Offline Cetanu

  • 27
    • http://165thbdhr.com/
Help with destroyed-or-departed-delay
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
Work is the curse of the drinking class
Keeper of BDHR's Holy Grail of Beer

Valid PXO/F2NETD multiplayer missions - mirrors: 1,2
Additional valid F2NETD multiplayer missions - mirrors: 1,2
Voicefiles for these missions - mirrors: 1,2

 

Offline DTP

  • ImPortant Coder
  • 28
    • http://www.c4-group.dk
Help with destroyed-or-departed-delay
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.

:).
VBB member; reg aug 1999; total posts 600.
War is a lion, on whos back you fall, never to get up.
Think big. Invade Space.

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
Help with destroyed-or-departed-delay
I thought it was the process of departure that triggered it. Hence -departed-delay and not is-present-delay.
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 
Help with destroyed-or-departed-delay
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.

 

Offline Cetanu

  • 27
    • http://165thbdhr.com/
Help with destroyed-or-departed-delay
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
Work is the curse of the drinking class
Keeper of BDHR's Holy Grail of Beer

Valid PXO/F2NETD multiplayer missions - mirrors: 1,2
Additional valid F2NETD multiplayer missions - mirrors: 1,2
Voicefiles for these missions - mirrors: 1,2

 
This solves my problem. Initially, the Ravana was not present. Thanks. :yes:

  

Offline Cetanu

  • 27
    • http://165thbdhr.com/
Help with destroyed-or-departed-delay
glad that I could help :)
Work is the curse of the drinking class
Keeper of BDHR's Holy Grail of Beer

Valid PXO/F2NETD multiplayer missions - mirrors: 1,2
Additional valid F2NETD multiplayer missions - mirrors: 1,2
Voicefiles for these missions - mirrors: 1,2