Skip to content

Call Inventory

Could someone point me in the right direction here? :)
I'm just trying to check to see if xItem is in the PC's inventory, and if it is "blank" happens...
More to the point, exactly when the PC puts the "leaf" in his inventory.

Grabbed this from the Lexicon but am uncertain.

if (GetItemPossessor(GetObjectByTag("SENDING_LEAF")) != OBJECT_SELF)

Sometimes I have trouble - literally speaking this language and therefore have trouble stringing logical statements together. Slowly learning. Yep... that's me... slowly learning. ;)

Comments

  • vonstormvonstorm Member Posts: 66
    I use this to see if players have rations on rest...
     if (GetIsObjectValid(oRation=GetItemPossessedBy(oPlayer,"ration")))
        {
         /// stuff happens here if they have object
          SetLocalInt (oPlayer, "iRestAllowed", 1);
        }
    

    set "ration" to the object you are looking for, the line setlocalint is where "blank" happens
  • NeverwinterWightsNeverwinterWights Member Posts: 339
    If you want it to happen as soon as the player acquires the item you will probably want to do a "Tag Based" script and/or use the modules OnAcquireItem event.

    If you have Tag Based scripting turned on in the module then you will want to give the "leaf" item a specific tag and make a script with the same name as that tag. When the player acquires the leaf the script will fire:
    #include "x2_inc_switches"
    void main()
    {
        //A check to make sure this only fires when the item is acquired
        int iEvent = GetUserDefinedItemEventNumber();
        if (iEvent != X2_ITEM_EVENT_ACQUIRE) return;
    
        //script what you want to happen here
    }
    

    If you don't have tag based scripting turned on then you would put a snippet of code in your modules OnAcquireItem event:
    object oItem = GetModuleItemAcquired();
        string sTag = GetTag(oItem);
    
        if (sTag == "LEAF_TAG")
        {
            //Do stuff here..
        }
    
Sign In or Register to comment.