Hi!
This might be a easy one, but i cant figure it out. NPC Benjamin is spamming alot but not every sec. But to often anyway. How to make it slower?
This might be a easy one, but i cant figure it out. NPC Benjamin is spamming alot but not every sec. But to often anyway. How to make it slower?
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local thinkMsg = {
"If you need help with letters or parcels, just ask me. I can explain everything.",
"Hey, send a letter to your friend now and then. Keep in touch, you know.",
"No, no, no, there IS no parcel bug, I'm telling you!",
"Welcome to the post office!"
}
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
function thinkCallback(cid)
local rand = math.random(250)
if thinkMsg[rand] then
npcHandler:say(thinkMsg[rand])
end
return true
end
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
npcHandler:addModule(FocusModule:new())
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Benjamin" script="data/npc/scripts/Benjamin.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="116" body="79" legs="117" feet="76" addons="0"/>
<parameters>
<parameter key="module_shop" value="1" />
<parameter key="module_keywords" value="1" />
<parameter key="shop_buyable" value="parcel,2595,15;letter,2597,8;" />
<parameter key="message_greet" value="Hello. How may I help you |PLAYERNAME|? Ask me to {trade} if you would like to buy something. I can also explain the {mail} system."/>
<parameter key="keywords" value="name;mail;frodo;" />
<parameter key="keyword_reply1" value="My name is Benjamin, however not from the Royal Tibia Line." />
<parameter key="keyword_reply2" value="The mail system? Hmm, you can purchase a {parcel}, {label}, or a {letter} to send information and goods accross the world. Remember to write their name on the first line and their city beneath it!" />
<parameter key="keyword_reply3" value="Frodo? Shh...he may over hear us." />
<parameter key="message_farewell" value="It was a pleasure to help you, |PLAYERNAME|."/>
<parameter key="message_walkaway" value="Good bye..." />
<parameter key="message_sendtrade" value="Here. Don't forget that you need to buy a label too if you want to send a parcel. Always write the name of the {receiver} in the first line and the name of the {city} in the second line." />
</parameters>
</npc>