new_npc_child_group - ryzom/ryzomcore GitHub Wiki


title: New NPC Child Group description: published: true date: 2023-03-12T18:14:19.632Z tags: editor: markdown dateCreated: 2023-03-12T17:36:29.548Z

newNpcChildGroup

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.

Syntax

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

Arguments

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

Return values

The return value of the newNpcChildGroup function depends on which version of the function is used:

(c)newNpcChildGroup(s, s, s) and (c)newNpcChildGroup(s, s, s, f)

  • Group (context): The newly created NPC group.

()newNpcChildGroup(s, s, s) and ()newNpcChildGroup(s, s, s, f)

No return value.

Examples

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

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