Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: zonination on April 01, 2021, 07:43:20 am

Title: Messages being sent from Command, despite being sent from an in-field ship?
Post by: zonination on April 01, 2021, 07:43:20 am
Here are some screenshots of these errors, plural (https://imgur.com/a/n396xfn). (imgur link, sorry)
Hey fellow FREDders. I'm working on one of my first missions (as if that's not a red enough flag).

But I've tried everything. Delaying the message time; fine tuning it; right-clicking > replace data > selecting the ship again and again and playing the mission over and over and over...

The only thing I've concluded MIGHT be (MIGHT be) the problem: is that the field of battle either has:

Since the problematic ships in question were added later in the game (in a cargo depot, and a lot of waypoints), I suspect it might be "too many ships", but I'm wondering how I would go about fixing this issue.
Title: Re: Messages being sent from Command, despite being sent from an in-field ship?
Post by: SilverAngelX on April 01, 2021, 07:54:23 am
I had a similar problem in a mission recently and for me the problem was an issue of timing. The evaluation whether or not the ship was in the mission happened a bit too early, when the ship was in fact not yet present. Then the ship appeared, but the message was already given to Command instead. So, I changed the SEXPs a bit so that the event was triggered separately which made the engine recognize that the ship was already there.

You could try to make that message event dependent on the arrival of said ship to make sure that the engine knows it's there before it tries to send the message.
Title: Re: Messages being sent from Command, despite being sent from an in-field ship?
Post by: General Battuta on April 01, 2021, 07:59:39 am
This will sound dumb but I just want to be 100% certain: there's no chance Gamma 1 has exploded by this point is there
Title: Re: Messages being sent from Command, despite being sent from an in-field ship?
Post by: zonination on April 01, 2021, 08:13:33 am
This will sound dumb but I just want to be 100% certain: there's no chance Gamma 1 has exploded by this point is there

That is correct. Gamma 1 has not exploded, there is no remaining hostiles in the field, and she is at full hull integrity as can be seen in the lower left corner.


EDITED TO ADD:
I had a similar problem in a mission recently and for me the problem was an issue of timing. The evaluation whether or not the ship was in the mission happened a bit too early, when the ship was in fact not yet present. Then the ship appeared, but the message was already given to Command instead. So, I changed the SEXPs a bit so that the event was triggered separately which made the engine recognize that the ship was already there.

You could try to make that message event dependent on the arrival of said ship to make sure that the engine knows it's there before it tries to send the message.

The event for Gamma wing entering is triggered by the "ReliefArrives" SEXP. Same with the Ace. I've is-event-true-delay (-ed) the wing's arrivals by 0 seconds, 3 seconds, 5 seconds, with no change in results. Or are you talking about the other way around?
Title: Re: Messages being sent from Command, despite being sent from an in-field ship?
Post by: Mito [PL] on April 01, 2021, 09:15:01 am
I have met a similar curiosity some time ago. Turns out that if you use send-message-list and one of the ships that are supposed to send messages has not yet arrived when the SEXP is triggered, even if they are in mission when their message itself is being played, the message will act like they were never there (therefore its sender will default to Command). Maybe you could verify if that isn't the case somehow.
Title: Re: Messages being sent from Command, despite being sent from an in-field ship?
Post by: zonination on April 01, 2021, 09:30:20 am
You could try to make that message event dependent on the arrival of said ship to make sure that the engine knows it's there before it tries to send the message.

MY GOD. THIS HAS BEEN HAUNTING MY NIGHTMARES AND IT FINALLY WORKED.

For the record, here's what I did:

I can finally continue with my awful mission. But why do chains not work? I have a freighter (the Menes) that works in a previous chain, and is communicating just fine with the Ace.

Oh well. I de-linked the dependency and I'm much more happy with the results.

I have met a similar curiosity some time ago. Turns out that if you use send-message-list and one of the ships that are supposed to send messages has not yet arrived when the SEXP is triggered, even if they are in mission when their message itself is being played, the message will act like they were never there (therefore its sender will default to Command). Maybe you could verify if that isn't the case somehow.

The mission is already timed such that the wing/ship arrives before the send-message-list (or at the same time). I don't understand why de-chaining it worked, but it did.

For the record, the way I have it: the Ace warps in, and then the send-message-list starts.
Title: Re: Messages being sent from Command, despite being sent from an in-field ship?
Post by: 0rph3u5 on April 01, 2021, 09:32:00 am
Workaround for an immediate fix could be to use a string variable for sender's ID in the SEXP, with the a # added in the default value for any message to be send before the ship arrives and the variable switching over to remove the # when the ship present (or alternatively add it when the ship is dead or departed) - see attachment.
Title: Re: Messages being sent from Command, despite being sent from an in-field ship?
Post by: zonination on April 01, 2021, 10:17:44 am
Workaround for an immediate fix could be to use a string variable for sender's ID in the SEXP, with the a # added in the default value for any message to be send before the ship arrives and the variable switching over to remove the # when the ship present (or alternatively add it when the ship is dead or departed) - see attachment.

I'll file that away in my brain for further FREDding hacks. Thank you!
Title: Re: Messages being sent from Command, despite being sent from an in-field ship?
Post by: SilverAngelX on April 01, 2021, 02:38:49 pm
The mission is already timed such that the wing/ship arrives before the send-message-list (or at the same time). I don't understand why de-chaining it worked, but it did.
You have to be careful with timing your messages to be executed at the same time as an arrival if they don't actually have that arrival as a condition. It could then happen that the event is executed before the arrival (albeit only a few milliseconds) and then the message will got to Command. For that reason I've made it a habit to always add one or two seconds delay between an arrival and an associated message. Even if the arrival is the condition of the event I usually add a few seconds delay, because for lore reasons I find it more natural to give an arrivee a few moments to get a look at the area before they send a message.

I have met a similar curiosity some time ago. Turns out that if you use send-message-list and one of the ships that are supposed to send messages has not yet arrived when the SEXP is triggered, even if they are in mission when their message itself is being played, the message will act like they were never there (therefore its sender will default to Command). Maybe you could verify if that isn't the case somehow.
That was my problem too. The ship arrived during the message list but wasn't there at the start of the event. So it appears the message-list SEXP checks if all required ships are present for all messages at the start of the event and not for each message when it is due.
Title: Re: Messages being sent from Command, despite being sent from an in-field ship?
Post by: zonination on April 01, 2021, 02:58:57 pm
The mission is already timed such that the wing/ship arrives before the send-message-list (or at the same time). I don't understand why de-chaining it worked, but it did.
You have to be careful with timing your messages to be executed at the same time as an arrival if they don't actually have that arrival as a condition. It could then happen that the event is executed before the arrival (albeit only a few milliseconds) and then the message will got to Command. For that reason I've made it a habit to always add one or two seconds delay between an arrival and an associated message. Even if the arrival is the condition of the event I usually add a few seconds delay, because for lore reasons I find it more natural to give an arrivee a few moments to get a look at the area before they send a message.

Hey question... in this SEXP (https://i.imgur.com/uFsWxb2.png) (among others) I had triggered Gamma's arrival to ReliefArrives. They had 3000ms to saddle up and start talking.

So... why didn't they? Why did I have to do it in reverse: slave an event to Gamma wing's arrival instead?
Title: Re: Messages being sent from Command, despite being sent from an in-field ship?
Post by: Goober5000 on April 01, 2021, 09:55:33 pm
Hey question... in this SEXP (https://i.imgur.com/uFsWxb2.png) (among others) I had triggered Gamma's arrival to ReliefArrives. They had 3000ms to saddle up and start talking.

So... why didn't they? Why did I have to do it in reverse: slave an event to Gamma wing's arrival instead?

Because the sexp checks for the presence of the ship at the moment the sexp is called.  The message doesn't play until 3000ms later, but it's waiting on the queue for the entire 3000ms.