Jump to content
  • 0

Potion Trader (Bulk)


LewL

Question


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.02
  • Content Count:  84
  • Reputation:   1
  • Joined:  01/08/20
  • Last Seen:  

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

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  50
  • Topics Per Day:  0.02
  • Content Count:  763
  • Reputation:   227
  • Joined:  02/11/17
  • Last Seen:  

payon,139,226,5	script	Potion Converter	749,{
	for(.@i = 0; .@i < .size; .@i += 5)
		.@menu$ += .trade[.@i+1] + " x " + getitemname(.trade[.@i]) + " for " + .trade[.@i+3] + " x "  + getitemname(.trade[.@i+2]) + ":";
	.@s = (select(.@menu$) - 1) * 5;
	.@max = countitem(.trade[.@s]) / .trade[.@s+1];
	mes "Max Amount available for trade : " + .@max;
	next;
	input .@amount;
	.@amount = min(.@amount,.@max);
	if(.@amount > .@max || .@amount == 0){
		mes "Amount cannot be 0 or greater than the max tradeable amount.";
		end;
	}
	mes "You have selected " + .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 "Amount : " + .@amount;
	mes "Note: everything you trade will be character bound potion.";
	next;
	if(select("Cancel:Trade") == 1)
		end;
	.@total = countitem(.trade[.@s+1]) * .@amount;
	if(countitem(.trade[.@s]) < .@total){
		mes "You don't have enough item for trade.";
		end;
	}
	delitem .trade[.@s],.trade[.@s+1] * .@amount;
	for(.@i = 0; .@i < .@amount; .@i++){
		if(.trade[.@s+4] < rand(1,100))
			continue;
		.@success++;
	}
	mes "Successfully converted amount : " + .@success;
	getitem .trade[.@s+2],.@success * .trade[.@s+3];
	end;
	
OnInit:
	// < ITEM FOR TRADE >, < AMOUNT >, < ITEM TRADED >, < AMOUNT >, < SUCCESS RATE >..
	setarray .trade,
	11503,2,32018,1,100;
	
	.size = getarraysize(.trade);
end;
}

 

Edited by crazyarashi
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.02
  • Content Count:  84
  • Reputation:   1
  • Joined:  01/08/20
  • Last Seen:  

1 hour ago, crazyarashi said:

payon,139,226,5	script	Potion Converter	749,{
	for(.@i = 0; .@i < .@size; .@i += 5)
		.@menu$ += .trade[.@i+1] + " x " + getitemname(.trade[.@i]) + " for " + .trade[.@i+3] + " x "  + getitemname(.trade[.@i+2]) + ":";
	.@s = (select(.@menu$) - 1) * 5;
	.@max = countitem(.trade[.@s]) / .trade[.@s+1];
	mes "Max Amount available for trade : " + .@max;
	next;
	input .@amount;
	.@amount = min(.@amount,.@max);
	if(.@amount > .@max || .@amount == 0){
		mes "Amount cannot be 0 or greater than the max tradeable amount.";
		end;
	}
	mes "You have selected " + .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 "Amount : " + .@amount;
	mes "Note: everything you trade will be character bound potion.";
	next;
	if(select("Cancel:Trade") == 1)
		end;
	.@total = countitem(.trade[.@s+1]) * .@amount;
	if(countitem(.trade[.@s]) < .@total){
		mes "You don't have enough item for trade.";
		end;
	}
	delitem .trade[.@s],.trade[.@s+1] * .@amount;
	for(.@i = 0; .@i < .@amount; .@i++){
		if(.trade[.@s+4] < rand(1,100))
			continue;
		.@success++;
	}
	mes "Successfully converted amount : " + .@success;
	getitem .trade[.@s+2],.@success * .trade[.@s+3];
	end;
	
OnInit:
	// < ITEM FOR TRADE >, < AMOUNT >, < ITEM TRADED >, < AMOUNT >, < SUCCESS RATE >..
	setarray .trade,
	11503,2,32018,1,100;
	
	.size = getarraysize(.trade);
end;
}

 

No errors with the script but it doesn't show anything in game.

123.png.9dec4dd390b5164c22cce4ee4a889522.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.02
  • Content Count:  84
  • Reputation:   1
  • Joined:  01/08/20
  • Last Seen:  

4 hours ago, Azhul said:

No errors with the script but it doesn't show anything in game.

123.png.9dec4dd390b5164c22cce4ee4a889522.png

fixed thanks

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.02
  • Content Count:  84
  • Reputation:   1
  • Joined:  01/08/20
  • Last Seen:  

On 3/1/2021 at 4:26 PM, crazyarashi said:

payon,139,226,5	script	Potion Converter	749,{
	for(.@i = 0; .@i < .size; .@i += 5)
		.@menu$ += .trade[.@i+1] + " x " + getitemname(.trade[.@i]) + " for " + .trade[.@i+3] + " x "  + getitemname(.trade[.@i+2]) + ":";
	.@s = (select(.@menu$) - 1) * 5;
	.@max = countitem(.trade[.@s]) / .trade[.@s+1];
	mes "Max Amount available for trade : " + .@max;
	next;
	input .@amount;
	.@amount = min(.@amount,.@max);
	if(.@amount > .@max || .@amount == 0){
		mes "Amount cannot be 0 or greater than the max tradeable amount.";
		end;
	}
	mes "You have selected " + .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 "Amount : " + .@amount;
	mes "Note: everything you trade will be character bound potion.";
	next;
	if(select("Cancel:Trade") == 1)
		end;
	.@total = countitem(.trade[.@s+1]) * .@amount;
	if(countitem(.trade[.@s]) < .@total){
		mes "You don't have enough item for trade.";
		end;
	}
	delitem .trade[.@s],.trade[.@s+1] * .@amount;
	for(.@i = 0; .@i < .@amount; .@i++){
		if(.trade[.@s+4] < rand(1,100))
			continue;
		.@success++;
	}
	mes "Successfully converted amount : " + .@success;
	getitem .trade[.@s+2],.@success * .trade[.@s+3];
	end;
	
OnInit:
	// < ITEM FOR TRADE >, < AMOUNT >, < ITEM TRADED >, < AMOUNT >, < SUCCESS RATE >..
	setarray .trade,
	11503,2,32018,1,100;
	
	.size = getarraysize(.trade);
end;
}

 

Hello @crazyarashi i found a bug with the script, whenever player tries to convert more than 500 then item to be converted will be gone but it wouldn't give the converted item.

example:

1000 Siege White Potion to 500 Siege Blue Potion = No Error/Bug (Works fine)

500 Siege Blue Potion to 1000 Siege White Potion = No Error/Bug (Works fine)

But when they tried to convert more than 500:

1002 Siege White Potion to 501 Siege Blue Potion = NPC will take Siege White Potion but won't give Siege Blue Potion

501 Siege Blue Potion to 1002 Siege White Potion = NPC will take Siege Blue Potion but won't give Siege White Potion

i was thinking if can we put a limit with the conversion upto exactly 500? or maybe fix the bug above?

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  211
  • Reputation:   17
  • Joined:  12/23/11
  • Last Seen:  

you can limit hete

 

if(.@amount > .@max || .@amount == 0 || .@amount > 500){
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.02
  • Content Count:  84
  • Reputation:   1
  • Joined:  01/08/20
  • Last Seen:  

On 3/4/2021 at 3:43 PM, botka4aet said:

you can limit hete

 


if(.@amount > .@max || .@amount == 0 || .@amount > 500){

Thanks

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