I’d do about this by giving each group note code to store the path (or ID or Name) a random child of that group set via the group container’s rule or edit. Show that information as a Displayed Attribute in the group container (a prototype might make this easier to set up fro several groups at once). The main random agent then collects this value for each group.
So we might make a String attribute SelectedChild
and have this edict (or rule) in Group container notes:
$SelectedChild = $Path(randomChild)
If you wish to ‘lock’ that group, you disable the rule/edict: see its Inspector tab - or make the attribute for that, e.g. $RuleDisabled) a Displayed Attribute for group contains). Now set the desired locked value in the group’s $SelectedChild attribute. The main agent will now keep getting the same contributor from that group’s $SelectedChild until you turn the rule/edict on again.
Conversely, if you want to exclude a group member from the random, add a new Boolean attribute IsExclude
. You can add that as a Displayed Attribute to the prototype(s) for the child notes of your group containers. To exclude a note from the randomiser process, tick its $IsExclude (i.e. set a true
value). Now amend your group container’s edict to:
// get a list of non-excluded child notes' paths
var:list vChildList = collect_if(children,$IsExclude==false,$Path);
// get the number of items in that list
var:number vListSize = vChildListCount;
// get a random list position
var:number vRandomItem = round(rand() * vListSize);
// set selected note
$SelectedChild = $Path(vChildList.at(vRandomItem))
N.B. last not tested (not enough free time) but should work or be close enough to the solution.
HTH