Jump to content
Foxseiz

Black Market NPC

Recommended Posts

Black Market NPC

 

Well this is a guide on how to edit the npc "Black Market Merchant", i'll show you how to edit the shop page and the "DoExchange" function.

Sections:
Shop Page -- Script 
DoExchange -- Script 
DoExchange -- Item Modifier

Section One: Shop Page (Script)
 

function leo_talk10()	

  Talk(1, "Black Market Merchant: Hoho, you must be somebody to locate me. Hoho, what do you need?")
  Text( 1, "Show me your Black Marcket", JumpPage, 2 )
  Text( 1, "Shop", BuyPage)

  Talk(2,"Black Market Merchant: Hoho, you are well-informed indeed...How you wish to exchange?")
  Text(2,"Let me take a look at your things first", SendExchangeData )

  InitExchange()
  DoExchange()

  InitTrade()
  Other(	rand()	)
  Other(	rand()	)
  Other(	rand()	)
  Other(	rand()	)
  Other(	rand()	)
  Other(	rand()	)
  Other(	rand()	)
  Other(	rand()	)

  InitTrigger()
  TriggerAction( 1, AddNpcTrigger, 53, TE_GAMETIME, TT_CYCLETIME, 120, 4 )
  SetNpcTrigger( GetTrigger( 1 ) )
  SetNpcActive()

end
function rand()

  local tabunknow = {}

  tabunknow[	1	] =	0088
  tabunknow[	2	] =	0089
  tabunknow[	3	] =	3302
  tabunknow[	4	] =	3303
  tabunknow[	5	] =	3304
  tabunknow[	6	] =	3305
  tabunknow[	7	] =	3306
  tabunknow[	8	] =	3307
  tabunknow[	9	] =	3308
  tabunknow[	10	] =	3309
  tabunknow[	11	] =	3310
  tabunknow[	12	] =	3311
  tabunknow[	13	] =	3312
  tabunknow[	14	] =	3313
  tabunknow[	15	] =	3314
  tabunknow[	16	] =	3315
  tabunknow[	17	] =	3316
  tabunknow[	18	] =	3317
  tabunknow[	19	] =	3318
  tabunknow[	20	] =	3319
  tabunknow[	21	] =	3320
  tabunknow[	22	] =	3321
  tabunknow[	23	] =	3322
  tabunknow[	24	] =	3323
  tabunknow[	25	] =	3324
  tabunknow[	26	] =	3325
  tabunknow[	27	] =	3326
  tabunknow[	28	] =	3327
  tabunknow[	29	] =	3328
  tabunknow[	30	] =	3329
  tabunknow[	31	] =	3330
  tabunknow[	32	] =	3331
  tabunknow[	33	] =	3332
  tabunknow[	34	] =	3333
  tabunknow[	35	] =	3334

  return tabunknow[math.floor(math.random(1,35))]

end
 TriggerAction( 1, AddNpcTrigger, 53, TE_GAMETIME, TT_CYCLETIME, 120, 4 )

That's the cycle time... I guess it's minutes so 120/60 = every 2 hours. So just change it to how many minutes you want.

If you want to add more tust use this code:

tabunknow[	##	] =	****

## = Next tabunknow

**** = Item ID

And be sure to change this:

return tabunknow[math.floor(math.random(1,##))]

## = Last "tabunknow"


That's about all I know about it. Hope you find it usefull.


Section Two: DoExchange (Script)
 

function DoExchange()

    local intMoney =0
    local intGoods =0
    local intMoneyNum =0
    local intNum=0
    local intCount=0

    for intCount=1 , 8 ,1 do
    intNum = math.floor(math.random(1,4))
      if intNum == 1 then	-
        intMoney = 1028
        intMoneyNum = 2
        intGoods = MoliTable[math.floor(math.random(1,12))]
      elseif intNum ==2 then
        intMoney = 3457
        intMoneyNum = 1
        intGoods = NakaTable[math.floor(math.random(1,22))]
      elseif intNum ==3 then
        intMoney = 855
        intMoneyNum = 1000
        intGoods = CoinTable1000[math.floor(math.random(1,36))]
      elseif intNum ==4 then
        intMoney = 855
        intMoneyNum = 600
        intGoods = CoinTable600[math.floor(math.random(1,56))]
      end
	ExchangeData( intMoney, intMoneyNum , intGoods, 1, 1 )
	end
end

You see where it says: "intGoods"?

CoinTable600, CoinTable1000, MoliTable & NakaTable ?

Well those are variables, that tell where to get the items that are shown.

For example in my server files it shows random unseal level 35 - 65. So you can change what it shows within ScriptSdk.lua.

By looking at these functions:


MoliTable ={}

NakaTable ={}

CoinTable1000 ={}

CoinTable600 ={}

MoliTable[1]=0766
MoliTable[2]=0769
MoliTable[3]=0773
MoliTable[4]=0776
MoliTable[5]=0780
MoliTable[6]=0784
MoliTable[7]=0788
MoliTable[8]=0792
MoliTable[9]=0795
MoliTable[10]=0798
MoliTable[11]=0802
MoliTable[12]=0806
NakaTable[1]=0765
NakaTable[2]=0768
NakaTable[3]=0772
NakaTable[4]=0775
NakaTable[5]=0779
NakaTable[6]=0783
NakaTable[7]=0787
NakaTable[8]=0791
NakaTable[9]=0794
NakaTable[10]=0797
NakaTable[11]=0801
NakaTable[12]=0805
NakaTable[13]=0807
NakaTable[14]=0808
NakaTable[15]=0809
NakaTable[16]=0810
NakaTable[17]=0811
NakaTable[18]=0812
NakaTable[19]=0813
NakaTable[20]=0814
NakaTable[21]=0815
NakaTable[22]=0877
CoiNTable1000[1]=0764
CoiNTable1000[2]=0767
CoiNTable1000[3]=0771
CoiNTable1000[4]=0774
CoiNTable1000[5]=0778
CoiNTable1000[6]=0782
CoiNTable1000[7]=0786
CoiNTable1000[8]=0790
CoiNTable1000[9]=0793
CoiNTable1000[10]=0796
CoiNTable1000[11]=0800
CoiNTable1000[12]=0804
CoiNTable1000[13]=0764
CoiNTable1000[14]=0767
CoiNTable1000[15]=0771
CoiNTable1000[16]=0774
CoiNTable1000[17]=0778
CoiNTable1000[18]=0782
CoiNTable1000[19]=0786
CoiNTable1000[20]=0790
CoiNTable1000[21]=0793
CoiNTable1000[22]=0796
CoiNTable1000[23]=0800
CoiNTable1000[24]=0804
CoiNTable1000[25]=0764
CoiNTable1000[26]=0767
CoiNTable1000[27]=0771
CoiNTable1000[28]=0774
CoiNTable1000[29]=0778
CoiNTable1000[30]=0782
CoiNTable1000[31]=0786
CoiNTable1000[32]=0790
CoiNTable1000[33]=0793
CoiNTable1000[34]=0796
CoiNTable1000[35]=0800
CoiNTable1000[36]=0804
CoiNTable600[1]=0763
CoiNTable600[2]=0770
CoiNTable600[3]=0777
CoiNTable600[4]=0781
CoiNTable600[5]=0785
CoiNTable600[6]=0789
CoiNTable600[7]=0799
CoiNTable600[8]=0803
CoiNTable600[9]=0763
CoiNTable600[10]=0770
CoiNTable600[11]=0777
CoiNTable600[12]=0781
CoiNTable600[13]=0785
CoiNTable600[14]=0789
CoiNTable600[15]=0799
CoiNTable600[16]=0803
CoiNTable600[17]=0763
CoiNTable600[18]=0770
CoiNTable600[19]=0777
CoiNTable600[20]=0781
CoiNTable600[21]=0785
CoiNTable600[22]=0789
CoiNTable600[23]=0799
CoiNTable600[24]=0803
CoiNTable600[25]=0763
CoiNTable600[26]=0770
CoiNTable600[27]=0777
CoiNTable600[28]=0781
CoiNTable600[29]=0785
CoiNTable600[30]=0789
CoiNTable600[31]=0799
CoiNTable600[32]=0803
CoiNTable600[33]=0763
CoiNTable600[34]=0770
CoiNTable600[35]=0777
CoiNTable600[36]=0781
CoiNTable600[37]=0785
CoiNTable600[38]=0789
CoiNTable600[39]=0799
CoiNTable600[40]=0803
CoiNTable600[41]=0763
CoiNTable600[42]=0770
CoiNTable600[43]=0777
CoiNTable600[44]=0781
CoiNTable600[45]=0785
CoiNTable600[46]=0789
CoiNTable600[47]=0799
CoiNTable600[48]=0803
CoiNTable600[49]=0763
CoiNTable600[50]=0770
CoiNTable600[51]=0777
CoiNTable600[52]=0781
CoiNTable600[53]=0785
CoiNTable600[54]=0789
CoiNTable600[55]=0799
CoiNTable600[56]=0803

So yes, you can change items that are shown for xxchange.

MoliTable = Unseals Lv 65

NakaTable = Unseals Lv 55

CoinTable1000 = Unseals Lv 45

CoinTable600 = Unseals Lv 35

Feel free to change anything...

Section Three: DoExchange (Item Modifier)
 

function DoExchange()

  local intMoney =0
  local intGoods =0
  local intMoneyNum =0
  local intNum=0
  local intCount=0

  for intCount=1 , 8 ,1 do
  intNum = math.floor(math.random(1,4))
    if intNum == 1 then
      intMoney = 1028
      intMoneyNum = 2
      intGoods = MoliTable[math.floor(math.random(1,12))]
    elseif intNum ==2 then
      intMoney = 3457
      intMoneyNum = 1
      intGoods = NakaTable[math.floor(math.random(1,22))]
    elseif intNum ==3 then
      intMoney = 855
      intMoneyNum = 1000
      intGoods = CoinTable1000[math.floor(math.random(1,36))]
    elseif intNum ==4 then	-
      intMoney = 855
      intMoneyNum = 600		
      intGoods = CoinTable600[math.floor(math.random(1,56))]
    end
  ExchangeData( intMoney, intMoneyNum , intGoods, 1, 1 )
  end
end

The function where it says "intMoney".

Example:

intMoney = 1028

(ID 1028 = Morph Runestone)

That asks for Morph Runestone. You can change it to whatever you want. You can also change the amount it asks for the item, function "intMoneyNum".

intMoneyNum = 2

Change the number to the quantity of the item to be required.

 

 

Credits: Angelix

  • Like 3

Share this post


Link to post
Share on other sites
On 5/7/2016 at 1:11 PM, Foxseiz said:

Note: I don't know who owns this guide, it's been posted by serverdev admin so I'm sure it's not his guide.

It was made by me back on first versions of ServerDev. I went by the nickname of "xSoulx" if I remember correctly and if got changed to "martinez" (my last name) due to that being the user login. Can verify with the archives. :)

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
Reply to this topic...

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


×
×
  • Create New...