• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Heal NPC for Jiddos NPC System [Finished]

Virgel

New Member
Joined
Jun 14, 2007
Messages
150
Reaction score
2
Finished Heal NPC for Jiddos NPC System (checked with Forgotten)

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 :)
 
I think he means that it should remove poison if you're poisoned. ;)
 
Ye, could someone re-edit it to delete poisonous?

Edit: It is not working for me anyway. When I say heal nothing happens.
 
Last edited:
We would need an error message if we'd be able to help you.
 
Hmm, whats about this one?

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

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 creatureSayCallback(cid, type, msg) 
origmsg = msg 
msg = string.lower(msg) 
         if msgcontains(msg, 'heal') then
                  local healed = FALSE
                  if getCreatureHealth(cid) < 65 then
                           doCreatureAddHealth(cid,65-getCreatureHealth(cid))
                           doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_BLUE)
                           healed = TRUE    
                  end
                  if hasCondition(cid, CONDITION_POISON) then
                           doRemoveCondition(cid, CONDITION_POISON)
                           doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_RED) 
                           healed = TRUE                  
                  end
                  if healed == TRUE then
                           npcHandler:say("Let me heal your wounds!", cid) 
                  else
                           npcHandler:say("You aren't looking so bad.", cid)
                  end
         end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Dear Virgel,

Dit u make this script since it looks 100% the same as mine, Altought i have sended my healing script to only 2 friends. My question to you is, Dit u make this script or not?
 
Back
Top