Aller au contenu
Top-Metin2.org - Vous êtes à la recherche d'un serveur Metin 2 ? ×
×
×
  • Créer...

Create a Shop with a NPC


Rweys

Messages recommandés

Hello everybody,

French versionCréer / Modifier un magasin PNJ

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

  • Vnum = 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!

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

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

Lien vers le commentaire
Partager sur d’autres sites

  • Réponses 0
  • Créé
  • Dernière réponse

Meilleurs contributeurs dans ce sujet

Jours populaires

Meilleurs contributeurs dans ce sujet



  • brilliantdiscord_widget
  • Flux d'Activité

    1. 37
    2. 21

      Metin2 en 2020 peut-on en parler?

    3. 0

      METIN2Project

    4. 3

      Ressources - UnPack - Metin2 Client - Officiel

    5. 0

      Barre des tâches d'argent étendue

    6. 16

      Redémarrage automatique des channels

    7. 16

      Multi Logo GM / SGM / GA

  • En ligne récemment

    • Aucun utilisateur enregistré regarde cette page.

Information importante

Conditions d’utilisation / Politique de confidentialité / Règles / Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer.