Jedzkie 58 Posted September 10, 2014 Hi! can i request a stock npc? for example, the maximum stocks is 30000 if i buy a 1 Red potion worth 100z, the stocks will become 29999, then i will sell it by 50z. the stocks will become 30000 again.. thanks! Quote Share this post Link to post Share on other sites
0 GmOcean 92 Posted September 10, 2014 (edited) Why not just use Hercules' official restock shop? It allows you to specify an item to sell and how much to sell. Then you can restock it after X amount of time, or after a certain time. Here is the example given with Hercules revisions. 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;} This sells 49 RedPotions at default price, and then at midnight, restocks those potions back to 49 if there are less than 20 left. So, to change it to your request would be, replace the 49 with 30000 and the 20 with a number less than 30000 so that it can get restocked. Edit: This can only be used with packetver 20131223 or newer. So make sure your using a compatible client first. Edited September 10, 2014 by GmOcean Quote Share this post Link to post Share on other sites
0 Jedzkie 58 Posted September 10, 2014 Why not just use Hercules' official restock shop? It allows you to specify an item to sell and how much to sell. Then you can restock it after X amount of time, or after a certain time. Here is the example given with Hercules revisions. 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;} This sells 49 RedPotions at default price, and then at midnight, restocks those potions back to 49 if there are less than 20 left. So, to change it to your request would be, replace the 49 with 30000 and the 20 with a number less than 30000 so that it can get restocked. Edit: This can only be used with packetver 20131223 or newer. So make sure your using a compatible client first. i already tried it but it does not fit my needs.. i want it buy and sell.. no time needed. Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted September 10, 2014 You could have another NPC next to it to sell him the items and make the NPC trader resupply them. Or if the shop can be called with callshop (I doubt) you could make it all in one NPC. I'd make you an example, but honestly not in the mood. Quote Share this post Link to post Share on other sites
0 Zirius 1 Posted September 10, 2014 You could have another NPC next to it to sell him the items and make the NPC trader resupply them. Or if the shop can be called with callshop (I doubt) you could make it all in one NPC. I'd make you an example, but honestly not in the mood. challenge accepted; prontera,150,160,6 script HaiMarket 4_F_EDEN_OFFICER,{if(!$lock && !$stock) set $stock,30000;set $lock,1;set .item,512;set .price,10;if($stock){mes "I can sell "+ $stock +", how many do you wanna buy?";next; while(input(.@guess, 1, $stock)) { mes "[Woman]"; mes "Didn't you listen before? i can only sell up to "+ $stock; next; } mes "[Woman]"; { .@cost = .@guess * .price; if (Zeny<.@cost) {mes "you don't have enaf zeny"; close;} set Zeny,Zeny-.@cost; set $stock,$stock-.@guess; getitem .item,.@guess; mes "Well done."; } close;} else { mes "no more"; close;}} is this what you want? Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted September 10, 2014 You could have another NPC next to it to sell him the items and make the NPC trader resupply them. Or if the shop can be called with callshop (I doubt) you could make it all in one NPC. I'd make you an example, but honestly not in the mood. challenge accepted; prontera,150,160,6 script HaiMarket 4_F_EDEN_OFFICER,{if(!$lock && !$stock) set $stock,30000;set $lock,1;set .item,512;set .price,10;if($stock){mes "I can sell "+ $stock +", how many do you wanna buy?";next; while(input(.@guess, 1, $stock)) { mes "[Woman]"; mes "Didn't you listen before? i can only sell up to "+ $stock; next; } mes "[Woman]"; { .@cost = .@guess * .price; if (Zeny<.@cost) {mes "you don't have enaf zeny"; close;} set Zeny,Zeny-.@cost; set $stock,$stock-.@guess; getitem .item,.@guess; mes "Well done."; } close;} else { mes "no more"; close;}} is this what you want? Nope. Mainly because I think he actually wants to have the NPC with a shop interface. And he also wants the NPC to be able to buy your items and place them on stock, and the script doesn't do that. I don't know if you can call a trader via the callshop script command. In that case you could call it with both the buy and sell buttons and know exactly whatever you've sold or bought from him (see docs). In case you can't, it's not possible to the best of my knowledge to have it all in one NPC because of not being able to call the trader. I haven't attempted yet to call a trader shop, but won't test it right now. Could someone else please? Quote Share this post Link to post Share on other sites
0 Zirius 1 Posted September 10, 2014 Joke. LOL. Btw, you can with flag 3: callshop "shop",3; Quote Share this post Link to post Share on other sites
0 Jedzkie 58 Posted September 10, 2014 You could have another NPC next to it to sell him the items and make the NPC trader resupply them. Or if the shop can be called with callshop (I doubt) you could make it all in one NPC. I'd make you an example, but honestly not in the mood. challenge accepted; prontera,150,160,6 script HaiMarket 4_F_EDEN_OFFICER,{if(!$lock && !$stock) set $stock,30000;set $lock,1;set .item,512;set .price,10;if($stock){mes "I can sell "+ $stock +", how many do you wanna buy?";next; while(input(.@guess, 1, $stock)) { mes "[Woman]"; mes "Didn't you listen before? i can only sell up to "+ $stock; next; } mes "[Woman]"; { .@cost = .@guess * .price; if (Zeny<.@cost) {mes "you don't have enaf zeny"; close;} set Zeny,Zeny-.@cost; set $stock,$stock-.@guess; getitem .item,.@guess; mes "Well done."; } close;} else { mes "no more"; close;}} is this what you want? Nope. Mainly because I think he actually wants to have the NPC with a shop interface. And he also wants the NPC to be able to buy your items and place them on stock, and the script doesn't do that. I don't know if you can call a trader via the callshop script command. In that case you could call it with both the buy and sell buttons and know exactly whatever you've sold or bought from him (see docs). In case you can't, it's not possible to the best of my knowledge to have it all in one NPC because of not being able to call the trader. I haven't attempted yet to call a trader shop, but won't test it right now. Could someone else please? Thanks for the replies but i want no a NPC Shop, only a npc with a dialog.. Quote Share this post Link to post Share on other sites
0 GmOcean 92 Posted September 11, 2014 (edited) So, you want a NORMAL npc to sell the item and restock it. But you want it done via Menu options and text. prontera,150,180,4 script Stock_NPC 123,{switch( select( "Buy:Sell" ) ) { case 1: if( !$amount ){ mes "Sorry out of stock."; close; } mes "Currently Selling: "+ getitemname($itemid) +""; mes "Amount in stock: "+ $amount +""; mes "Price per: "+ $price +""; mes "How much would you like to buy?"; input .@purchase,1,$amount; if ( zeny < ( .@purchase * $price ) ){ mes "Not enough funds."; close;} zeny-= ( .@purchase * $price ); getitem $itemid,.@purchase; $amount -= .@purchase; $buyback += .@purchase; next; mes "Transaction Complete."; close; case 2: if( !$buyback ){ mes "Sorry, I'm currently over stocked."; close; } mes "Currently Selling: "+ getitemname($itemid) +""; mes "Amount I can buy back: "+ $buyback +""; mes "Sell back price: "+ ($price/2) +""; mes "How much would you like to sell?"; input .@sell,1,$buyback; if( countitem($itemid) < .@sell ){ .@sell = countitem($itemid); } zeny += ( .@sell * ($price/2) ); delitem $itemid,.@sell; $amount += .@sell; $buyback -= .@sell; next; mes "Transaction Complete."; close;}OnInitOnce:$itemid = 501; //Red Potion.$start_amount = 30000; // Amount available to start with.$price = 100; //Price per item.$buyback = 0; //Amount that can be bought back. Leave at 0.end;} OR Do you want it to work like an actual shop where you can buy the item, and it only restocks when that same item is sold back? (This can be emulated using a dynamic shop npc, bit more difficult but still very easy). Edited September 11, 2014 by GmOcean Quote Share this post Link to post Share on other sites
0 Jedzkie 58 Posted September 11, 2014 So, you want a NORMAL npc to sell the item and restock it. But you want it done via Menu options and text. prontera,150,180,4 script Stock_NPC 123,{switch( select( "Buy:Sell" ) ) { case 1: if( !$amount ){ mes "Sorry out of stock."; close; } mes "Currently Selling: "+ getitemname($itemid) +""; mes "Amount in stock: "+ $amount +""; mes "Price per: "+ $price +""; mes "How much would you like to buy?"; input .@purchase,1,$amount; if ( zeny < ( .@purchase * $price ) ){ mes "Not enough funds."; close;} zeny-= ( .@purchase * $price ); getitem $itemid,.@purchase; $amount -= .@purchase; next; mes "Transaction Complete."; close; case 2: mes "Currently Selling: "+ getitemname($itemid) +""; mes "Amount in stock: "+ $amount +""; mes "Sell back price: "+ ($price/2) +""; mes "How much would you like to buy?"; input .@sell,1,10000; if( countitem($itemid) < .@sell ){ .@sell = countitem($itemid); } zeny += ( .@sell * ($price/2) ); delitem $itemid,.@sell; $amount += .@sell; next; mes "Transaction Complete."; close;}OnInitOnce:$itemid = 501; //Red Potion.$start_amount = 30000; // Amount available to start with.$price = 100; //Price per item.end;} OR Do you want it to work like an actual shop where you can buy the item, and it only restocks when that same item is sold back? (This can be emulated using a dynamic shop npc, bit more difficult but still very easy). Hi GMOcean, thanks for your time... the settings are ok, but i want like this, starting amount for buy is 30000.. selling is 0.. if i sell 1 Red Potion, the buy amount will deduct and the sell amount will increase.. vise versa. Quote Share this post Link to post Share on other sites
0 GmOcean 92 Posted September 11, 2014 Updated my post with the script. Quote Share this post Link to post Share on other sites
0 evilpuncker 503 Posted September 11, 2014 Updated my post with the script. use npc variables instead of global ones =P Quote Share this post Link to post Share on other sites
0 GmOcean 92 Posted September 11, 2014 (edited) I thought about it, but I figured with a script like this you wouldn't want it to reset if server crashed or went down for any reason. You know, cuz there must be a reason why there is only 30,000 available lol. If I were to use npcvars instead of permglobals then there would be a very likely chance of more floating in circulation upon an abrupt server down time D: Edited September 11, 2014 by GmOcean 1 AnnieRuru reacted to this Quote Share this post Link to post Share on other sites
0 evilpuncker 503 Posted September 11, 2014 I thought about it, but I figured with a script like this you wouldn't want it to reset if server crashed or went down for any reason. You know, cuz there must be a reason why there is only 30,000 available lol. If I were to use npcvars instead of permglobals then there would be a very likely chance of more floating in circulation upon an abrupt server down time D: for itemid and price xD Quote Share this post Link to post Share on other sites
0 GmOcean 92 Posted September 11, 2014 Oh, duh lmao. I thought I did change those D: I must spammed ctrl+z too much. I'll change it again when I get home. Lol. Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted September 11, 2014 where is *checkweight ? and OnInitOnce ... this is a custom label you created, or you actually means OnInterIfInitOnce ? this label only execute once when server is online if the server shut down, and restart, $start_amount is gonna reset Quote Share this post Link to post Share on other sites
0 GmOcean 92 Posted September 11, 2014 (edited) XD Yeah, it appears the version i was working on isn't the one I uploaded lol. I had 2 copies open, and copied the wrong one over xD. And, I've never had an issue with weight before, sure i've gone to max, but I was also able to go past max, like 110% weight. So I never really dropped anything, did all that change? God it's been awhile since I looked at the manual for simpler things T.T; prontera,150,180,4 script Stock_NPC 123,{switch( select( "Buy:Sell" ) ) { case 1: if( !.amount ){ mes "Sorry out of stock."; close; } mes "Currently Selling: "+ getitemname(.itemid) +""; mes "Amount in stock: "+ .amount +""; mes "Price per: "+ .buy_price +""; mes "How much would you like to buy?"; input .@purchase,1,.amount; if ( Zeny < ( .@purchase * .buy_price ) ){ mes "Not enough funds."; close;} freeloop(1); while( !checkweight( .itemid, .@purchase ) && .@purchase >= 1 ) { .@purchase--; if( !.@purchase ){ mes "Sorry, you can't hold this much."; close; } } freeloop(0); Zeny-= ( .@purchase * .buy_price ); getitem .itemid,.@purchase; .amount -= .@purchase; $buyback += .@purchase; next; mes "Transaction Complete."; close; case 2: if( !$buyback ){ mes "Sorry, I'm currently over stocked."; close; } mes "Currently Selling: "+ getitemname(.itemid) +""; mes "Amount I can buy back: "+ $buyback +""; mes "Sell back price: "+ .sell_price +""; mes "How much would you like to sell?"; input .@sell,1,$buyback; if( countitem(.itemid) < .@sell ){ .@sell = countitem(.itemid); } Zeny += ( .@sell * .sell_price ); delitem .itemid,.@sell; .amount += .@sell; $buyback -= .@sell; next; mes "Transaction Complete."; close;}OnInit:.itemid = 501;.amount = 30000 - $buyback;.buy_price = 100;.sell_price = ( .buy_price / 2 );} Edit: Okay, this one works as intended, with checkweight, and only 1 perm variable that is only set when making purchases. And it will still regulate that there is only 30,000 items in flotation. (Assuming this is the only way to obtain it). Everyone happy now xD jk lol. It'll also reduce the amount you can buy to max out your weight should you input an incredibly large number like 999999999. Edited September 11, 2014 by GmOcean Quote Share this post Link to post Share on other sites
Hi! can i request a stock npc? for example, the maximum stocks is 30000 if i buy a 1 Red potion worth 100z, the stocks will become 29999, then i will sell it by 50z. the stocks will become 30000 again.. thanks!
Share this post
Link to post
Share on other sites