Jump to content
  • 0
Sign in to follow this  
Break San

Npc Emblem of War

Question

Would you like a npc that when the purchase accepts only emblem of war.

 

NPC selling item per emblem of war

 

Thank you

 

prontera,91,123,1	shop	Higt	740,7046:500 

 

Share this post


Link to post
Share on other sites

18 answers to this question

Recommended Posts

  • 0

maybe you can try my mithril coin shop

http://rathena.org/board/topic/91109-how-to-fix-multi-shop-v12/?p=238863

-	shop	market2#hidden	-1,501:1000prontera,156,172,5	script	market	100,{	dispbottom "You currently have "+ countitem(.currency) +" "+ getitemname(.currency);	callshop .shopname$, 1;	end;OnInit:	function    addshopitem    {		npcshopdelitem .shopname$, 501;		.@count = getargcount();		for ( .@i = 0; .@i < .@count; .@i++ ) {			if ( .@i % 2 == 0 )				.itemid[ .@i /2 ] = getarg( .@i );			else {				.itemcost[ .@i /2 ] = getarg( .@i );				npcshopadditem .shopname$, .itemid[ .@i /2 ], getarg( .@i );			}		}			}//	----- Configuration ------    .shopname$ = "market2#hidden"; // shop name that match the 1st line in this script    .currency = 674; // item used for currency    addshopitem // adds shop items here        512,10,        513,20,        514,30,        515,40,        516,50,        607,1;//	-------------------------	.itemsize = getarraysize( .itemid );	for ( .@i = 0; .@i < .itemsize; .@i++ )		setd ".item"+ .itemid[.@i] +"cost", .itemcost[.@i];	npcshopattach .shopname$;	end;OnBuyItem:	if ( !@bought_quantity ) end;	.@size = getarraysize( @bought_nameid );	for ( .@i = 0; .@i < .@size; .@i++ )		.@itemcost = .@itemcost + getd( ".item"+ @bought_nameid[.@i] +"cost" ) * @bought_quantity[.@i];	if ( .@itemcost > countitem(.currency) ) {		mes "you don't have enough "+ getitemname(.currency);		close;	}	if ( !checkweight2( @bought_nameid, @bought_quantity ) ) {		mes "you can't carry all these items !";		close;	}	delitem .currency, .@itemcost;	for ( .@i = 0; .@i < .@size; .@i++ )		getitem @bought_nameid[.@i], @bought_quantity[.@i];	end;OnSellItem:	if ( !@sold_quantity ) end;	.@size = getarraysize( @sold_nameid );	for ( .@i = 0; .@i < .@size; .@i++ )		.@itemgain = .@itemgain + getd( ".item"+ @sold_nameid[.@i] +"cost" ) * @sold_quantity[.@i];	if ( !checkweight( .currency, .@itemgain ) ) {		mes "you can't carry all these items !";		close;	}	for ( .@i = 0; .@i < .@size; .@i++ )		if ( getd( ".item"+ @sold_nameid[.@i] +"cost" ) )			delitem @sold_nameid[.@i], @sold_quantity[.@i];	getitem .currency, .@itemgain;	end;}

Share this post


Link to post
Share on other sites
  • 0
prontera,153,152,1	trader	TestCustom2	4_F_EDEN_OFFICER,{	OnInit:	tradertype(NST_CUSTOM);	sellitem Red_Potion,2;	end;/* allows currency to be item 501 and 502 */OnCountFunds:	setcurrency(countitem(Red_Potion),countitem(Orange_Potion));	end;/* receives @price (total cost) and @points (the secondary input field for cash windows) */OnPayFunds:	dispbottom "Hi: price="+@price+" and points="+@points;	if( countitem(Orange_Potion) < @points || countitem(Red_Potion) < @price-@points )		end;	delitem Orange_Potion,@points;	delitem Red_Potion,@price-@points;	purchaseok();	end;}

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

 

sample already given in the script.

Share this post


Link to post
Share on other sites
  • 0

Gotta change 

Orange_Potion

by

War_Badge

 

Could use ID? even to add items

Yes

Share this post


Link to post
Share on other sites
  • 0

 

Gotta change 

Orange_Potion

by

War_Badge

 

Could use ID? even to add items

Yes

 

 

hanged by id does not work. 
Have an example
What does this npc?
/* demonstrates Market Trader */prontera,150,160,6	trader	HaiMarket	4_F_EDEN_OFFICER,{OnInit:	tradertype(NST_MARKET);	sellitem Red_Potion,-1,49;	end;OnClock0000://resupplies red potions on midnightOnMyResupply:	if( shopcount(Red_Potion) < 20 )		sellitem Red_Potion,-1,49;	end;}

Share this post


Link to post
Share on other sites
  • 0

 

 

Gotta change 

Orange_Potion

by

War_Badge

 

Could use ID? even to add items

Yes

 

 

hanged by id does not work. 
Have an example
What does this npc?
/* demonstrates Market Trader */prontera,150,160,6	trader	HaiMarket	4_F_EDEN_OFFICER,{OnInit:	tradertype(NST_MARKET);	sellitem Red_Potion,-1,49;	end;OnClock0000://resupplies red potions on midnightOnMyResupply:	if( shopcount(Red_Potion) < 20 )		sellitem Red_Potion,-1,49;	end;}

 

What do you mean it does not work? you cannot click the npc?

Share this post


Link to post
Share on other sites
  • 0

 

In npc HaiMarket nothing happens. 
I switched the potion by the emblem of war and not due for purchase.
 
@

 

please be specific on the word 'Nothing Happens'.

Share this post


Link to post
Share on other sites
  • 0

But you can click the npc? what client are you using?

Share this post


Link to post
Share on other sites
  • 0

Oh, trader type NPCs don't work on clients prior to 20131223 because of some packets that aren't elsewhere. Sorry.

 

 

Right, gets a get. 
 
Can close thanks.

Share this post


Link to post
Share on other sites
  • 0

BTW, you can have traders with whichever type, as long as it isn't NST_MARKET:

 

Note: NST_MARKET is only available with PACKETVER 20131223 or newer.See '12 - NPC Trader-Related Commands' and /doc/sample/npc_trader_sample.txt formore information regarding how to use this NPC type.

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...
Sign in to follow this  

×
×
  • Create New...

Important Information

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