give_mission_items - ryzom/ryzomcore GitHub Wiki


title: Give Mission Items description: published: true date: 2023-03-13T15:22:44.067Z tags: editor: markdown dateCreated: 2023-03-13T15:15:58.307Z

giveMissionItems

The giveMissionItems native AI script function allows a targeted NPC to give mission items to the targeting player.

A new entry will be added to the NPC contextual menu, allowing the player to receive the mission items from the NPC. Upon completion of the action, a user event with the ID user_event_1 will be triggered on a specified NPC group, indicating that the player has received the mission items.

This function can only be called after the event "player_target_npc", and only works on an R2 shard for R2 plot items. {.is-warning}

Syntax

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

Arguments

  • missionItems (string): The list of mission items to give, in the format "item1:qty1;item2:qty2;...".
  • missionText (string): The text that will appear in the NPC contextual menu.
  • groupToNotify (group): The NPC group that will receive the user event upon completion.

Examples

(@groupToNotify)group_name.context();
()giveMissionItems("toto.sitem:2;tata.sitem:1;titi.sitem:3", "Mission text", @groupToNotify);

This example code sets up the NPC contextual menu to give the player the mission items "toto.sitem:2", "tata.sitem:1", and "titi.sitem:3". Upon completion of the action, a user event will be triggered on the NPC group specified for notification.

Notes

If the mission items do not exist or are not in the correct format, the player will not receive the items, and a warning message will be displayed in the log.

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