Npc Emblem of War

Break San

New member
Messages
240
Points
0
Location
França
Would you like a npc that when the purchase accepts only emblem of war.

NPC selling item per emblem of war

Thank you

Code:
prontera,91,123,1	shop	Higt	740,7046:500
 
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.

 
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?
Code:
/* 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;}
 
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?

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

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

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

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

Code:
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.
 
maybe you can try my mithril coin shop

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

Code:
-	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;}
 
Last edited by a moderator:
Back
Top