Welcome!

Join our community of MMORPG enthusiasts and private server developers! By registering, you'll gain access to in-depth discussions on source codes, binaries, and the latest developments in MMORPG server files. Collaborate with like-minded individuals, explore tutorials, and share insights on building and optimizing private servers. Join us today and unlock the full potential of MMORPG server development!

Join Today!

No wonder NPCs (Vendors) dont work... L2J 

Status
Not open for further replies.
Newbie Spellweaver
Joined
Aug 2, 2003
Messages
28
Reaction score
0
Location
Derbyshire (England)
They aint sodding linked to any files etc which contain their instructions and content.

I can't see why we dont just set them up same as in the Legend of Mir servers, were each NPC Vendor is given a set name which links them to their buy file.

e.g. Vendor1 = buy15

It makes sense, just I'm not sure how about to go about it. :rolleyes:

The way we are all trying to do this atm is way to complicated, think simple. :p
 
lol

lol they are linked
inside the class files :P
but it aint as simple as npc1 = buy1 etc
much harder if u look at the class file at npc ou will see it lays out aq template so we cant just edit the cvs for npc becuase we end up with more error and the game wouldnt load etc
 
Upvote 0
im sorta with u but i dont know how to fix the problem.. someone gimme a hand?? i wanna have npcs that work too :/
 
Upvote 0
lol

no one has them to work ok here is wht i got from the npc.class fiel



// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 04/07/2004 08:16:48
// Home Page : - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: NpcTable.java

package net.sf.l2j.gameserver;

import java.io.*;
import java.util.HashMap;
import java.util.StringTokenizer;
import net.sf.l2j.gameserver.templates.L2Npc;

public class NpcTable
{

public static NpcTable getInstance()
{
if(_instance == null)
_instance = new NpcTable();
return _instance;
**

private NpcTable()
{
_npcs = new HashMap();
LineNumberReader lnr = null;
try
{
File skillData = new File("data/npc.csv");
lnr = new LineNumberReader(new BufferedReader(new FileReader(skillData)));
for(String line = null; (line = lnr.readLine()) != null;)
if(line.trim().length() != 0 && !line.startsWith("#"))
{
L2Npc npc = parseList(line);
_npcs.put(new Integer(npc.getNpcId()), npc);
**

System.out.println("created " + _npcs.size() + " NPC templates");
**
catch(FileNotFoundException e)
{
System.out.println("npc.csv is missing in data folder");
**
catch(Exception e)
{
System.out.println("error while creating npc table " + e);
**
finally
{
try
{
lnr.close();
**
catch(Exception e1) { **
**
**

private L2Npc parseList(String line)
{
StringTokenizer st = new StringTokenizer(line, ";");
L2Npc npc = new L2Npc();
int id = Integer.parseInt(st.nextToken());
if(id > 0xf4240)
id -= 0xf4240;
npc.setNpcId(id);
npc.setName(st.nextToken());
npc.setType(st.nextToken());
npc.setRadius(Double.parseDouble(st.nextToken()));
npc.setHeight(Double.parseDouble(st.nextToken()));
return npc;
**

public L2Npc getTemplate(int id)
{
return (L2Npc)_npcs.get(new Integer(id));
**

private static NpcTable _instance;
private HashMap _npcs;
**


thats all of it if you read through even if you dont understand java shoudl get it
i dont even know java and i understand most of it
like this roe

if(id > 0xf4240)
id -= 0xf4240;
npc.setNpcId(id);

that is if id more than 0xf4240 ( which is 1000000 ) and id = 0xf4240 then so on

see, all npc r linked just one mistake somewere they make the error for the rest :(


hope that helps
 
Upvote 0
erm, my java isn't even half pass 1 so forgive me if i am making a mistake but
from what i see here, the class Npctable is just instanciating the NpcTable() method to read from data/npc.csv and dealing with any exceptions
and then reading line by line from the file then returning the values

doesn't have anything to do with making vendors work
 
Upvote 0
Correct dim, all this does is Identify what a npc is, whether its a monster/fighter or whether its a Vendor, what I'm saying though is cant we use the NPCId's to make things easier in making shops you wud just put summot like

3440 (this would be the npcId) = 14 (this would be the buy value)
 
Upvote 0
ah, i get what you mean now

hmm, how bout using the gm commands like the .buy# method, modify it and link it with when you click the npc, it'll open the buy window.
so just hardcode the buylist id to the individual npc

hey, isn't the human npcs working? just look at those?
:D
 
Upvote 0
Status
Not open for further replies.
Back