The newNpcChildGroupPos native AI script function is used to create a dynamic NPC group with a parent/children relation based on the provided position.
(Group: c)newNpcChildGroupPos(GroupTemplate: s, StateMachine: s, x: f, y: f) // newNpcChildGroupPos_ssff_c
()newNpcChildGroupPos(GroupTemplate: s, StateMachine: s, x: f, y: f) // newNpcChildGroupPos_ssff_
(Group: c)newNpcChildGroupPos(GroupTemplate: s, StateMachine: s, x: f, y: f, Dispersion: f) // newNpcChildGroupPos_ssfff_c
()newNpcChildGroupPos(GroupTemplate: s, StateMachine: s, x: f, y: f, Dispersion: f) // newNpcChildGroupPos_ssfff_
The return values of the newNpcChildGroupPos function depend on which version of the function is used:
These functions does not return a value.
()newNpcChildGroupPos("class_forager", "state_machine_1", x, y);
This example code calls the newNpcChildGroupPos function with a GroupTemplate of "class_forager", a StateMachine of "state_machine_1", and an x and y position to spawn the group at.
(@grp)newNpcChildGroupPos("class_forager", "state_machine_1", x, y, 30);
This example code calls the newNpcChildGroupPos function with a GroupTemplate of "class_forager", a StateMachine of "state_machine_1", an x and y position to spawn the group at, and a dispersion radius of 30 meters. It then returns the newly created group as a value.