give_mission_items - ryzom/ryzomcore GitHub Wiki
title: Give Mission Items description: Give mission items from an NPC to a player through a contextual menu published: true date: 2026-03-14T00:00:00.000Z tags: editor: markdown dateCreated: 2023-03-16T22:25:00.061Z
The giveMissionItems native AI script function adds a contextual menu entry to an NPC that allows a player to receive mission items from the NPC. When the player clicks the entry, the items are placed in their inventory and a user event is triggered on the callback group.
This function can only be called from a
player_target_npcevent handler. It only works on R2 shards for R2 plot items. {.is-warning}
()giveMissionItems(missionItems: s, missionText: s, groupToNotify: c)-
missionItems (string): The items to give, in the format
"sheet_id:quantity;sheet_id:quantity;...". Example:"reward_item.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 when the items are given.
Same format as receiveMissionItems: semicolon-separated entries of sheet_id:quantity.
sheet_id_1:quantity_1;sheet_id_2:quantity_2
| Event | When |
|---|---|
user_event_1 |
The player has received the items from the NPC |
Unlike receiveMissionItems, there is no check for inventory space or item availability — the menu entry is always shown. If the items cannot be given (invalid sheet IDs, etc.), a warning is logged.
- The NPC turns to face the player
- A
CReceiveItemRequestMsgis sent to EGS with the item list - EGS presents the contextual menu entry to the player
- When the player clicks the entry, items are created in the player's inventory
-
user_event_1is triggered on the callback group
// In a player_target_npc event handler:
(@myGroup)context();
()giveMissionItems("quest_reward.sitem:1;bonus_item.sitem:2", "Receive your reward", @myGroup);Handle the completion:
// user_event_1: player received the items
()npcSay(0, "say", "Here you go! Use them wisely.");- receiveMissionItems - Request items from a player (reverse direction)
- talkTo - Simple talk interaction without items
- giveReward - Give a Ring scenario reward (auto-generated from points)
Source: ryzom/server/src/ai_service/nf_grp_npc.cpp (giveMissionItems_ssc_)