Zorenia
Hoster of Zorenia
Request NPC SCRIPT, that heales in rookgaard when my hp below 65!! I can´t find any scripts does anyone have it for my? I use TFS 0.3b3
Thanks in advance,
Rick.
Thanks in advance,
Rick.
<npc name="Cipfried" script="data/npc/scripts/healer.lua" autowalk="0" floorchange="0">
<health now="100" max="100"/>
<look type="57" head="0" body="0" legs="0" feet="0" corpse="3058"/>
<parameters>
<parameter key="message_greet" value="Greetings |PLAYERNAME|." />
<parameter key="message_farewell" value="Good bye |PLAYERNAME|." />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="offer" />
<parameter key="keyword_reply1" value="I can heal you for free if you are hurt." />
</parameters>
</npc>
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
-------------------------------------Healing Part------------------------------
function healCreature(cid, message, keywords, parameters)
if(getCreatureHealth(cid) < parameters.maxheal) then
position = getCreaturePosition(npcHandler.focus)
doSendMagicEffect(position, 12)
local healHP = parameters.maxheal - getCreatureHealth(cid)
doCreatureAddHealth(npcHandler.focus,healHP)
selfSay('You are looking really bad. Let me heal your wounds.')
else
selfSay('You aren\'t looking really bad, ' .. getCreatureName(cid) .. '. I only help in cases of real emergencies. Raise your health simply by eating food.')
end
return true
end
function healCreatureNoMsg(cid, maxheal)
if(getCreatureHealth(cid) < maxheal) then
position = getCreaturePosition(npcHandler.focus)
doSendMagicEffect(position, 12)
local healHP = maxheal - getCreatureHealth(cid)
doCreatureAddHealth(npcHandler.focus,healHP)
selfSay('Hello, ' .. getCreatureName(cid) .. '! You are looking really bad. Let me heal your wounds.')
end
return true
end
function tradeItem(cid, message, keywords, parameters) return npcHandler:defaultTradeHandler(cid, message, keywords, parameters) end
function confirmAction(cid, message, keywords, parameters) return npcHandler:defaultConfirmHandler(cid, message, keywords, parameters) end
function sayMessage(cid, message, keywords, parameters) return npcHandler:defaultMessageHandler(cid, message, keywords, parameters) end
function greet(cid, message, keywords, parameters)
if (npcHandler.focus > 0 or not(npcHandler.queue:isEmpty()) and npcHandler.focus ~= cid) then
selfSay('Please, ' .. creatureGetName(cid) .. '. Wait for your turn!.')
if(not npcHandler.queue:isInQueue(cid)) then
npcHandler.queue:pushBack(cid)
end
elseif(npcHandler.focus == 0) and (npcHandler.queue:isEmpty()) then
npcHandler.focus = cid
npcHandler.talkStart = os.clock()
if(getCreatureHealth(cid) >= 200) then
selfSay('Hello, ' .. creatureGetName(cid) .. '! I will heal you if you are injured. Feel free to ask me for help.')
else
healCreatureNoMsg(npcHandler.focus, 60)
end
end
return true
end
function farewell(cid, message, keywords, parameters) return npcHandler:defaultFarewellHandler(cid, message, keywords, parameters) end
keywordHandler:addKeyword({'heal'}, healCreature, {maxheal = 60})
keywordHandler:addKeyword({'help'}, healCreature, {maxheal = 60})
keywordHandler:addKeyword({'yes'}, confirmAction, nil)
keywordHandler:addKeyword({'no'}, confirmAction, nil)
npcHandler:addModule(FocusModule:new())