Jump to content
  • 0

Npc card collector


kronobr

Question


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.02
  • Content Count:  71
  • Reputation:   0
  • Joined:  06/24/19
  • Last Seen:  

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
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  68
  • Reputation:   8
  • Joined:  05/12/20
  • Last Seen:  


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

 

Link to comment
Share on other sites

  • 0

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

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;
}

 

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