Finished Heal NPC for Jiddos NPC System (checked with Forgotten)
Create healer.lua and add this code
also create NPC named Janita (or other name):
Hope you like it
Create healer.lua and add this code
Code:
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)
if(cid ~= npcHandler.focus) then
return false
end
if msgcontains(msg, 'heal') then
health = getCreatureHealth(cid)
if health < 65 then
maxhealth = getCreatureMaxHealth(cid)
ammount = maxhealth - health
doCreatureAddHealth(cid, ammount)
selfSay('Let me heal you.')
else
selfSay('Sorry, you are not badly hurt')
end
end
end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end
npcHandler:addModule(FocusModule:new())
also create NPC named Janita (or other name):
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Janita" script="data/npc/scripts/healer.lua" autowalk="1" floorchange="0">
<health now="100" max="100"/>
<look type="57" head="0" body="0" legs="0" feet="0" addons="0"/>
</npc>
Hope you like it