Jump to content
  • 0

Weekly item sale npc


Quesooo

Question


  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

can i request a npc that sell for a currency of gold coins ( 7720 )

 

limit of 5 items

 

every week the npc change the items inside it

 

also npc have message on the top of his head said " NEW ITEM ARRIVED"

 

thank you so much

Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

Here it is. All you need to do is Configure it at OnInit:
Everytime you loaded it. you need to Randomize the Items by talking to the NPC. Only GM Level >99 can see the randomize Option.

Link Here: ItemSale.txt

  • Upvote 1
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

Moved to script request

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

15 hours ago, Cyro said:

Moved to script request

ops sorry hahahah maybe i click wrong section i forgot

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   7
  • Joined:  08/10/17
  • Last Seen:  

On 10/7/2017 at 11:37 AM, Quesooo said:

can i request a npc that sell for a currency of gold coins ( 7720 )

limit of 5 items

MAP_NAME,X,Y,Z	script	Gold Coin Shop#spiritD	NPC_ID,{

	mes "Would you like to buy?";
	switch(select("No thanks:Yes please")){
	case 1:
		close;
	case 2:
		callshop "goldCoinShop",1;
	}

}
-	itemshop	goldCoinShop	-1,7720,501:1,502:2,503:3,504:4,505:5

 

On 10/7/2017 at 11:37 AM, Quesooo said:

every week the npc change the items inside it

You will have to change this manually.

On 10/7/2017 at 11:37 AM, Quesooo said:

also npc have message on the top of his head said " NEW ITEM ARRIVED"

Sorry, idk how to do this yet /swt2 

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

19 hours ago, SpiritD said:

MAP_NAME,X,Y,Z	script	Gold Coin Shop#spiritD	NPC_ID,{

	mes "Would you like to buy?";
	switch(select("No thanks:Yes please")){
	case 1:
		close;
	case 2:
		callshop "goldCoinShop",1;
	}

}
-	itemshop	goldCoinShop	-1,7720,501:1,502:2,503:3,504:4,505:5

 

You will have to change this manually.

Sorry, idk how to do this yet /swt2 

thank you so much

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

This is much possible..

You just need to make an array of items and everytime the server hits Monday. it will change the item random.. 
You can also limit players on buying the same items.
Somehow this is a good idea.. so if you will let me have the credit on making it. ill make it for you.. and ill post this as mine on script releases

Just send me a message.

Edited by Haruka Mayumi
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  197
  • Topics Per Day:  0.07
  • Content Count:  883
  • Reputation:   28
  • Joined:  02/13/17
  • Last Seen:  

17 hours ago, Haruka Mayumi said:

Here it is. All you need to do is Configure it at OnInit:
Everytime you loaded it. you need to Randomize the Items by talking to the NPC. Only GM Level >99 can see the randomize Option.

Link Here: ItemSale.txt

this is great thank you so much +100%

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  1187
  • Reputation:   161
  • Joined:  06/12/12
  • Last Seen:  

On 10/11/2017 at 7:08 PM, Haruka Mayumi said:

Here it is. All you need to do is Configure it at OnInit:
Everytime you loaded it. you need to Randomize the Items by talking to the NPC. Only GM Level >99 can see the randomize Option.

Link Here: ItemSale.txt

how to change all buying items into zeny.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

On 11/22/2017 at 9:44 AM, hendra814 said:

how to change all buying items into zeny.

    set .Currency$,"Zeny";

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  1187
  • Reputation:   161
  • Joined:  06/12/12
  • Last Seen:  

9 hours ago, Haruka Mayumi said:

    set .Currency$,"Zeny";

Thanks for your help.

i will try it

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1533
  • Reputation:   236
  • Joined:  08/03/12
  • Last Seen:  

On 10/11/2017 at 8:08 PM, Haruka Mayumi said:

Here it is. All you need to do is Configure it at OnInit:
Everytime you loaded it. you need to Randomize the Items by talking to the NPC. Only GM Level >99 can see the randomize Option.

Link Here: ItemSale.txt

Hello, this script can read rand start from zero when randomize the items. Do you have any idea to fix it ?

It will occur randomly while randomize item.

[Warning]: itemdb_search: Item ID 0 does not exists in the item_db. Using dummy data.
 

On 1/21/2019 at 6:50 AM, Chaos92 said:

Hello, this script can read rand start from zero when randomize the items. Do you have any idea to fix it ?

It will occur randomly while randomize item.
 

[Warning]: itemdb_search: Item ID 0 does not exists in the item_db. Using dummy data.
 

solved by changing this line :

set .rand,rand(0,getarraysize(.ItemLists));

to

set .rand,rand(getarraysize(.ItemLists)-1);

 

Thanks to @Hurtsky and @pajodex for their precious time !
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

58 minutes ago, Chaos92 said:

solved by changing this line :


set .rand,rand(0,getarraysize(.ItemLists));

to


set .rand,rand(getarraysize(.ItemLists)-1);

 

Thanks to @Hurtsky and @pajodex for their precious time !

it should be

.rand = rand(getarraysize(.ItemLists));

if you add -1 means the last index doesn't get random in

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  12/10/22
  • Last Seen:  

Hey, sorry for ressurect this post, but a lot of times, my itens are set to 0
image.png.60b01c4b42d7817c0eb242af109b37ed.png

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.

Edited by Mael
Use codebox
Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...