facing - ryzom/ryzomcore GitHub Wiki


title: Facing description: published: true date: 2023-03-12T14:17:13.965Z tags: editor: markdown dateCreated: 2023-03-12T14:12:53.959Z

facing

The facing native AI script function is used to make all NPCs in a group face a certain direction or to make one NPC turn and face another NPC.

Syntax

()facing(direction: f) // facing_f_
()facing(group1: c, botname1: s, group2: c, botname2: s) // facing_cscs_

Arguments

()facing(f)

  • direction (float): The new angle of the NPCs in the group in radians.

()facing(c, s, c, s)

  • group1 (context): The NPC group of the bot that will turn towards the other bot.
  • botname1 (string): The name of the bot that will turn.
  • group2 (context): The NPC group of the bot that the other bot will face.
  • botname2 (string): The name of the bot that the other bot will face.

Examples

Face a direction

()facing(3.14); 

This example code sets the orientation of all the NPC in the current group to 3.14 radians.

Turn towards another bot

(@group1)group_name1.context();
(@group1)group_name2.context();
()facing(@group1, "bob", @group2, "bobette");

This example code sets the orientation of the NPC named "bob" in group "group_name1" to face the NPC named "bobette" in group "group_name2".

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