Job scheduler, terrain checks, weighted pools
Flying arrivals and hordes internals
Server-side unit delivery. One scheduler owns every flight and every horde, so there is a single place to reason about capacity, cancellation and late joiners.
1. A job
flyingSpawn creates a job in FF_horror_spawnJobs with the payload (existing unit or class to
create), destination ASL, flight timing, effects timing and the controller that owns it. Existing units are hidden and
have simulation disabled while flying; they keep identity, group, variables and loadout. A client call is forwarded to
the server and returns an empty string.
2. The scheduler
spawnTick runs every 0.1 s on the server and does three things:
- Finish or cancel jobs whose end time passed, whose payload died or was taken by a player, or whose controller was stopped.
- Remove the JIP event that lets joining players see active trails once the effect window closed.
- For every running controller: prune dead units, publish counts, and launch at most one unit per pass if the living limit and the 128-job mission cap allow it.
3. Horde state machine
| Key | Meaning |
|---|---|
hordeState | running, paused, stopped or complete (broadcast) |
hordeWave / hordeRemaining | Current wave index and units left to launch |
hordeNext | Earliest server time for the next launch |
hordePool | Validated weighted class list (not broadcast) |
hordeConfig | Normalized options (broadcast for Zeus dialogs) |
hordeUnits / hordeCounts / hordeSkipped | Live units, counts for the footer, failed placements |
Wave 0 means endless. A wave with remaining launches waits for capacity instead of deleting survivors. stop
cancels pending jobs and keeps living units; pause only stops new launches. Edits apply to future launches.
4. Placement and reveal
hordePosition searches around the controller, rejecting water, steep slopes, occupied positions and the
player exclusion radius, and returns an empty array on failure so the controller increments hordeSkipped.
On creation, spawnFinish reveals all living player characters with reveal [player, 4], then
hands the unit to AI balancing. Third-party zombie scripts can read the public FF_horror_spawnPending
variable, because disabling engine simulation does not pause their SQF.
5. Limits
- 32 controllers, 128 pending jobs, 200 living + incoming per controller.
- One launch per controller per scheduler pass, so bursts are spread over frames.
- Arrival cancellation is idempotent: a stopped controller cannot later create its unit.
6. Extension points
spawnConfigto normalize your own option maps;spawnPoolto validate class strings.spawnFXfor custom effects on the client side of the flight.- Zeus dialogs are separate from the API, so a mission can drive hordes entirely from scripts.
Related functions
FF_horror_fnc_flyingSpawn— [unit OR class, destinationASL, options, optional horde controller]. Server returns job IDFF_horror_fnc_hordeControl— Public server API: ["create", centerASL, options] returns controller on server. ["edit"/"pFF_horror_fnc_spawnConfig— Normalize public flying-spawn/horde options. Positions are ASL; radii are metres.FF_horror_fnc_spawnPool— parse "Class=weight,Class=weight" without compiling user input. Returns [flat selectRandomFF_horror_fnc_spawnTick— One server scheduler for all jobs/controllers. At most one launch per horde per tick.FF_horror_fnc_spawnFinish— Server-only completion/cancellation; never called by the effect renderer.