TakeFetchItem(object)

Removes the plot related item from a player's inventory.

void TakeFetchItem(
    object oPC
);

Parameters

oPC

The player to remove the item from.


Description

Gets the Tag name of the quest object from a local object called NW_J_FETCH_MYGLOBALS on the calling creature then searches the target's inventory and equiped items for any item with that as the returned Tag name and destroys it.



Remarks

Function can be found in nw_j_fetch.nss on line 178.

It seems this set of functions are centered around storing plot item related information on NPCs for simple fetch related quests. This particular function only utilizes 2 out of the 7 other functions available. All of these functions are relatively straight forward and easy to understand at a glance.

There is also other scripts of the exact same functions but work with "ComplexItems" and "FetchItems" instead of Artifacts. The scripts are identical but seperated to make coding between them easier to understand and add functionality to later. See the "See Also" section for the other functions.


Version

1.22

Example

// OnSpawn of the NPC to give the quest out.
#include "NW_J_FETCH"
    SetGlobal(OBJECT_SELF,OBJECT_SELF);
    SetFetchItem("APPLE01");
    SetPlotTag("GATHER_APPLES"); //Matches Journal Entry that has experience to be rewarded for this quest
    
//Conversation Conditional of the NPC to reward the player for returning the item.
#include "NW_I0_PLOT"
#include "NW_J_FETCH"

int StartingConditional()
{
    if (PlayerHasFetchItem(GetPCSpeaker()) == TRUE)
    {
        ActionPauseConversation();
        
        //Destroy the apples from the players inventory.
        TakeFetchItem(GetPCSpeaker());
        RewardXP(GetPlotTag(),100,GetPCSpeaker());
        
        //Mark the quest as finished so we dont run it again for this player.
        SetLocalInt(GetModule(),GetPlotTag()+GetName(GetPCSpeaker()),1);
        
        ActionResumeConversation();
    }
    return FALSE;
}

See Also

functions: GetFetchee | GetFetchItem | TakeComplexItem | TakeStoryItem
categories: Inventory Functions | Miscellaneous Functions


 author: John Shuell
 Send comments on this topic.