-
Notifications
You must be signed in to change notification settings - Fork 96
new_npc_child_group_ml
title: New NPC Child Group Multilevel description: published: true date: 2023-03-16T23:08:51.828Z tags: editor: markdown dateCreated: 2023-03-16T22:25:58.704Z
The newNpcChildGroupMl native AI script function is used to create a multilevel dynamic NPC group with a parent/children relation. This function allows setting a base level for the spawned group.
(Group: c)newNpcChildGroupMl(GroupTemplate: s, StateMachine: s, Zone: s, BaseLevel: f) // newNpcChildGroupMl_sssf_c
()newNpcChildGroupMl(GroupTemplate: s, StateMachine: s, Zone: s, BaseLevel: f) // newNpcChildGroupMl_sssf_
(Group: c)newNpcChildGroupMl(GroupTemplate: s, StateMachine: s, Zone: s, BaseLevel: f, Dispersion: f) // newNpcChildGroupMl_sssff_c
()newNpcChildGroupMl(GroupTemplate: s, StateMachine: s, Zone: s, BaseLevel: f, Dispersion: f) // newNpcChildGroupMl_sssff_
- GroupTemplate (string): The name of the template NPC group defined in the same AIInstance.
- StateMachine (string): The name of the state machine defined in the same AIInstance.
- Zone (string): The name of the zone where the group will be spawned.
- BaseLevel (float): The base level of the spawned group.
- Dispersion (float, optional): The dispersion radius in meters when spawning a group (default value is 0).
The return values of the newNpcChildGroupMl function depend on which version of the function is used:
- Group (context): The newly created group.
These functions do not return a value.
()newNpcChildGroupMl("class_forager", "state_machine_1", $zone, 12);
This example code calls the newNpcChildGroupMl function with a GroupTemplate of "class_forager", a StateMachine of "state_machine_1", a Zone, and a BaseLevel to spawn the group at.
(@grp)newNpcChildGroupMl("class_forager", "state_machine_1", $zone, 2, 50);
This example code calls the newNpcChildGroupMl function with a GroupTemplate of "class_forager", a StateMachine of "state_machine_1", a Zone, a BaseLevel to spawn the group at, and a dispersion radius of 50 meters. It then returns the newly created group as a value.