Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: LoneKnight on August 10, 2011, 12:44:48 pm

Title: Events After Completion of Event
Post by: LoneKnight on August 10, 2011, 12:44:48 pm
I've been wracking FRED to determine if there is a way to trigger an event AFTER another event is completed. The main reason for this is if I play a sound track from play-from-file, the only way to make the song repeat is by adding a delay that is the exact amount of second that the song is. If the Player pauses at any time, the sound keeps playing, and this count is thrown off. There will be time of no music.

So, can events trigger AFTER a certain event is COMPLETE, not just true-delay?
Title: Re: Events After Completion of Event
Post by: headdie on August 10, 2011, 12:48:59 pm
set up the event like normal and position a second event under the first which has the triggers and results for the second stage of the event, then with the second event selected check the chain box and if needs be set the delay and there you go
Title: Re: Events After Completion of Event
Post by: mjn.mixael on August 10, 2011, 12:59:48 pm
If you have a branch (Can't do a chain) you can use

Not
--Is-event-false
Title: Re: Events After Completion of Event
Post by: LordPomposity on August 10, 2011, 01:02:49 pm
I don't think chaining would work any better than event-true-delay here. I don't think there's any sexp to check when a sound has finished playing.

However, there is an easy way to do what you're trying to do. Right-click on the play-sound-from-file operator, click "add data," and set the new line to any non-zero number. The soundtrack will now loop.
Title: Re: Events After Completion of Event
Post by: LoneKnight on August 10, 2011, 02:19:40 pm
I don't think chaining would work any better than event-true-delay here. I don't think there's any sexp to check when a sound has finished playing.

However, there is an easy way to do what you're trying to do. Right-click on the play-sound-from-file operator, click "add data," and set the new line to any non-zero number. The soundtrack will now loop.

Boom. Genius! Worked perfectly. :D
Title: Re: Events After Completion of Event
Post by: karajorma on August 10, 2011, 08:10:37 pm
If you're ever in a situation where you can't just loop the sound (a SEXP that doesn't loop for instance) the solution would be to use the mission-time-msecs SEXP to determine when a certain number of milliseconds have passed since the event started.
Title: Re: Events After Completion of Event
Post by: FelixJim on August 11, 2011, 05:15:10 pm
If you're ever in a situation where you can't just loop the sound (a SEXP that doesn't loop for instance) the solution would be to use the mission-time-msecs SEXP to determine when a certain number of milliseconds have passed since the event started.
He suggested that in his opening post, but pointed out that this wouldn't work if the player paused at any point, as pausing doesn't affect music (you'd encounter a similar problem with time compression, come to think of it).
Title: Re: Events After Completion of Event
Post by: karajorma on August 11, 2011, 10:02:41 pm
Yeah, that's cause sounds don't pause when the game is paused. But for anything else that does pause the solution would work.
Title: Re: Events After Completion of Event
Post by: Droid803 on August 11, 2011, 10:11:01 pm
I've been wracking FRED to determine if there is a way to trigger an event AFTER another event is completed. The main reason for this is if I play a sound track from play-from-file, the only way to make the song repeat is by adding a delay that is the exact amount of second that the song is. If the Player pauses at any time, the sound keeps playing, and this count is thrown off. There will be time of no music.

So, can events trigger AFTER a certain event is COMPLETE, not just true-delay?

WROOOOOOOONG


the play-sound-from-file has an optional second argument, set it to a non-zero number to repeat the track
use it.
:rolleyes:



EDIT:

looks like because i'm blind i'm late.
sue me