• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

{Request} Distacne NPC

Sagitta

Kebab
Joined
Sep 19, 2007
Messages
105
Reaction score
0
Location
Norway
Greetings!

I'm having big trouble creatning my own Paladin NPC that sells you everything from Spears to Crossbow

Ive tryed alot, but since i'm not a king scripter it wiped xD

Its like

15:48 Test [88]: hi
15:48 NPC: Welcome, Test! I have been expecting you.
15:48 Test [88]: royal spear
15:48 NPC: Do you want to buy 1 spear for 10 gold coins?
 
First here is the script.

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler::eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler::eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler::eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler::eek:nThink() end
-- OTServ event handling functions end

npcHandler:addModule(FocusModule:new())

Then the npc.
<npc name="Maya" script="data/npc/scripts/bows.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="142" head="79" body="118" legs="115" feet="114" corpse="2212"/>
<parameters>
<parameter key="module_shop" value="1" />
<parameter key="shop_sellable" value="crossbow,2455,150;bow,2456,130" />
<parameter key="shop_buyable" value="crossbow,2455,360;bow,2456,200;spear,2389,20;power bolt,2547,200;burst arrow,2546,56;poison arrow,2545,18;bolt,2543,3;arrow,2544,2" />
</parameters>
</npc>

If you want it to sell royal spear then change this.

;royal spear,id,offer

<npc name="Maya" script="data/npc/scripts/bows.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="142" head="79" body="118" legs="115" feet="114" corpse="2212"/>
<parameters>
<parameter key="module_shop" value="1" />
<parameter key="shop_sellable" value="crossbow,2455,150;bow,2456,130" />
<parameter key="shop_buyable" value="crossbow,2455,360;bow,2456,200;spear,2389,20;power bolt,2547,200;burst arrow,2546,56;poison arrow,2545,18;bolt,2543,3;arrow,2544,2;royal spear,id,offer" />
</parameters>
</npc>
 
Last edited:
Actually that is wrong, the Royal Spear, Hunting Spear, Enchanted Spear MUST be listed before normal spear, otherwise when You say -royal spear- he'll be talking about normal one. Ive had the same problem =).



If I'm wrong, sorry, but that how it was in my case.
 
Back
Top