-
Notifications
You must be signed in to change notification settings - Fork 94
give_mission_items
title: Give Mission Items description: published: true date: 2023-03-16T23:08:05.958Z tags: editor: markdown dateCreated: 2023-03-16T22:25:00.061Z
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}
()giveMissionItems(missionItems: s, missionText: s, groupToNotify: c) // giveMissionItems_ssc_
- 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.
(@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.