Jump to content
  • 0
Sign in to follow this  
KirieZ

Duplicate Trader NPC with different items

Question

Hello everybody,

While doing some tests with the trader npc,  I noticed that when I duplicate my trader, if I change the item list of one, all of them are affected.

 

For example:

-    trader    MyNpc#id    -1,{OnInit:    .@i = 400 + rand(0,10);    sellitem Red_Potion, .@i;    waitingroom "id: " + strnpcinfo(2) + " ; " + .@i, 0;end;}prontera,164,170,4    duplicate(MyNpc#id)    MyNpc#1    101prontera,164,168,4    duplicate(MyNpc#id)    MyNpc#2    101prontera,164,166,4    duplicate(MyNpc#id)    MyNpc#3    101prontera,164,164,4    duplicate(MyNpc#id)    MyNpc#4    101prontera,164,162,4    duplicate(MyNpc#id)    MyNpc#5    101

This was a test to get 5 shops that sells the same thing but with different prices, but when testing, all of them have the same sell value (but the chat room is different).

 

Is there a way to make each duplicate have a different item list? Thanks in advance.

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I found a "workaround", (I hope I'm not breaking any rule for double posting in less than 24h)

 

It seems that it is not possible to just duplicate the shop, so I made a function that all of these shops call when they init.

 

Code:

 

 

function	script	SetupShop	{	.@i = 400 + rand(0,10);	sellitem Red_Potion, .@i;	waitingroom "id: " + strnpcinfo(2) + " ; " + .@i, 0;	return;}prontera,164,170,4	trader	MyNpc#1	101,{OnInit:	callfunc("SetupShop");end;}prontera,164,168,4	trader	MyNpc#2	101,{OnInit:	callfunc("SetupShop");end;}prontera,164,166,4	trader	MyNpc#3	101,{OnInit:	callfunc("SetupShop");end;}prontera,164,164,4	trader	MyNpc#4	101,{OnInit:	callfunc("SetupShop");end;}prontera,164,162,4	trader	MyNpc#5	101,{OnInit:	callfunc("SetupShop");end;}

 

 

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.