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

giveMissionItems

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_npc event handler. It only works on R2 shards for R2 plot items. {.is-warning}

Syntax

()giveMissionItems(missionItems: s, missionText: s, groupToNotify: c)

Arguments

  • 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.

Item Format

Same format as receiveMissionItems: semicolon-separated entries of sheet_id:quantity.

sheet_id_1:quantity_1;sheet_id_2:quantity_2

Callback User Events

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.

How It Works

  1. The NPC turns to face the player
  2. A CReceiveItemRequestMsg is sent to EGS with the item list
  3. EGS presents the contextual menu entry to the player
  4. When the player clicks the entry, items are created in the player's inventory
  5. user_event_1 is triggered on the callback group

Example

// 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.");

See also

  • 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_)

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