ActionPickUpItem(object)
From NWN Lexicon
Causes subject to run to an item and place it in its inventory.
void ActionPickUpItem( object oItem );
Contents |
[edit] Parameters
- oItem
- The item to be picked up.
[edit] Description
When the action is executed, the action subject will run to the location of oItem, crouch down, and place oItem in its inventory. If an error occurs the log file will contain "ActionPickUpItem failed."
[edit] Remarks
SPECULATION: if the path is blocked to oItem then the function will fail. Try using ActionForceMoveToObject() before calling ActionPickUpItem.
[edit] Version
1.61
[edit] Example
// In this example, the calling NPC will pick up the nearest longsword. void main() { int nNth = 1; object oItem = GetNearestObject(OBJECT_TYPE_ITEM, OBJECT_SELF, nNth); while (GetIsObjectvalid(oItem) && GetBaseItemType(oItem) != BASE_ITEM_LONGSWORD) oItem = GetNearestObject(OBJECT_TYPE_ITEM, OBJECT_SELF, ++nNth); if (GetIsObjectValid(oItem)) ActionPickUpItem(oItem); }
[edit] See Also
functions: | ActionPutDownItem |
author: Ryan Hunt, editor: Lilac Soul, additional contributor(s): Lilac Soul