Jump to content
  • 0
rakuzas

How to make countitem not counting equip equipments

Question

Hi,

I make some script that trade items.. But my script, the NPC countitem all items including our equips.. So.. My question is, how to make NPC just count item in iventory only? And leaving the equip as it is.. 

Or

How to make delitem just in iventory only? Really confuse right now.. Please advise me.. Thank you in advance..

 

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

It's not possible to delete an item from the inventory only. Delitem does not support arguments for inventory index, even though it should. If you want a source mod for it I can help.

Share this post


Link to post
Share on other sites
  • 0

With getinventorylist you can get the list of items.

 

It's not possible to delete an item from the inventory only. Delitem does not support arguments for inventory index, even though it should. If you want a source mod for it I can help.

 

You can do something like:

getinventorylist;
for(.@i=0; .@i < @inventorylist_count; .@i++){
    if(@inventorylist_equip[.@i] == 0)
        .@inventlist++;
        //Do the thing that you want to do here with the item, .@i is the index of the item.
}

 

 

with this, you are counting all the items in the inventory of the character that are not being used.

 

Sorry if I replied late to this post, but i wanted to help.

 

PD:

Here are the variables that you can retrieve from getinventorylist:

 

@inventorylist_id[]        - array of item ids.
@inventorylist_amount[]    - their corresponding item amounts.
@inventorylist_equip[]     - will return the slot the item is equipped on, if at all.
@inventorylist_refine[]    - for how much it is refined.
@inventorylist_identify[]  - whether it is identified.
@inventorylist_attribute[] - whether it is broken.
@inventorylist_card1[]     - These four arrays contain card data for the
@inventorylist_card2[]       items. These data slots are also used to store
@inventorylist_card3[]       names inscribed on the items, so you can
@inventorylist_card4[]       explicitly check if the character owns an item
                             made by a specific craftsman.
@inventorylist_expire[]    - expire time (Unix time stamp). 0 means never 
                             expires.
@inventorylist_bound       - whether it is an account bounded item or not.
@inventorylist_count       - the number of items in these lists.
 

 

Edited by Enthr

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.