-
Notifications
You must be signed in to change notification settings - Fork 94
new_npc_child_group_pos_ml
title: New NPC Child Group Pos Multilevel description: published: true date: 2023-03-16T23:08:57.856Z tags: editor: markdown dateCreated: 2023-03-16T22:26:06.560Z
The newNpcChildGroupPosMl native AI script function is used to create a multilevel dynamic NPC group with a parent/children relation based on the provided position. This function allows setting a base level for the spawned group.
(Group: c)newNpcChildGroupPosMl(GroupTemplate: s, StateMachine: s, x: f, y: f, BaseLevel: f) // newNpcChildGroupPosMl_ssfff_c
()newNpcChildGroupPosMl(GroupTemplate: s, StateMachine: s, x: f, y: f, BaseLevel: f) // newNpcChildGroupPosMl_ssfff_
(Group: c)newNpcChildGroupPosMl(GroupTemplate: s, StateMachine: s, x: f, y: f, BaseLevel: f, Dispersion: f) // newNpcChildGroupPosMl_ssffff_c
()newNpcChildGroupPosMl(GroupTemplate: s, StateMachine: s, x: f, y: f, BaseLevel: f, Dispersion: f) // newNpcChildGroupPosMl_ssffff_
- 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.
- x (float): The x position of the spawned group.
- y (float): The y position of the spawned group.
- 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 newNpcChildGroupPosMl function depend on which version of the function is used:
- Group (context): The newly created group.
These functions does not return a value.
()newNpcChildGroupPosMl("class_forager", "state_machine_1", x, y, 13);
This example code calls the newNpcChildGroupPosMl 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 base level of 13.
(@grp)newNpcChildGroupPosMl("class_forager", "state_machine_1", x, y, 13, 7.5);
This example code calls the newNpcChildGroupPosMl function with a GroupTemplate of "class_forager", a StateMachine of "state_machine_1", an x and y position to spawn the group at, a base level of 13, and a dispersion radius of 7.5 meters. It then returns the newly created group as a value.