Jump to content
  • 0
Legend

Dynamic shop support

Question

I encountered this error when using Patsky's Dynamic shop script...

 

i changed my zeny to 0

 

and it says "you do not have enough zeny" but my currency is "#KILLPOINTS".

 

i don't understand why.

 

please do help.

Thanks in advance~

 

-	shop	dynamicshop	-1,501:50prontera,150,150,4	script	Dynamic Shop	100,{	callshop "dynamicshop",1;	npcshopattach "dynamicshop";	end;	OnBuyItem:		for ( set .@j, 0; .@j < getarraysize(.items); set .@j, .@j + 2 ) {			for ( set .@k, 0; .@k < getarraysize(@bought_nameid); set .@k, .@k + 1 ) {				if ( @bought_nameid[.@k] == .items[.@j] ) {					if ( checkweight( @bought_nameid[.@k], @bought_quantity[.@k] ) ) {						if ( .currency < .items[.@j+1] )							dispbottom "You don't have enough kill points to purchase this item.";						else {							.currency -= .items[.@j+1] * @bought_quantity[.@k];							getitem @bought_nameid[.@k], @bought_quantity[.@k];						}					} else dispbottom "You cannot carry out more items with you";				}			}		}		deletearray @bought_quantity, getarraysize(@bought_quantity);		deletearray @bought_nameid, getarraysize(@bought_nameid);		end;	OnInit:		set .currency, "#KILLPOINTS"; // kill points is used to buy items		setarray .items, 7227,5; // Usage : <item id>,<price>		npcshopitem "dynamicshop",0,0;		for ( set .@i, 0; .@i < getarraysize(.items); set .@i, .@i + 2 )			npcshopadditem "dynamicshop", .items[.@i], .items[.@i+1];		end;}

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

https://github.com/HerculesWS/Hercules/blob/master/doc/sample/npc_trader_sample.txt

prontera,153,182,1	trader	TestCustom2	4_F_EDEN_OFFICER,{
	end;
OnPayFunds:
	dispbottom "Hi: price = "+ @price +" and points = "+ @points ;
	if ( #KILLPOINTS < @price )
		end;
	#KILLPOINTS -= @price;
	purchaseok();
	end;
OnCountFunds:
	setcurrency #KILLPOINTS, 0;
	end;
OnInit:
	tradertype NST_CUSTOM;
	sellitem TCG_Card, 5;
	end;
}
/*
prontera,156,182,1	trader	give credit	1_F_MARIA,{
	input #KILLPOINTS;
	end;
}
*/
Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0
-	shop	dynamicshop	-1,501:50prontera,150,150,4	script	Dynamic Shop	100,{	callshop "dynamicshop",1;	npcshopattach "dynamicshop";	end;	OnBuyItem:		for ( set .@j, 0; .@j < getarraysize(.items); set .@j, .@j + 2 ) {			for ( set .@k, 0; .@k < getarraysize(@bought_nameid); set .@k, .@k + 1 ) {				if ( @bought_nameid[.@k] == .items[.@j] ) {					if ( checkweight( @bought_nameid[.@k], @bought_quantity[.@k] ) ) {						if ( getd(.currency$) < .items[.@j+1] )							dispbottom "You don't have enough kill points to purchase this item.";						else {							setd .currency$, getd(.currency$) - .items[.@j+1] * @bought_quantity[.@k];							getitem @bought_nameid[.@k], @bought_quantity[.@k];						}					} else dispbottom "You cannot carry out more items with you";				}			}		}		deletearray @bought_quantity, getarraysize(@bought_quantity);		deletearray @bought_nameid, getarraysize(@bought_nameid);		end;	OnInit:		set .currency$, "#KILLPOINTS"; // kill points is used to buy items		setarray .items, 7227,5; // Usage : <item id>,<price>		npcshopitem "dynamicshop",0,0;		for ( set .@i, 0; .@i < getarraysize(.items); set .@i, .@i + 2 )			npcshopadditem "dynamicshop", .items[.@i], .items[.@i+1];		end;}

Share this post


Link to post
Share on other sites
  • 0

@@Litro, still doesn't work sir.

But i already found a solution by customizing the default dynamic shop npc.

Solved.

Edited by Legend

Share this post


Link to post
Share on other sites
  • 0

 

@@Litro, still doesn't work sir.

 

But i already found a solution by customizing the default dynamic shop npc.

 

Solved.

Would you be so kind to post your solution ;p?

 

@@Tranquility The solution made was just like Annie's post  ;) 

 

@@AnnieRuru Thank you, idol  :wub:

 

best answer updated.

Edited by Legend

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.