new_npc_child_group_pos - ryzom/ryzomcore GitHub Wiki


title: New NPC Child Group Pos description: published: true date: 2023-03-12T18:15:02.915Z tags: editor: markdown dateCreated: 2023-03-12T17:55:30.175Z

newNpcChildGroupPos

The newNpcChildGroupPos native AI script function is used to create a dynamic NPC group with a parent/children relation based on the provided position.

Syntax

(Group: c)newNpcChildGroupPos(GroupTemplate: s, StateMachine: s, x: f, y: f) // newNpcChildGroupPos_ssff_c
()newNpcChildGroupPos(GroupTemplate: s, StateMachine: s, x: f, y: f) // newNpcChildGroupPos_ssff_
(Group: c)newNpcChildGroupPos(GroupTemplate: s, StateMachine: s, x: f, y: f, Dispersion: f) // newNpcChildGroupPos_ssfff_c
()newNpcChildGroupPos(GroupTemplate: s, StateMachine: s, x: f, y: f, Dispersion: f) // newNpcChildGroupPos_ssfff_

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.
  • x (float): The x position of the spawned group.
  • y (float): The y position 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 newNpcChildGroupPos function depend on which version of the function is used:

(c)newNpcChildGroupPos(s, s, f, f) and (c)newNpcChildGroupPos(s, s, f, f, f)

  • Group (context): The newly created group.

()newNpcChildGroupPos(s, s, f, f) and ()newNpcChildGroupPos(s, s, f, f, f)

These functions does not return a value.

Examples

()newNpcChildGroupPos("class_forager", "state_machine_1", x, y);

This example code calls the newNpcChildGroupPos function with a GroupTemplate of "class_forager", a StateMachine of "state_machine_1", and an x and y position to spawn the group at.

(@grp)newNpcChildGroupPos("class_forager", "state_machine_1", x, y, 30);

This example code calls the newNpcChildGroupPos 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 dispersion radius of 30 meters. It then returns the newly created group as a value.

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