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".
()talkTo(missionText: s, groupToNotify: c)
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.
(@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.