new_npc_child_group_ml - ryzom/ryzomcore GitHub Wiki


title: New NPC Child Group Multilevel description: published: true date: 2023-03-12T18:14:41.357Z tags: editor: markdown dateCreated: 2023-03-12T18:09:23.719Z

newNpcChildGroupMl

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.

Syntax

(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_

Arguments

  • 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).

Return values

The return values of the newNpcChildGroupMl function depend on which version of the function is used:

(c)newNpcChildGroupMl(s, s, s, f) and (c)newNpcChildGroupMl(s, s, s, f, f)

  • Group (context): The newly created group.

()newNpcChildGroupMl(s, s, s, f) and ()newNpcChildGroupMl(s, s, s, f, f)

These functions do not return a value.

Examples

()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.

⚠️ **GitHub.com Fallback** ⚠️