Jump to content
  • 0
Sign in to follow this  
kronobr

Npc card collector

Question

Posted (edited)

Hello everyone, I would like a card collector's npc, where the player needs to have certain cards in your inventory like an sticker album, for example, from card 4001 to 4100 or cards of my choice. And he exchanges all these cards for some item as a prize. This Mission can be done weekly by the same account.

It is not the same thing as the npc Card Trader that we have available.

Thank you! 

Edited by kronobr

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

alberta,220,42,3	script	CardTrader	60,{
	getinventorylist;
	for([email protected] = 0 ; [email protected] < getarraysize(.cards); [email protected]++){
		for([email protected] = 0; [email protected] < @inventorylist_count; [email protected]++){
			if (.cards[[email protected]] == @inventorylist_id[[email protected]]){
				[email protected]++;
				break;
			}
		}
		if ([email protected] <= [email protected]){
			mes "[Card Trader]","Sorry you don't have all cards...";
			close;
		}
	}
	mes "[Card Trader]","Congratz you have all cards.";
	for ([email protected] = 0 ; [email protected] < getarraysize(.prize); [email protected] += 2)
		getitem .prize[[email protected]],.prize[[email protected]+1];
	for([email protected] = 0 ; [email protected] < getarraysize(.cards); [email protected]++)
		delitem .cards[[email protected]],1;
	close;
OnInit:
	setarray .cards,4001,4002,4003,4004;				// Card ID list
	setarray .prize,909,3,901,5;						// <ITEM ID><AMOUNT>{<ITEM ID><AMOUNT>....}
}

 

Share this post


Link to post
Share on other sites
  • 0

a slightly more optimized version...

alberta,220,42,3	script	CardTrader	60,{
	mes "Exchange Cards:";
	for ([email protected] = 0; [email protected] < .cards_size; [email protected]++) {
		mes "~ "+getitemname(.cards[[email protected]]);
		if (!countitem(.cards[[email protected]])
			[email protected]++;
	}
	if ([email protected]) {
		next;
		mes "[Card Trader]","Congratz you have all cards.";
		for ([email protected] = 0; [email protected] < .cards_size; [email protected]++)
			delitem .cards[[email protected]], 1;
		mes "You gained:";
		for ([email protected] = 0 ; [email protected] < .price_size; [email protected] += 2) {
			mes "~ "+.prize[[email protected]+1]+"x "+getitemname(.prize[[email protected]]);
			getitem .prize[[email protected]],.prize[[email protected]+1];
		}
	}
	close;
	
OnInit:
	setarray .cards,4001,4002,4003,4004;				// Card ID list
	setarray .prize,909,3,901,5;						// <ITEM ID><AMOUNT>{<ITEM ID><AMOUNT>....}
	
	.cards_size = getarraysize(.cards);
	.price_size = getarraysize(.prize);
	end;
}

 

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

Sign in to follow this  

×
×
  • Create New...

Important Information

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