The newNpcChildGroup native AI script function is used to create a dynamic NPC group with a parent/children relation defined. There are four versions of this function available, depending on the desired output values.
(Group: c) newNpcChildGroup(GroupTemplate: s, StateMachine: s, Zone: s) // newNpcChildGroup_sss_c
() newNpcChildGroup(GroupTemplate: s, StateMachine: s, Zone: s) // newNpcChildGroup_sss_
(Group: c) newNpcChildGroup(GroupTemplate: s, StateMachine: s, Zone: s, Dispersion: f) // newNpcChildGroup_sssf_c
() newNpcChildGroup(GroupTemplate: s, StateMachine: s, Zone: s, Dispersion: f) // newNpcChildGroup_sssf_
getZoneWithFlags
methods.The return value of the newNpcChildGroup function depends on which version of the function is used:
No return value.
(@grp)newNpcChildGroup("class_forager", "state_machine_1", $zone);
This example code calls the newNpcChildGroup
function with a template NPC group name, a state machine name, and a zone, and returns the newly created NPC group.
()newNpcChildGroup("class_forager", "state_machine_1", $zone, 10);
This example code calls the newNpcChildGroup
function with a template NPC group name, a state machine name, a zone, and a dispersion radius, and creates a new NPC group.