Jump to content
  • 0

Check pool items in inventory


fictionx

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  122
  • Reputation:   17
  • Joined:  12/10/12
  • Last Seen:  

Hi, i want to know how can i do to detect a pool of items declared by the npc.

For example, if the player have 3 jelloy, 3 apple, 6 sticky. The npc will remove that 12 pcs of items and give 6 kafra card, or if he have 1 jello and 2 apple the npc will give 3 kafra cards.

The Jellopys, Apples and sticky have been declared in the script, and the script will delete the amount that the player have of any of these items and give kafra cards depending of the items deleted.

The ingredients can be combine, like the example above.

 

Greetigs.-

 

 

Edited by fictionx
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

prontera,155,181,5	script	Sample#exchange	4_F_KAFRA1,{
	
	mes "Exchange these item?";
	for ( .@i = 0; .@i < .item_size; .@i++ ) {
		mes " > "+ getitemname( .item[.@i] );
	}
	if ( select( "Exchange","Cancel" ) == 1 ) {
		for ( .@i = 0; .@i < .item_size; .@i++ ) {
			.@count = countitem( .item[.@i] );
			if ( .@count ) {
				delitem .item[.@i],.@count;
				.@total += .@count;
			}
		}
		getitem .reward, .@total;
		mes "Exchanged "+.@total+"x items to "+.@total+"x "+getitemname( .reward );
	}
	close;
	
	OnInit:
		.reward = 909;
		setarray .item,512,506,507,508,509;
		.item_size = getarraysize( .item );
		end;
		
}

try this.

  • Upvote 1
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  122
  • Reputation:   17
  • Joined:  12/10/12
  • Last Seen:  

On 23-12-2016 at 5:06 AM, Emistry said:

prontera,155,181,5	script	Sample#exchange	4_F_KAFRA1,{
	
	mes "Exchange these item?";
	for ( .@i = 0; .@i < .item_size; .@i++ ) {
		mes " > "+ getitemname( .item[.@i] );
	}
	if ( select( "Exchange","Cancel" ) == 1 ) {
		for ( .@i = 0; .@i < .item_size; .@i++ ) {
			.@count = countitem( .item[.@i] );
			if ( .@count ) {
				delitem .item[.@i],.@count;
				.@total += .@count;
			}
		}
		getitem .reward, .@total;
		mes "Exchanged "+.@total+"x items to "+.@total+"x "+getitemname( .reward );
	}
	close;
	
	OnInit:
		.reward = 909;
		setarray .item,512,506,507,508,509;
		.item_size = getarraysize( .item );
		end;
		
}

try this.

 

Thank you so much ! :D

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...