Jump to content
  • 0

Item trader that trades +10 item to a different item


Pink Guy

Question


  • Group:  Members
  • Topic Count:  131
  • Topics Per Day:  0.03
  • Content Count:  371
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

Can someone give me an npc that requires +10 item to get a different item? More options would be appreciated. Example: +10 knife = 1 tcg card, +10 rod = 1 poring coin, etc. Thanks to whoever can help me.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

Would it be a specific +10 item = a specific reward?

 

 

prontera,158,173,4	script	ItemExchanger	88,{

	mes("Welcome!");
	mes("I can trade certain +10 items with other items hehe :D");
	
	// Clear Inventory List Information
	ClearGetInventoryList();

	getinventorylist;

	set(.@counter, 0);
	set(.@menu$, "");

	// First we loop through all available exchange items
	for(.@i = 0; .@i < getarraysize(.exchange_items); .@i++) {
		// Now we check if it exists in the inventory
		.@index = array_find(@inventorylist_id, .exchange_items[.@i]);

		if (.@index >= 0) {
			// Item was found :D
			// Now we need to check and make sure that it is a PLUS 10 item
			if (@inventorylist_refine[.@i] >= 10) {
				// We have verified that it's +10 or more and we will add it to our menu and psuedo array
				set(.@exchangeable_items[.@counter], .@index);
				set(.@exchangeable_refine[.@counter], @inventorylist_refine[.@i]);		
				set(.@rewardable_items[.@counter], .@i);
				set(.@rewardable_amount[.@counter], .@i);
				.@menu$ += (.@menu$ == "" ? "" : ":") + "+" + @inventorylist_refine[.@i] + " " + getitemname(@inventorylist_id[.@i]);
				.@counter++;
			}
		}
	}

	// Now we show them the trade menu
	set .@choice, select(.@menu$) - 1; // We subtract 1 to get an array index point
	
	mes("You have chosen to trade +" + .@exchangeable_refine[.@choice] + " " + getitemname(.@excangeable_items[.@choice]));
	mes("You will receive " + .@rewardable_amount[.@choice] + "x " + getitemname(.@rewardable_items[.@choice]));
	
	if (select("Yes, Trade:Nevermind") == 1) {
		mes("Thanks, Come back soon!");	
		close;
	}

	// They opted to trade, let's do it!
	delitem @inventorylist_id[.@exchangeable_items[.@choice]], 1;
	getitem .@rewardable_items[.@choice], .@rewardable_amount[.@choice];

	mes("Here you go"!);
	close;

	OnInit:
		setarray(.exchange_items, 1201, 1202, 1203); // 3 Knives (0 slot, 1 slot, 2 slot)
		setarray(.reward_items, 501, 502, 503); // Red Potion, Orange Potion, Yellow Potion
		setarray(.reward_amount, 1, 5, 10); // Amount to return 
		end;

}

function	script	ClearGetInventoryList	{
	deletearray(@inventorylist_id);
	deletearray(@inventorylist_amount);
	deletearray(@inventorylist_equip);
	deletearray(@inventorylist_refine);
	deletearray(@inventorylist_identify);
	deletearray(@inventorylist_attribute);
	deletearray(@inventorylist_card1);
	deletearray(@inventorylist_card2);
	deletearray(@inventorylist_card3);
	deletearray(@inventorylist_card4);
	deletearray(@inventorylist_expire);
	deletearray(@inventorylist_bound);
	set(@inventorylist_count, 0);

	return;
}

Untested

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  131
  • Topics Per Day:  0.03
  • Content Count:  371
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

Sorry for the late reply, been really busy. But yeah, specific +10 item = item. Is that what you did here? @Z3R0

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

I did +10 or greater...

simply change this line 

if (@inventorylist_refine[.@i] >= 10) { to == instead of >=
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...