SovietBR
-
Posts
6 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Jobs Available
Server Database
Third-Party Services
Top Guides
Store
Crowdfunding
Posts posted by SovietBR
-
-
Hey, love the script, but I was looking and I did't find where I put the items on the shop, or the value for them, can you show me, please?
-
Hi, I'm really really new at programing, and I was wonder if anyone could help me with this:
I'm looking to make an NPC who sell 10 random items at random prices, but I want to chose all itens he can sell and the range price for every item. And he reset the sells every 12h and announce that are new itens available for the server. Something like:
Item pool:
itemID/zeny (random at range):
756 / 500z - 1,000z
1260/ 1,000,000z - 2,500,000z
2609/ 1,000z - 1,500z
4110/ 2,000,000z - 2,300,000z
13404/ 3,000,000z - 3,200,000z
4435/ 5,000,000z - 7,000,000z
And then the NPC sell:
itemID/Zeny
756/ 650z
13404/ 3,119,020z
2609/ 2,956,126z
Thanks in advance for anyone who look at this!
-
Hey, sorry for ressurect this post, but a lot of times, my itens are set to 0
OnInit: //ITEM ID or #CASH/#PVPPOINTS set .Currency$,"Zeny"; //TOTAL ITEMS YOU WANT TO SEE IN THE SHOP- MAKE SURE THAT ITS COUNT IS LOWER THAN ITEMLIST set .TotalShopItems,5; //DAYS YOU WANT TO RESET at TICK Time 12:00AM e.g 0= Sunday, 1=Monday, 2=Tuesday and so on. setarray .Days[0],0,1,2,3,4,5,6; //TIME TICK BY HOURS. e.g 1= 1am, 8=8am, 14=2pm. setarray .Time[0],0,4,8,12,16,20; //12am,4am,8am,12pm,4pm,8pm //ITEMS LIST FOR RANDOM ITEMS SALE setarray .ItemLists[0],501,502,503,504,505,506,507,508,509,510,511,512; //COST OF ITEMS setarray .ItemCost[0],5000000,1000000,15000000,20000000; end; } - shop Item_Sale -1,501:100
Ok, I figure it out. The quantity of values in .setCost cannot be lower then the quantity of items on .ItemList, they have to bem proportional 1:1 (One item for one price), but this happens even if I put the .ItemCoast to rand, and I think this have relation with this part:
OnChangeItems: for(.@i=0;.@i<.TotalShopItems;.@i++){ .rand = rand(getarraysize(.ItemLists)); for(set .@l,0;.@l<.TotalShopItems;set .@l,.@l+1){ if(.ItemLists[.rand]==.ShopItem[.@l]){ .rand = rand(getarraysize(.ItemLists)); set .@l,-1; } } sleep2 100; set .ShopItem[.@i],.ItemLists[.rand]; set .ShopCost[.@i],.ItemCost[.rand];
Or this one:
function CheckCost { if( getitemname(atoi(getarg(0)))!= "null" ){ if(countitem(atoi(getarg(0)))< getarg(1) ) return 1; }else{ if(getd(getarg(0))< getarg(1)) return 1; } return 0; }
But I don't have enough knowledge yet to resolve this. If I do it, I'll be putting in here.Hey, I did it
///////////////////////////// //ITEM SALE AUTO RANDOM////// //by: Haruka Mayumi////////// //Version: 1.0/////////////// //Initial Script///////////// //Version: 1.1/////////////// //Added Hour Option////////// ///////////////////////////// alberta,195,138,1 script trader 97,{ function CheckCost; if(getgmlevel() >=99){goto Admin_Panel;} goto CheckShop; CheckShop: mes "[Item Sale]"; mes "Hello ^0000FF"+strcharinfo(0)+"^000000, We are having Item Sales!"; mes "You can buy the following items!."; if( getitemname( atoi( .Currency$ ) ) != "null" ){ mes "Currency - [~^0000FF"+getitemname( atoi( .Currency$ ) )+"^000000~]"; }else{ mes "Currency - [~^0000FF"+.Currency$+"^000000~]";} npcshopitem "Item_Sale",501,100; npcshopdelitem "Item_Sale",501; for(set .@i,0; .@i < getarraysize( .ShopItem ); .@i++) npcshopadditem "Item_Sale",.ShopItem[.@i],.ShopCost[.@i]; callshop "Item_Sale",1; npcshopattach "Item_Sale"; end; OnBuyItem: mes "[Item Sale]"; mes "This is your Bill:"; for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1){ for(set @j,0; @j < getarraysize( .ShopItem ); set @j,@j+1){ if( .ShopItem[@j] == @bought_nameid[@i] ){ set .@TotalCost,.@TotalCost + ( .ShopCost[@j] * @bought_quantity[@i] ); } } } for( set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1 ){ mes "^FF0000"+@bought_quantity[@i]+" x ^0000FF"+getitemname( @bought_nameid[@i] )+"^000000"; } mes "Total Cost: "+.@TotalCost; if( CheckCost(.Currency$,.@TotalCost)){ if(getitemname(atoi(.Currency$)) != "null" ){ mes "~Insufficient ^0000FF"+getitemname( atoi( .Currency$ ) )+"^000000"; }else{ mes "~Insufficient ^0000FF"+.Currency$+"^000000"; } }else{ next; if( select( "^0000FFPurchase^000000:Cancel" ) == 1 ){ if( getitemname( atoi( .Currency$ ) ) != "null" ) delitem atoi( .Currency$ ),.@TotalCost; else{ set getd( .Currency$ ),getd( .Currency$ ) - .@TotalCost; } for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1) getitem @bought_nameid[@i],@bought_quantity[@i]; mes "[Item Sale]"; mes "Thank you for shopping."; mes "Hope to see you againa!"; } } end; OnChangeItems: for(.@i=0;.@i<.TotalShopItems;.@i++){ .rand = rand(getarraysize(.ItemLists)); for(set .@l,0;.@l<.TotalShopItems;set .@l,.@l+1){ if(.ItemLists[.rand]==.ShopItem[.@l]){ .rand = rand(getarraysize(.ItemLists)); } } .ShopItem[.@i] = .ItemLists[.rand]; .ShopCost[.@i] = rand(.MaxPrice - .MinPrice + 1) + .MinPrice; if(.ShopItem[.@i] == 501){ .ShopCost[.@i] = 1; } } announce "Item Sales has been Changed! Come Check out the Items!",0; set .TotalShopItems,.@i; end; Admin_Panel: switch(select("Check Shop:Randomize Items:Cancel")){ case 1: goto CheckShop; case 2: mes "[Item Sale]"; mes "Please Wait for a while.."; mes "Randomizing the items now.."; goto OnChangeItems; case 3: end; } end; function CheckCost { if( getitemname(atoi(getarg(0)))!= "null" ){ if(countitem(atoi(getarg(0)))< getarg(1) ) return 1; }else{ if(getd(getarg(0))< getarg(1)) return 1; } return 0; } OnMinute00: //CHANGE HERE FOR MINUTE for(.@a=0;.@a<getarraysize(.Time);.@a++){ if(gettime(3)==.Time[.@a]){ for(.@i=0;.@i<getarraysize(.Days);.@i++){ if(gettime(DT_DAYOFWEEK)==.Days[.@i]){ goto OnChangeItems; } } } } end; OnInit: //ITEM ID or #CASH/#PVPPOINTS set .Currency$,"Zeny"; //TOTAL ITEMS YOU WANT TO SEE IN THE SHOP- MAKE SURE THAT ITS COUNT IS LOWER THAN ITEMLIST ITENS COM A LETRA D E F e G set .TotalShopItems,5; //DAYS YOU WANT TO RESET at TICK Time 12:00AM e.g 0= Sunday, 1=Monday, 2=Tuesday and so on. setarray .Days[0],1,3; //TIME TICK BY HOURS. e.g 1= 1am, 8=8am, 14=2pm. setarray .Time[0],0,4,8,12,16,20; //12am,4am,8am,12pm,4pm,8pm //ITEMS LIST FOR RANDOM ITEMS SALE setarray .ItemLists[0],502,501,503,504,505,1022,714,987,988,1130,1352,1452,1505,1552,1602,1730,1904,2005,2213,2214,2280,2514; //COST OF ITEMS //setarray .ItemCost[0],300,500; .MinPrice = 750000; // minimum price .MaxPrice = 1500000; // maximum price end; } - shop Item_Sale_tree -1,501:100
Now the NPC will get random values bethween the min and max price for individual items.
Showcase: NPC Buyingstore
in Source Releases
Posted
Hi, really nice script. Is there a way to make he buy random items peridicly? Like, every 12am he will buy different items and so on.