Jump to content
  • 0

Help about NPC


ShiroYasha

Question


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  57
  • Reputation:   0
  • Joined:  08/25/13
  • Last Seen:  

How can i put all the items in item_db2.txt to a  Merchant NPC? Thank You.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1131
  • Joined:  05/27/12
  • Last Seen:  

I'm assuming you mean in an automated fashion (otherwise it's very simple XD). To do so, you have to use an SQL item_db2 (or have it imported, at the very least). You can then have a script pull all the items from it.

Here's an example script - simply send a whisper to "syncshop" on an admin account to refresh your shop with any changes in item_db2.

prontera,150,150,0	shop	Example Shop	83,512:-1
	
-	script	syncshop	-1,{
OnWhisperGlobal:
	if (getgmlevel() < 99) end;
	dispbottom "Syncing your shop, please wait.";
	detachrid;
OnInit:
	npcshopitem "Example Shop",512,15;
	npcshopdelitem "Example Shop",512;
	set .@count, query_sql("SELECT `id`,`price_buy` FROM `item_db2`",.@id,.@price);
	for(set .@i,0; .@i<.@count; set .@i,.@i+1)
		npcshopadditem "Example Shop",.@id[.@i],.@price[.@i];
	end;
}
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   338
  • Joined:  10/17/12
  • Last Seen:  

I'm assuming you mean in an automated fashion (otherwise it's very simple XD). To do so, you have to use an SQL item_db2 (or have it imported, at the very least). You can then have a script pull all the items from it.

Here's an example script - simply send a whisper to "syncshop" on an admin account to refresh your shop with any changes in item_db2.

prontera,150,150,0	shop	Example Shop	83,512:-1
	
-	script	syncshop	-1,{
OnWhisperGlobal:
	if (getgmlevel() < 99) end;
	dispbottom "Syncing your shop, please wait.";
	detachrid;
OnInit:
	npcshopitem "Example Shop",512,15;
	npcshopdelitem "Example Shop",512;
	set .@count, query_sql("SELECT `id`,`price_buy` FROM `item_db2`",.@id,.@price);
	for(set .@i,0; .@i<.@count; set .@i,.@i+1)
		npcshopadditem "Example Shop",.@id[.@i],.@price[.@i];
	end;
}
Ive never thought to do this before, neat.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  57
  • Reputation:   0
  • Joined:  08/25/13
  • Last Seen:  

I'm assuming you mean in an automated fashion (otherwise it's very simple XD). To do so, you have to use an SQL item_db2 (or have it imported, at the very least). You can then have a script pull all the items from it.

Here's an example script - simply send a whisper to "syncshop" on an admin account to refresh your shop with any changes in item_db2.

prontera,150,150,0	shop	Example Shop	83,512:-1
	
-	script	syncshop	-1,{
OnWhisperGlobal:
	if (getgmlevel() < 99) end;
	dispbottom "Syncing your shop, please wait.";
	detachrid;
OnInit:
	npcshopitem "Example Shop",512,15;
	npcshopdelitem "Example Shop",512;
	set .@count, query_sql("SELECT `id`,`price_buy` FROM `item_db2`",.@id,.@price);
	for(set .@i,0; .@i<.@count; set .@i,.@i+1)
		npcshopadditem "Example Shop",.@id[.@i],.@price[.@i];
	end;
}

I'm sorry i didnt understand this xD where will i put this script? nad how would i send a whisper to it? thank you :)

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