receive_mission_items - ryzom/ryzomcore GitHub Wiki
title: Receive Mission Items description: Request mission items from a player through an NPC contextual menu published: true date: 2026-03-14T00:00:00.000Z tags: editor: markdown dateCreated: 2023-03-16T22:26:48.497Z
The receiveMissionItems native AI script function adds a contextual menu entry to an NPC that allows a player to give mission items to the NPC. EGS checks whether the player has the required items and triggers different user events depending on the outcome.
This function can only be called from a
player_target_npcevent handler. It only works on R2 shards for R2 plot items. {.is-warning}
()receiveMissionItems(missionItems: s, missionText: s, groupToNotify: c)-
missionItems (string): The items to request, in the format
"sheet_id:quantity;sheet_id:quantity;...". Example:"toto.sitem:2;tata.sitem:1" - missionText (string): The text that will appear in the NPC's contextual menu entry.
- groupToNotify (context): The NPC group that will receive user events with the results.
The missionItems string is a semicolon-separated list of item entries. Each entry is a sheet ID and quantity separated by a colon:
sheet_id_1:quantity_1;sheet_id_2:quantity_2;sheet_id_3:quantity_3
All sheet IDs must be valid .sitem sheet names and all quantities must be greater than 0.
The following user events are triggered on groupToNotify:
| Event | When |
|---|---|
user_event_1 |
The player has the requested items in their inventory |
user_event_2 |
The player does not have the requested items |
user_event_3 |
The player has given the items to the NPC (items transferred) |
- The NPC turns to face the player
- A
CGiveItemRequestMsgis sent to EGS with the item list - EGS checks the player's inventory for the requested items
- If the player has the items,
user_event_1is triggered and the menu entry is shown - If the player doesn't have the items,
user_event_2is triggered - When the player clicks the menu entry and confirms, items are transferred and
user_event_3is triggered
// In a player_target_npc event handler:
(@myGroup)context();
()receiveMissionItems("quest_item_a.sitem:1;quest_item_b.sitem:3", "Give the quest items", @myGroup);Handle the responses:
// user_event_1: player has the items
()npcSay(0, "say", "Ah, you have what I need!");
// user_event_2: player doesn't have the items
()npcSay(0, "say", "Come back when you have the items.");
// user_event_3: items were given
()npcSay(0, "say", "Thank you! Here is your reward.");
(@myGroup)context();
()giveReward("Reward!", "Rare!", "Full!", "No points!", @myGroup);- giveMissionItems - Give items from an NPC to a player
- talkTo - Simple talk interaction without items
- giveReward - Give a Ring scenario reward
Source: ryzom/server/src/ai_service/nf_grp_npc.cpp (receiveMissionItems_ssc_)