Jump to content
  • 0

NPC - card buyer


Erinoxy

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   3
  • Joined:  01/24/17
  • Last Seen:  

Hi all,

I would like to know how I can add a NPC that will only check the cards in my inventory and will display that in a select list.

I already had a look on the custom scripts but I didn't find anything convincing.

Many thanks in advance.

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   3
  • Joined:  01/24/17
  • Last Seen:  

Finally found a solution by looking in another existing script..

First step : get the inventory and loop on it. In my case I only took the elements having the number 6 (card). We add the ID of the card inside the array and we also create the menu by adding the name of the card.

getinventorylist;
for (; .@i < @inventorylist_count; .@i++) {
	if(getiteminfo(@inventorylist_id[.@i],2) == 6){
		.@items[.@count] = @inventorylist_id[.@i];
		.@menu$ = .@menu$ + getitemname(@inventorylist_id[.@i]) + ":";
		.@count++;
	}
}

Get the selected element : 

.@select = select(.@menu$) - 1;

 

Delete the selected item and give money : 

delitem .@items[.@select],1;
set Zeny, Zeny + 500000;

 

I hope it will be useful for seomeone else.

 

  • Upvote 2
Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...