Jump to content
×
×
  • Create New...

Sujet à réécrire : Create a Shop with a NPC


Rweys

Recommended Posts

Required level    : beginning

Estimating time  : between  15 and 30 minutes

 

 

Hello everybody,

If you are reading this tutorial it's that you want to learn more about metin2's shops isn't it?

So, let's take time to read and you are going to learn more about shops!

First, there are two kinds of shops, the easy ( when you are clicking on NPC a window opens directly) or multiple shops (when you are clicking on PNJS you are going to have several choices of shops by example : Swords, daggers....)

 

                                                                              Manage spawn

By the way : If a pnj is already bound to a quest (by example the Blacksmith) you have to make the shop via a quest (so follow the part several shops). Else the NPC  will  just  propose quest already bound without opening the shops

I) How to make a shop  EASY/Normal  kind

 

You just need to use navicat isn't wonderful? But maybe the item_name.txt if you dont want to know the id of an item and the mob_names.txt for the id  of a NPC!

 

Let's start !

:

Go on navicat, particularly on your database player, we are going to use the  table shop and the table shop_item. The table shop allow us to create the shop in itself and the table shop_item allows us to associate an item for sale from a shop among other to fill it.

Array

 

 

First step, we are going to create our shop !

For that, go on the table shop and let's see our little  columns.

140556telecharge.png

 

vnum =                a number that you are going to give to your shop ( a identification number) but care! Let's verify that the vnum is not already used by another shop! so if we have vnums going from one to six  ( so the server identify shops of the kind read : shop3 = shop= general store)

Name = The name is useless. But you can use it to indicate the contained of your shop. You can use that as a mark.

npc_vnum= It's the id of your NPC , you have to find the id of your NPC via the mob_names or mob_proto ( for example , here it's  the 9001) . Weapon shop dealer  = 9003. General store , 9009 = fisherman etc ..)

 

Once your line is personalised and created, save all of that ! Let's go to the second step ! Let's open  your table shop-item  and now let's take a look to the columns again !

 

141028telecharge.png

 

Shop_vnum = Do you remember about the number that you chose for your shop?  It's here that you have to place it ! Then the server will see that shop_vnum ( shop) has the item (item_vnum) with an equal quantity to (count)

item_vnum = If you have followed the line writen on top , you have understood that the item_vnum is to the ID of your item( that we can find it in the itemname or item proto).

count = it's simply the quantity for sale , care check  that your item is stackable else your shop will say you that your item will be sold by 200 but you will just receive one in your inventory !

Save your lines and let's reboot your server! Now click on your NPC and all is fine ! Congratulation, you have created your first shop !

 

II) How to create several shops

For those who have read my introduction you know that a normal shop cannot bound with a quest already here (example blacksmith have 4 quests,  among other you have to propose your shop in the choices when you click on the NPC. Else, you just want  to have several shops on one shop.

Here, we are going to use Navicat, Winscp , Notepadd++ and your logical, your logical !

First step: the creating of your shop ! For that let’s go to navicat in your database player look to the table shop

141304telecharge.png

 

Open this table and look to the columns. CARE : The using of those columns are different jut when we created a normal shop.

141418telecharge.png

 

Vnmum = the number which  will identify your shop , one vnum  = one shop. You cannot use that twice this number !

Name = This column is useless but you can write a name in order to locate yourself  in your shop ( in the BDD)

Npc_vnum = For several shops this columns is useless  because in reality they are bound to a quest , I’m going  to explain you after those  line !

 

So, once you have created new lines, save all of them. And  go to Notepadd++ don’t be surprised by the she can look hard to understand but  in reality it is very easy !

quest NOMQUETE begin

         state start begin

 

                          when IDPNJ.chat."NOMSHOP" begin

                                   npc . open_shop( IDSHOP )

                                   setskin(NOWINDOW)

                          end

 

                          when IDPNJ.chat."NOMSHOP" begin

                                   npc . open_shop( IDSHOP )

                                   setskin(NOWINDOW)

                          end

 

                          when IDPNJ.chat."NOMSHOP" begin

                                   npc . open_shop( IDSHOP )

                                   setskin(NOWINDOW)

                          end

                 end

         end

But what hell is that? I’m going to explain that you have to replace! And/or to add !

Right!

NOMQUETTE =  It’s the name of your quest, choose a easy number  and handy by example magasinmult !

IDPNJ = The id of your NPC  that you can to find in your mob_proto or mob_name ( example : general store= 9003)

NomShop = First, don’t delete the “ “ else you  are going to break all , but again, once the name has been choosen  that here  will represent the content of your shop  ( example  : swords, bows, daggers)

IDSHOP = the vnum ( remember of the first line of your table shop= it’s here that you have to put it! And don’t forget, one vnum = one shop

 

So, for those who want  more than 3 shops with different NPC you just have to copie  paste  this code following of the first and to edit it. After, you can add commentary to locate yourself better ( commentary don’t appear  in game )

when IDPNJ.chat."NOMSHOP" begin
                                   npc . open_shop( IDSHOP )
                                   setskin(NOWINDOW)
                          end

Example of one commentary

-Mon commentaire exemple disons que le code en dessous correspond a la marchande---
                          when IDPNJ.chat."NOMSHOP" begin
                                   npc . open_shop( IDSHOP )
                                   setskin(NOWINDOW)
                          end

Of this fact , after good editing here is the example quest

when 9001.chat."Dagues" begin
                                   npc . open_shop( 102 )
                                   setskin(NOWINDOW)
                          end
 
                          when 9001.chat."Arcs" begin
                                   npc . open_shop( 103 )
                                   setskin(NOWINDOW)
                          end
                  end
         end

 

 

 

You are going to say but what do we do with that on Notepadd++  now? Save it  in fomat .quest and put it in the file : metin2/share/locale/france(or another coutry)/quest

141627telecharge.png

 

 You have to declare nearby of the server  and then in the file where you can find your quest there is a file  named : locale_list. Open it and add your quest ( to the end let an empty line).

141719telecharge.pngimg.funky-emu.net

Save  and write on your machine  : sh quest.sh

In game  do reload q with an GM character

Here is the result of our example quest !

141816telecharge.png

Wait, don’t leave ! There’s your shop to  fill it ( Remind : A normal shop  will be presented of the same way if it is declared with a quest already present and then instead to put a name of kind : Sword, I advice you to don’t write ( for example ) : Open my shop

Let’s back to Navicat ! Open the table shop_item already present in the database player

142046telecharge.png

Shop vnum = To the vnum (first column of the table shop ) , that’s to say the number which  identify your shop

Item vnum = the ID of your item ( that you can find to item_proto or item_name, by example : 19 = Sword+9 )

Count = The quantity for sale, care , check up that your item is stackable  else the shop is going to say that your item will be sold by 200 but you will just receive one in your inventory !

Add your lines and save    them! Now do a reboot via you console and now your several shops has been created and full  !

If you have question, do not hesite to ask them in  : A/S/Q  . I hope that this tutorial has been useful !

Created by Mei

Translated by Rweys.   My discord is Maître de Jeannot#1193   (my  discord)

 

 

 

 

Edited by Rweys
Link to comment
  • 7 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Administrateur

Bonjour,

 

Le partage / tutoriel ici présent doit être réécrit. Le lien de téléchargement est probablement mort... Message automatique de masse...

 

Cordialement,

ASIKOO

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.