TakeComplexItem

From NWN Lexicon
Jump to: navigation, search



TakeComplexItem(object)

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

void TakeComplexItem(
    object oPC
);

Parameters

oPC

The player to remove the item from.


Description

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



Remarks

Function can be found in nw_j_complex.nss on line 146.

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 are two other sets very much similiar to this one where the only difference is in the function naming scheme. See the "See Also" for links.

There is also another script of the exact same functions but works with "Artifacts" instead of ComplexItems. The scripts are identical but seperated to make coding between them easier to understand and add functionality to later. It also allows a quest to have intermediate items to retrieve before retrieving the main Artifact item. See the "See Also" section for the other functions.


Requirements

#include " nw_j_complex "

Version

1.22

Example

// OnSpawn of the NPC to give the quest out.
#include "NW_J_COMPLEX"
    SetGlobal(OBJECT_SELF,OBJECT_SELF);
    SetComplexItem("COMP_ITEM03");
    SetPlotTag("NW_LOCK_PLOT"); //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_COMPLEX"
 
int StartingConditional()
{
    if (PlayerHasComplexItem(GetPCSpeaker()) == TRUE)
    {
        ActionPauseConversation();
        TakeComplexItem(GetPCSpeaker()); //Destroys the item from the players inventory.
        RewardXP(GetPlotTag(),100,GetPCSpeaker());
        ActionResumeConversation();
    }
    return FALSE;
}

See Also

functions: 

TakeStoryItem



 author: John Shuell, editor: Mistress, contributor: Graewerld