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.
()giveMissionItems(missionItems: s, missionText: s, groupToNotify: c) // giveMissionItems_ssc_
(@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.
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.