talk_to - ryzom/ryzomcore GitHub Wiki


title: Talk To description: published: true date: 2023-03-12T16:13:09.628Z tags: editor: markdown dateCreated: 2023-03-12T16:13:05.904Z

talkTo

The talkTo native AI script function adds an entry to the NPC contextual menu allowing a player to talk to the NPC. This function can only be called after the event "player_target_npc".

After the player talks to the NPC, two user events are triggered on the NPC group:

  • user_event_1: triggered each time (see Notes).
  • user_event_3: triggered after the player has talked to the NPC.

This function can only be called after the event "player_target_npc". {.is-warning}

Syntax

()talkTo(missionText: s, groupToNotify: c) 

Arguments

  • missionText (string): The text that will appear in the NPC contextual menu.
  • groupToNotify (context): The NPC group that will receive the user events.

Notes

An empty give item request is used to send a message to the EGS. This is a trick used to inform the EGS that the player has talked to the NPC, as there is no other way to send such a message to the EGS.

Example

(@groupToNotify)group_name.context();
()talkTo("Mission text", @groupToNotify); 

This example code adds an entry to the NPC contextual menu of the group named "group_name" with the text "Mission text", allowing the player to talk to the NPC. The NPC group will receive user events after the player talks to the NPC.

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