SlashCo Wiki

SlashCo.SelectSpawnsNoForce

 Entity or table<Entity>, number SlashCo.SelectSpawnsNoForce( table<Entity> elements, number amount = 1, function conditions = SlashCo.DefaultConditions, boolean forceTable = false )

Description

Selects a number of spawns from a sequential table using weighted random selection.
Selected entries are removed from consideration so the same entry cannot be selected twice.
When amount is 1, a single element is returned unless forceTable is enabled.
When amount is greater than 1, a table of selected elements and the number of missed entries are returned.

Arguments

1table<Entity> elements

Sequential table of spawn entities

2number amount = 1

Number of entries to select

3function conditions = SlashCo.DefaultConditions

Optional function used to determine which entries can be selected

4boolean forceTable = false

If true, always returns the selected entries as a table and the number of missed entries

Returns

1Entity or table<Entity> selected

Selected entity when amount is 1 and forceTable is false, otherwise a table of selected entities

2number missed

Number of requested entries that could not be selected when returning a table