ond
Veteran OT User
I'm releasing some NPCs I made, they might not be 100% exactly but they work fine!
NPCs works fine to Avesta 7.6
First, Simon the Beggar:
Script:
Second: Elathriel:
Script:
Third, Dermot:
Script:
Fourth, Skjaar:
Script:
I hope you'll enjoy 'em
NPCs works fine to Avesta 7.6
First, Simon the Beggar:
Code:
<?xml version="1.0"?>
<npc name="Simon the Beggar" script="simonthebeggar.lua" walkinterval="2000">
<health now="200" max="200" />
<look type="129" head="116" body="123" legs="123" feet="40" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. I am a poor man. Please help me." />
<parameter key="message_farewell" value="Have a nice day." />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="name;simon;job;beggar;gold;tibia;dermot;village;fibula;dungeon;timur;jetty;ship" />
<parameter key="keyword_reply1" value="My name is Simon. I am a very poor man." />
<parameter key="keyword_reply2" value="I am simon. The poorest human all over the continent." />
<parameter key="keyword_reply3" value="I have no job. I am a beggar." />
<parameter key="keyword_reply4" value="I have no gold and no job, so I am a beggar." />
<parameter key="keyword_reply5" value="I need gold. I love gold. I need help." />
<parameter key="keyword_reply6" value="Hehe, do you have a shovel? I can sell you a shovel if you want to return to Tibia." />
<parameter key="keyword_reply7" value="The magistrate of the village. I heard he is selling something for the Fibula Dungeon." />
<parameter key="keyword_reply8" value="To the north is the village Fibula. A very small village." />
<parameter key="keyword_reply9" value="I hate Fibula. Too many wolves are here." />
<parameter key="keyword_reply10" value="I heard a lot of the Fiubla Dungeon. But I never was there." />
<parameter key="keyword_reply11" value="I hate Timur. He is too expensive. But sometimes I find maces and hatches. Timur is buying these items." />
<parameter key="keyword_reply12" value="I hate this jetty. I have never seen a ship here." />
<parameter key="keyword_reply13" value="There is a large-sea-monster outside. I think there is no gritty captain to sail in this quarter." />
</parameters>
</npc>
Script:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|. I am a poor man. Please help me. ")
function greetCallback(cid)
-- Resetting talkState[talkUser]
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
talkState[talkUser] = 0
return true
end
function creatureSayCallback (cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, "help")) then
npcHandler:say("I need gold. Can you spend me 100 gold pieces?",cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, "yes") and talkState[talkUser] == 1) then
if doPlayerRemoveMoney(cid, 100) == TRUE then -- edit the amount of gold here
npcHandler:say("Thank you very much. Can you spare 500 more gold pieces for me? I will give you a nice hint.",cid)
talkState[talkUser] = 2
else
npcHandler:say("You don't have that much money.", cid)
talkState[talkUser] = 2
end
elseif(talkState[talkUser] == 1) then
npcHandler:say("Hmm, maybe next time.", cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, "yes") and talkState[talkUser] == 2) then
if doPlayerRemoveMoney(cid, 500) == TRUE then -- edit the amount of gold here
npcHandler:say("That's great! I have stolen something from Dermot. You can buy it for 200 gold. Do you want to buy it?",cid)
talkState[talkUser] = 3
else
npcHandler:say("You don't have that much money.", cid)
talkState[talkUser] = 3
end
elseif(talkState[talkUser] == 2) then
npcHandler:say("Hmm, maybe next time.", cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, "yes") and talkState[talkUser] == 3) then
if doPlayerRemoveMoney(cid, 200) == TRUE then -- edit the amount of gold here
key = doPlayerAddItem(cid,2089,1)
doSetItemActionId(key, 3940)
npcHandler:say("Now you own the hot key.",cid)
talkState[talkUser] = 4
else
npcHandler:say("You don't have that much money.", cid)
talkState[talkUser] = 4
end
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Second: Elathriel:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Elathriel" script="hell_gate_key.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="64" head="20" body="30" legs="40" feet="50" addons="1"/>
<parameters>
<parameter key="message_farewell" value="Asha Thrazi, stranger."/>
<parameter key="message_walkaway" value="Asha Thrazi, stranger." />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="elves;cenath;teshial;deraisim;kuridai;army;door;hellgate;king;magic;name;tibianus;eloise;time;druids;sorcerers;dwarfs;troll;excailbug;ferumbras" />
<parameter key="keyword_reply1" value="My people are divided in castes in these times, until they comprehend that only the way of the Kuridai can save us all." />
<parameter key="keyword_reply2" value="Arrogant bastards, but they wield quite powerful magics." />
<parameter key="keyword_reply3" value="Dreamers are of no practical use. I don't mourn their demise." />
<parameter key="keyword_reply4" value="Confused cowards. With all their skill they still tend to hide and run. What a waste." />
<parameter key="keyword_reply5" value="We are the heart of the elven society. We forge, we build, and we don't allow our people to be pushed around." />
<parameter key="keyword_reply6" value="It's one of the more useful concepts we can learn from the other races." />
<parameter key="keyword_reply7" value="For safety we keep the door to the hellgate locked all times. I have the keys to open it when needed." />
<parameter key="keyword_reply8" value="It was here among other structures, like the depot tower, before our people came here. It's secured by a sealed door." />
<parameter key="keyword_reply9" value="It's hard for some of my people to grasp the true concept of a strong leader." />
<parameter key="keyword_reply10" value="I mastered some spells of battle." />
<parameter key="keyword_reply11" value="Not that I like to talk to you, but I am Elathriel Shadowslayer." />
<parameter key="keyword_reply12" value="A human weakling, not much more." />
<parameter key="keyword_reply13" value="A human weakling, not much more." />
<parameter key="keyword_reply14" value="I couldn't care less." />
<parameter key="keyword_reply15" value="Druids' magic is to peaceful for my taste." />
<parameter key="keyword_reply16" value="I have seen human sorcerers doing some impressive things ... before they died." />
<parameter key="keyword_reply17" value="We might use the shelter earth and hills provide us, but their obsession for metal is a waste of time." />
<parameter key="keyword_reply18" value="Like all inferior races they can be at least used for something good. The other castes are just jealous about our use of them." />
<parameter key="keyword_reply19" value="I still doubt it exists." />
<parameter key="keyword_reply20" value="Even if he'd walk through the town above the other castes won't see the necessity to follow OUR way." />
</parameters>
</npc>
Script:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
npcHandler:setMessage(MESSAGE_GREET, "Be greeted |PLAYERNAME|.")
function greetCallback(cid)
-- Resetting talkState[talkUser]
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
talkState[talkUser] = 0
return true
end
function creatureSayCallback (cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, "key")) then
npcHandler:say("If you are that curious, do you want to buy a key for 5000 gold? Don't blame me if you get sucked in.",cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, "yes") and talkState[talkUser] == 1) then
if doPlayerRemoveMoney(cid, 5000) == TRUE then -- edit the amount of gold here
key = doPlayerAddItem(cid,2089,1)
doSetItemActionId(key, 3012)
npcHandler:say("Here you go.",cid)
talkState[talkUser] = 0
else
npcHandler:say("You don't have enough money.", cid)
talkState[talkUser] = 0
end
elseif(talkState[talkUser] == 1) then
npcHandler:say("Believe me, it's better for you that way.", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Third, Dermot:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Dermot" script="dermot.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="76" body="49" legs="19" feet="95" addons="0"/>
<parameters>
<parameter key="message_farewell" value="See you again."/>
<parameter key="message_walkaway" value="See you again."/>
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="job;magistrate;name;time;fibula;dungeon;monsters" />
<parameter key="keyword_reply1" value="I am the magistrate of this isle." />
<parameter key="keyword_reply2" value="Thats me." />
<parameter key="keyword_reply3" value="I am Dermot, the magistrate of this isle." />
<parameter key="keyword_reply4" value="Time is not important on Fibula." />
<parameter key="keyword_reply5" value="You are at Fibula. This isle is not very dangerous. Just the wolves bother outside the village3." />
<parameter key="keyword_reply6" value="Oh, my god. In the dungeon of Fibula are a lot of monsters. That's why we have sealed it with a solid door." />
<parameter key="keyword_reply7" value="Oh, my god. In the dungeon of Fibula are a lot of monsters. That's why we have sealed it with a solid door." />
</parameters>
</npc>
Script:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
npcHandler:setMessage(MESSAGE_GREET, "Be greeted |PLAYERNAME|.")
function greetCallback(cid)
-- Resetting talkState[talkUser]
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
talkState[talkUser] = 0
return true
end
function creatureSayCallback (cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'key') or msgcontains(msg, 'door')) then
npcHandler:say("Do you want to buy the dungeon key for 2000 gold?",cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, "yes") and talkState[talkUser] == 1) then
if doPlayerRemoveMoney(cid, 2000) == TRUE then -- edit the amount of gold here
key = doPlayerAddItem(cid,2089,1)
doSetItemActionId(key, 3940)
npcHandler:say("Here you go.",cid)
talkState[talkUser] = 0
else
npcHandler:say("You don't have enough money.", cid)
talkState[talkUser] = 0
end
elseif(talkState[talkUser] == 1) then
npcHandler:say("Believe me, it's better for you that way.", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Fourth, Skjaar:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Skjaar" script="skjaar.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="9" head="20" body="30" legs="40" feet="50" addons="0"/>
<parameters>
<parameter key="message_farewell" value="Run away, unworthy player!"/>
<parameter key="module_keywords" value="1" />
<parameter key="module_shop" value="1"/>
<parameter key="shop_sellable" value="" />
<parameter key="shop_buyable" value="" />
</parameters>
</npc>
Script:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
npcHandler:setMessage(MESSAGE_GREET, "It's good to see somebody who has chosen the path of wisdom. What do you want? ")
function greetCallback(cid)
-- Resetting talkState[talkUser]
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
talkState[talkUser] = 0
return true
end
function creatureSayCallback (cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, "key")) then
npcHandler:say("I will give the key to the crypt only to the closest followers of my master. Would you like me to test you?",cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, "yes") and talkState[talkUser] == 2) then
npcHandler:say("Before we start I must ask you for a small donation of 1000 gold coins. Are you willing to pay 1000 gold coins for the test?",cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, "yes") and talkState[talkUser] == 3) then
if doPlayerRemoveMoney(cid, 1000) == TRUE then
npcHandler:say("All right then. Here comes the first question. What was the name of Dago's favourite pet?",cid)
talkState[talkUser] = 4
elseif(msgcontains(msg, "redips") and talkState[talkUser] == 4) then
npcHandler:say("Perhaps you knew him after all. Tell me - how many fingers did he have when he died?",cid)
talkState[talkUser] = 5
elseif(msgcontains(msg, "7") and talkState[talkUser] == 5) then
npcHandler:say("Also true. But can you also tell me the colour of the deamons in which master specialized?",cid)
talkState[talkUser] = 6
elseif(msgcontains(msg, "black") and talkState[talkUser] == 6) then
npcHandler:say("It seems you are worthy after all. Do you want the key to the crypt?",cid)
talkState[talkUser] = 7
elseif(msgcontains(msg, "yes") and talkState[talkUser] == 7) then
key = doPlayerAddItem(cid,2089,1)
doSetItemActionId(key, 3142)
npcHandler:say("Here you go.",cid)
talkState[talkUser] = 8
end
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
I hope you'll enjoy 'em