Jump to content
  • 0

help with script shop trader


Hidan

Question


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  50
  • Reputation:   2
  • Joined:  04/03/14
  • Last Seen:  

Hello, I'm trying to use this script on the test server, but I'm experiencing this error on the map server

 

Quote

CEH9FJP.png

 

here is the script

Quote

//===== Herc Script ==========================================
//= Shop With Tax Collection
//===== By: ==================================================
//= ADM Floki (SARO - Sword Art Ragnarok Online)
//===== Versão Atual: ========================================
//= 1.0
//===== Compatible With: =====================================
//= Herc WS
//===== Description: =========================================
//= An NPC selling Red Potions in exchange for a coin worth 100 Zenys.
//= The Defined Item is Copper_Coin (ID: 673)
//= At the end of the transaction with the NPC will be stored a tax amount (Amount of Coins * 10)
//= In this way each Red Potion purchased by any player in the amount of 1 coin of 100 Zenys will yield 10% in tax, that is to say 10 Zenys.
//= The idea for the script is to put the tax collector NPC for the clans that dominate the regions collect the taxes.
//===== Additional comments: ==============================
//= 1.0 First version
//============================================================ 
prontera,155,183,5	trader	Itens Seller	4_F_EDEN_OFFICER,{
	OnInit:
	tradertype(NST_CUSTOM);
	sellitem Red_Potion,1;
	end;

// Here you configure the item you will need to purchase
OnCountFunds:
	setcurrency(countitem(Copper_Coin),countitem(Copper_Coin));
	end;

// Pays the value in bronze coins
OnPayFunds:
	dispbottom "Hello: Price="+@price+" And Points="+@points;
	if( countitem(Copper_Coin) < @points || countitem(Copper_Coin) < @price-@points )
		end;
	delitem Copper_Coin,@points;
	delitem Copper_Coin,@price-@points;
	// Stores the amount of tax the clan can withdraw.
	set $taxes1, $taxes1+@price*10;
	set $taxes2, $taxes2+@price*10;
	purchaseok();
	end;
}
prontera,144,321,6	trader	Tax Collector#1	4_F_EDEN_OFFICER,{
	
	mes "[Tax Collector]";
	mes "You have: "+$taxes1+" Zenys to collect";
	next;
	mes "Would you like to collect that amount now?";
	if(select("Collect","No") == 2) close;
	mes "Tax collected successfully";
	set Zeny, Zeny+$taxes1;
	set $taxes1, 0;
	close;
}
prontera,144,340,6	trader	Tax Collector#2	4_F_EDEN_OFFICER,{
	
	mes "[Tax Collector]";
	mes "You have: "+$taxes2+" Zenys to collect";
	next;
	mes "Would you like to collect that amount now?";
	if(select("Collect","No") == 2) close;
	mes "Tax collected successfully";
	set Zeny, Zeny+$taxes2;
	set $taxes2, 0;
	close;
}

 

Thanks in advance.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  234
  • Reputation:   113
  • Joined:  02/24/15
  • Last Seen:  

10 minutes ago, Hidan said:

Hello, I'm trying to use this script on the test server, but I'm experiencing this error on the map server

 

 

here is the script

Thanks in advance.

be sure to use TAB, 

prontera,155,183,5<TAB>trader<TAB>Itens Seller<TAB>4_F_EDEN_OFFICER,{

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  50
  • Reputation:   2
  • Joined:  04/03/14
  • Last Seen:  

1 hour ago, maken06 said:

be sure to use TAB, 


prontera,155,183,5<TAB>trader<TAB>Itens Seller<TAB>4_F_EDEN_OFFICER,{

 

Yes, I'm having trouble with the unit, but I do not know how to fix it. :\

Link to comment
Share on other sites

  • 0

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

this is a herc script :)) try this one i tried to make it for rathena

 

prontera,155,183,5	script	Items Seller#tax_shop	4_F_EDEN_OFFICER,{
mes "[ Dealer ]";
mes "-Currency Used-";
mes "- ^00FFFF"+getitemname(.currency)+"^000000 -";
next;
if(select("Open Shop:Information") == 2){
	mes "[ Dealer ]";
	mes "I collect your money and give it to others.";
	close;
}
callshop "tax_shop",1;
npcshopattach "tax_shop";
end;
			
OnBuyItem:
	set .@TotalCost,0;
		for(.@i = 0; .@i < getarraysize(@bought_nameid); .@i++)
		for(.@i = 0; .@j < getarraysize(.item); .@j++)
		if(.item[.@j] == @bought_nameid[.@i])
			.@TotalCost = .@TotalCost + ( .price[.@j] * @bought_quantity[.@i] );
				if(countitem(.currency) >= .@TotalCost ){
					delitem .currency,.@TotalCost;
					getitem @bought_nameid[.@i],@bought_quantity[.@i];
					$collectedtax += .@TotalCost * 10;
			} else {
					dispbottom "Your "+getitemname(.currency)+" is not enough";
				}
				deletearray @bought_quantity, getarraysize(@bought_quantity);
				deletearray @bought_nameid, getarraysize(@bought_nameid);	
				end;
						
					
OnInit:
	.currency = 673;
	setarray .item[0],501,502,503;
	setarray .price[0],1,2,3;
	npcshopdelitem "tax_shop",501;
	for(.@i = 0; .@i < getarraysize( .item ); .@i++)
	npcshopadditem "tax_shop",.item[.@i],.price[.@i];
	end;
}

-	shop	tax_shop	-1,501:10000

prontera,144,321,6	script	Tax Collector#1	4_F_EDEN_OFFICER,{
if(select("View Collected Tax:Collect Tax") == 1){
	mes "[ Tax Collector ]";
	mes "You have collected [ ^00FFFF"+$collectedtax+"^000000 ]";
	close;
}
if($collectedtax >= 0){
mes "[ Tax Collector ]";
mes "Here you go.";
close2;
.@TotalCollected = .@TotalCollected + $collectedtax;
Zeny += .@TotalCollected;
dispbottom "You have collected a total of "+.@TotalCollected+"z Taxes";
$collectedtax = 0;
end;
}
mes "[ Tax Collector ]";
mes "You don't have anything to collect!";
close;
}

 

Edited by crazyarashi
added script
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  50
  • Reputation:   2
  • Joined:  04/03/14
  • Last Seen:  

On 7/30/2018 at 2:29 AM, crazyarashi said:

this is a herc script :)) try this one i tried to make it for rathena

 


prontera,155,183,5	script	Items Seller#tax_shop	4_F_EDEN_OFFICER,{
mes "[ Dealer ]";
mes "-Currency Used-";
mes "- ^00FFFF"+getitemname(.currency)+"^000000 -";
next;
if(select("Open Shop:Information") == 2){
	mes "[ Dealer ]";
	mes "I collect your money and give it to others.";
	close;
}
callshop "tax_shop",1;
npcshopattach "tax_shop";
end;
			
OnBuyItem:
	set .@TotalCost,0;
		for(.@i = 0; .@i < getarraysize(@bought_nameid); .@i++)
		for(.@i = 0; .@j < getarraysize(.item); .@j++)
		if(.item[.@j] == @bought_nameid[.@i])
			.@TotalCost = .@TotalCost + ( .price[.@j] * @bought_quantity[.@i] );
				if(countitem(.currency) >= .@TotalCost ){
					delitem .currency,.@TotalCost;
					getitem @bought_nameid[.@i],@bought_quantity[.@i];
					$collectedtax += .@TotalCost * 10;
			} else {
					dispbottom "Your "+getitemname(.currency)+" is not enough";
				}
				deletearray @bought_quantity, getarraysize(@bought_quantity);
				deletearray @bought_nameid, getarraysize(@bought_nameid);	
				end;
						
					
OnInit:
	.currency = 673;
	setarray .item[0],501,502,503;
	setarray .price[0],1,2,3;
	npcshopdelitem "tax_shop",501;
	for(.@i = 0; .@i < getarraysize( .item ); .@i++)
	npcshopadditem "tax_shop",.item[.@i],.price[.@i];
	end;
}

-	shop	tax_shop	-1,501:10000

prontera,144,321,6	script	Tax Collector#1	4_F_EDEN_OFFICER,{
if(select("View Collected Tax:Collect Tax") == 1){
	mes "[ Tax Collector ]";
	mes "You have collected [ ^00FFFF"+$collectedtax+"^000000 ]";
	close;
}
if($collectedtax >= 0){
mes "[ Tax Collector ]";
mes "Here you go.";
close2;
.@TotalCollected = .@TotalCollected + $collectedtax;
Zeny += .@TotalCollected;
dispbottom "You have collected a total of "+.@TotalCollected+"z Taxes";
$collectedtax = 0;
end;
}
mes "[ Tax Collector ]";
mes "You don't have anything to collect!";
close;
}

 

I can not buy the item, it appears that the item was purchased, but I do not receive it in the inventory and gold is not discounted either.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  50
  • Reputation:   2
  • Joined:  04/03/14
  • Last Seen:  

Someone to help me?

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