Sequences Helper
The Sequences helper file in SOMA is script/helpers/helper_sequences.hps.
Sequence helpers divide an event function into ordered steps using a cSequenceStatesData object. Sequence_Begin prepares the state check, Sequence_DoStepAndWait runs one step and schedules the next, and Sequence_End resets a sequence after its steps finish. The source warns that the whole sequence function runs again for each step.
Follow the wake-up sequence
The Tau Escape map stores one cSequenceStatesData object for this sequence and uses the sequence function’s own name in Sequence_Begin. Each if / else if condition selects a step. The delay belongs to the step that just ran: 0.25 before the sound step, then 6 before the sequence finishes. Sequence_End completes the state check.
cSequenceStatesData mSeqWakeUp;
void Seq_WakeUp(const tString &in asX)
{
Sequence_Begin("Seq_WakeUp", mSeqWakeUp);
if (Sequence_DoStepAndWait(0.25))
{
Effect_Fade_Out(0);
}
else if (Sequence_DoStepAndWait(6.0))
{
Effect_Fade_In(5);
Sound_CreateAtEntity("WakeUp", "04_03_tau_escape/SFX/wake_up_sweet", "Player");
}
Sequence_End();
}
This example is shortened from the stock Tau Escape sequence to demonstrate a fade-out followed by a sound and fade-in. Its wake-up sound must be available in the mod. The whole function is called again for each step, so code outside the step conditions also runs again.
Include and adapt
- Include
helpers/helper_sequences.hpsalongside the helpers needed by the actions in your sequence. - Keep a separate
cSequenceStatesDataobject for the sequence and pass it toSequence_Begin. - Put each action inside a
Sequence_DoStepAndWaitcondition, keeping theif / else ifchain and the finalSequence_End().