Jump to content
  • 0

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

2 answers to this question

Recommended Posts

  • 0
Posted

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

 

  • 0
Posted

a slightly more optimized version...

alberta,220,42,3	script	CardTrader	60,{
	mes "Exchange Cards:";
	for (.@i = 0; .@i < .cards_size; .@i++) {
		mes "~ "+getitemname(.cards[.@i]);
		if (!countitem(.cards[.@i])
			.@fail++;
	}
	if (!.@fail) {
		next;
		mes "[Card Trader]","Congratz you have all cards.";
		for (.@i = 0; .@i < .cards_size; .@i++)
			delitem .cards[.@i], 1;
		mes "You gained:";
		for (.@i = 0 ; .@i < .price_size; .@i += 2) {
			mes "~ "+.prize[.@i+1]+"x "+getitemname(.prize[.@i]);
			getitem .prize[.@i],.prize[.@i+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;
}

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...