NPC Shop

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
OrcBubba
Posts: 50
Joined: Mon Mar 18, 2013 7:04 pm

NPC Shop

Post by OrcBubba »

Hi guys. I am trying to make an NPC shop just for fun. I am have some trouble though. I have searched for help before posting this because I didn't want to waste anyone's time but could only find the old SQL way of doing it. So here goes... I made my NPC for the shop, that is working. I made a mutisell file for the items. I made a htm file for the shop dialogue and that is working. But when I click on the shop link, nothing happens and the dialogue box goes away. I know I have something not linked correctly but cant figure it out. Here's what I got.

The custom NPC id is 99
The multisell is 99.xml in the game\data\multisell directory
The htm file is in the game\data\html\merchant directory

The only thing I can figure is wrong may be this
<a action="bypass -h npc_%objectid%_multisell 99"><font> Text Here </font></a><br>

Thanks for the help!
TPK
Posts: 19
Joined: Sat May 30, 2015 1:36 pm

Re: NPC Shop

Post by TPK »

game\data\scripts.cfg

# Custom
custom/EchoCrystals/EchoCrystals.java
custom/ShadowWeapons/ShadowWeapons.java
custom/NewbieCoupons/NewbieCoupons.java
custom/RaidbossInfo/RaidbossInfo.java
custom/NpcLocationInfo/NpcLocationInfo.java
custom/Validators/SubClassSkills.java

add
custom/your npc shop/__init__.py
or
custom/your npc shop/yournpcshop.java



game\data\stats\npcs\custom\custom.xml
<npc id="99" displayId="what you want" name="what you want" usingServerSideName="true" title="what you want" usingServerSideTitle="true" type="L2Npc">
<collision>
<radius normal="24" />
<height normal="32" />
</collision>
</npc>
User avatar
Avanael92
Advanced User
Advanced User
Posts: 189
Joined: Thu Aug 07, 2014 5:26 pm
Location: Germany

Re: NPC Shop

Post by Avanael92 »

Shops usually aren't scripted in java, you only need HTML and XML for it.

Zoey already made a guide for creating a NPC here: https://github.com/L2J/L2J_Server/wiki/Add-a-custom-NPC

Since your html is in merchant folder, it's important that the type should be L2Merchant and also radius/height should be exactly the same from the NPC ID that you take for display/appearance. Should look like this for you:

Code: Select all

<npc id="99" displayId="4307" level="80" type="L2Merchant" name="Evil Santa Claus"
        usingServerSideName="true" title="My First Custom NPC" usingServerSideTitle="true">
    <sex>MALE</sex>
    <collision>
        <radius normal="25" />
        <height normal="35" />
    </collision>
</npc>
Multisells also should be in the custom folder in multisell directory too, just as a note.
User avatar
OrcBubba
Posts: 50
Joined: Mon Mar 18, 2013 7:04 pm

Re: NPC Shop

Post by OrcBubba »

I've tried everything I can think of to get it to work but when I click on the NPC's dialogue box to shop, nothing happens. This is the part I think I have wrong. I found it on another site when I was searching for a solution. But could be outdated or something.


<a action="bypass -h npc_%objectid%_multisell 99"><font> Text Here </font></a><br>

I put the mutisell in the custom folder also.

Does this look correct?

Thanks
User avatar
Avanael92
Advanced User
Advanced User
Posts: 189
Joined: Thu Aug 07, 2014 5:26 pm
Location: Germany

Re: NPC Shop

Post by Avanael92 »

Tried to reproduce your problem, on a closer look I found a typo in your bypass.

<a action="bypass -h npc_%objectId%_multisell 99"><font> Text Here </font></a><br>

The red marked letter should be in uppercase.
User avatar
OrcBubba
Posts: 50
Joined: Mon Mar 18, 2013 7:04 pm

Re: NPC Shop

Post by OrcBubba »

You are the MAN! Thanks very much. That was the problem.
User avatar
Avanael92
Advanced User
Advanced User
Posts: 189
Joined: Thu Aug 07, 2014 5:26 pm
Location: Germany

Re: NPC Shop

Post by Avanael92 »

You're welcome :+1:
Post Reply