Jump to content
  • 0
`Azhul

Potion Trader (Bulk)

Question

Hello everyone, i'm using @Mabuhay item trader script as my server's Potion Converter the script is working fine.

Can someone help me make it Bulk trading/converting? Because as of now it only trade 1 at a time.

Would like to make it players can input how many potions they can convert on a single trade.

here's the script home you can help me. thanks in advance 

Potion_Converter.txt

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
Spoiler

// Item trader
// https://rathena.org/board/topic/121585-item-trader/
// by Mabuhay
// v2 by Racaae - bulk option added

payon,139,226,5	script	Potion Converter	4_M_ALCHE_B,{
	mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
	mes("I can convert some items for you.");
	next;
	// < ITEM FOR TRADE >, < AMOUNT >, < ITEM TRADED >, < AMOUNT >, < SUCCESS RATE >..
	setarray .@trade,
		11503, 2, 32018, 1, 100, 	// 2 Siege White Potion = 1 Battle Blue Potion @ 100 %
		32042, 2, 32018, 1, 100, 	// 2 War White Potion = 1 Battle Blue Potion @ 100 %
		32017, 2, 32018, 1, 100,	// 2 Battle White Potion = 1 Battle Blue Potion @ 100 %
		11504, 1, 32017, 2, 100, 	// 2 Siege White Potion = 1 Battle Blue Potion @ 100 %
		32043, 1, 32017, 2, 100, 	// 2 War White Potion = 1 Battle Blue Potion @ 100 %
		32018, 1, 32017, 2, 100;	// 2 Battle White Potion = 1 Battle Blue Potion @ 100 %
	
	.@size = getarraysize(.@trade);
	for ( .@i = 0; .@i < .@size; .@i += 5 ) {
		.@menu$ += .@trade[.@i+1] +"x "+getitemname(.@trade[.@i])+" for "+.@trade[.@i+3]+"x "+ getitemname(.@trade[.@i+2]) +":";
	}
	.@sel = select(.@menu$)-1;
	.@s = .@sel * 5;
	mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
	mes "Your "+.@trade[.@s+1] +"x "+getitemname(.@trade[.@s])+" for "+.@trade[.@s+3]+"x "+ getitemname(.@trade[.@s+2]) +"?";
	mes "This has "+ .@trade[.@s+4]+"% success rate.";
	mes "Note: everything you trade will be character bound.";
	next;
	switch(select("Trade one time", "Choose how much to trade", "Finish conversation")) {
	case 1:
		if ( countitem(.@trade[.@s]) < .@trade[.@s+1] ) {
			mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
			mes "You dont have enough item required.";
			close;
		}
		delitem .@trade[.@s], .@trade[.@s+1];
		if ( .@trade[.@s+4] <= rand(100) ) {
			mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
			mes "Opps! It failed!";
			mes "Try again next time.";
			close;
		}
		mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
		mes "Congrats! You got it!";
		getitem .@trade[.@s+2], .@trade[.@s+3];
		close2;
		end;
	case 2:
		input .@q;
		if (.@q < 1) {
			mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
			mes("Trade cancelled.");
			close;
		}
		.@cost = .@trade[.@s+1]*.@q;
		if ( countitem(.@trade[.@s]) < .@cost ) {
			mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
			mes "You dont have enough item required.";
			close;
		}
		if ( .@trade[.@s+4] < 100)
			for ( .@i = 0; .@i < .@q; .@i++ )
				if ( .@trade[.@s+4] <= rand(100) )
					.@fail++;
		delitem .@trade[.@s], .@cost;
		getitem .@trade[.@s+2], .@trade[.@s+3]*.@q-.@fail;
		mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
		if (.@fail == .@q)
			mes "I'm sorry. All failed.";
		else if (.@fail)
			mes("Congrats! You got some of it, and failed " + .@fail + " times.");
		else
			mes "Congrats! You got it all!";
		close;
	case 3:
		close;
	}
}

 

 

Edited by Racaae
spoiler added

Share this post


Link to post
Share on other sites
  • 0
On 3/1/2021 at 10:58 PM, Racaae said:
  Hide contents

// Item trader // https://rathena.org/board/topic/121585-item-trader/ // by Mabuhay // v2 by Racaae - bulk option added payon,139,226,5 script Potion Converter 4_M_ALCHE_B,{ mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE)); mes("I can convert some items for you."); next; // < ITEM FOR TRADE >, < AMOUNT >, < ITEM TRADED >, < AMOUNT >, < SUCCESS RATE >.. setarray .@trade, 11503, 2, 32018, 1, 100, // 2 Siege White Potion = 1 Battle Blue Potion @ 100 % 32042, 2, 32018, 1, 100, // 2 War White Potion = 1 Battle Blue Potion @ 100 % 32017, 2, 32018, 1, 100, // 2 Battle White Potion = 1 Battle Blue Potion @ 100 % 11504, 1, 32017, 2, 100, // 2 Siege White Potion = 1 Battle Blue Potion @ 100 % 32043, 1, 32017, 2, 100, // 2 War White Potion = 1 Battle Blue Potion @ 100 % 32018, 1, 32017, 2, 100; // 2 Battle White Potion = 1 Battle Blue Potion @ 100 % .@size = getarraysize(.@trade); for ( .@i = 0; .@i < .@size; .@i += 5 ) { .@menu$ += .@trade[.@i+1] +"x "+getitemname(.@trade[.@i])+" for "+.@trade[.@i+3]+"x "+ getitemname(.@trade[.@i+2]) +":"; } .@sel = select(.@menu$)-1; .@s = .@sel * 5; mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE)); mes "Your "+.@trade[.@s+1] +"x "+getitemname(.@trade[.@s])+" for "+.@trade[.@s+3]+"x "+ getitemname(.@trade[.@s+2]) +"?"; mes "This has "+ .@trade[.@s+4]+"% success rate."; mes "Note: everything you trade will be character bound."; next; switch(select("Trade one time", "Choose how much to trade", "Finish conversation")) { case 1: if ( countitem(.@trade[.@s]) < .@trade[.@s+1] ) { mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE)); mes "You dont have enough item required."; close; } delitem .@trade[.@s], .@trade[.@s+1]; if ( .@trade[.@s+4] <= rand(100) ) { mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE)); mes "Opps! It failed!"; mes "Try again next time."; close; } mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE)); mes "Congrats! You got it!"; getitem .@trade[.@s+2], .@trade[.@s+3]; close2; end; case 2: input .@q; if (.@q < 1) { mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE)); mes("Trade cancelled."); close; } .@cost = .@trade[.@s+1]*.@q; if ( countitem(.@trade[.@s]) < .@cost ) { mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE)); mes "You dont have enough item required."; close; } if ( .@trade[.@s+4] < 100) for ( .@i = 0; .@i < .@q; .@i++ ) if ( .@trade[.@s+4] <= rand(100) ) .@fail++; delitem .@trade[.@s], .@cost; getitem .@trade[.@s+2], .@trade[.@s+3]*.@q-.@fail; mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE)); if (.@fail == .@q) mes "I'm sorry. All failed."; else if (.@fail) mes("Congrats! You got some of it, and failed " + .@fail + " times."); else mes "Congrats! You got it all!"; close; case 3: close; } }



// Item trader
// https://rathena.org/board/topic/121585-item-trader/
// by Mabuhay
// v2 by Racaae - bulk option added

payon,139,226,5	script	Potion Converter	4_M_ALCHE_B,{
	mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
	mes("I can convert some items for you.");
	next;
	// < ITEM FOR TRADE >, < AMOUNT >, < ITEM TRADED >, < AMOUNT >, < SUCCESS RATE >..
	setarray .@trade,
		11503, 2, 32018, 1, 100, 	// 2 Siege White Potion = 1 Battle Blue Potion @ 100 %
		32042, 2, 32018, 1, 100, 	// 2 War White Potion = 1 Battle Blue Potion @ 100 %
		32017, 2, 32018, 1, 100,	// 2 Battle White Potion = 1 Battle Blue Potion @ 100 %
		11504, 1, 32017, 2, 100, 	// 2 Siege White Potion = 1 Battle Blue Potion @ 100 %
		32043, 1, 32017, 2, 100, 	// 2 War White Potion = 1 Battle Blue Potion @ 100 %
		32018, 1, 32017, 2, 100;	// 2 Battle White Potion = 1 Battle Blue Potion @ 100 %
	
	.@size = getarraysize(.@trade);
	for ( .@i = 0; .@i < .@size; .@i += 5 ) {
		.@menu$ += .@trade[.@i+1] +"x "+getitemname(.@trade[.@i])+" for "+.@trade[.@i+3]+"x "+ getitemname(.@trade[.@i+2]) +":";
	}
	.@sel = select(.@menu$)-1;
	.@s = .@sel * 5;
	mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
	mes "Your "+.@trade[.@s+1] +"x "+getitemname(.@trade[.@s])+" for "+.@trade[.@s+3]+"x "+ getitemname(.@trade[.@s+2]) +"?";
	mes "This has "+ .@trade[.@s+4]+"% success rate.";
	mes "Note: everything you trade will be character bound.";
	next;
	switch(select("Trade one time", "Choose how much to trade", "Finish conversation")) {
	case 1:
		if ( countitem(.@trade[.@s]) < .@trade[.@s+1] ) {
			mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
			mes "You dont have enough item required.";
			close;
		}
		delitem .@trade[.@s], .@trade[.@s+1];
		if ( .@trade[.@s+4] <= rand(100) ) {
			mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
			mes "Opps! It failed!";
			mes "Try again next time.";
			close;
		}
		mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
		mes "Congrats! You got it!";
		getitem .@trade[.@s+2], .@trade[.@s+3];
		close2;
		end;
	case 2:
		input .@q;
		if (.@q < 1) {
			mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
			mes("Trade cancelled.");
			close;
		}
		.@cost = .@trade[.@s+1]*.@q;
		if ( countitem(.@trade[.@s]) < .@cost ) {
			mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
			mes "You dont have enough item required.";
			close;
		}
		if ( .@trade[.@s+4] < 100)
			for ( .@i = 0; .@i < .@q; .@i++ )
				if ( .@trade[.@s+4] <= rand(100) )
					.@fail++;
		delitem .@trade[.@s], .@cost;
		getitem .@trade[.@s+2], .@trade[.@s+3]*.@q-.@fail;
		mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
		if (.@fail == .@q)
			mes "I'm sorry. All failed.";
		else if (.@fail)
			mes("Congrats! You got some of it, and failed " + .@fail + " times.");
		else
			mes "Congrats! You got it all!";
		close;
	case 3:
		close;
	}
}

 

 

Not working :( nothing happens when i click the npc.

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

  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.

Loading...

×
×
  • Create New...

Important Information

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