-
Notifications
You must be signed in to change notification settings - Fork 94
new_npc_child_group
Ryzom Core Wiki edited this page Jul 8, 2024
·
5 revisions
title: New NPC Child Group description: published: true date: 2023-03-16T23:08:48.522Z tags: editor: markdown dateCreated: 2023-03-16T22:25:54.741Z
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_
- GroupTemplate (string): The name of a template NPC group defined in the same AI instance.
- StateMachine (string): The name of a state machine defined in the same AI instance.
-
Zone (string): The zone returned by the
getZoneWithFlags
methods. - Dispersion (float, optional): The dispersion radius in meters when spawning a group.
The return value of the newNpcChildGroup function depends on which version of the function is used:
- Group (context): The newly created NPC group.
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.