Travisani
New Member
- Joined
- Jul 19, 2023
- Messages
- 6
- Reaction score
- 1
Someone know how to do a heal and remove player condition like a real tibia on NPC's using TFS after say heal on temple npc?
Using the last files: GitHub - otland/forgottenserver: A free and open-source MMORPG server emulator written in C++ (https://github.com/otland/forgottenserver)
Not work:
Not Work too:
Using the last files: GitHub - otland/forgottenserver: A free and open-source MMORPG server emulator written in C++ (https://github.com/otland/forgottenserver)
Not work:
LUA:
function creatureSayCallback(cid, type, msg)
if npcHandler.focus ~= cid then
return false
elseif msgcontains(msg, "heal") then
if getCreatureCondition(cid, CONDITION_FIRE) then
npcHandler:say("You are burning. I will help you.", cid)
doRemoveCondition(cid, CONDITION_FIRE)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
elseif getCreatureCondition(cid, CONDITION_POISON) then
npcHandler:say("You are poisoned. I will help you.", cid)
doRemoveCondition(cid, CONDITION_POISON)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
elseif getCreatureHealth(cid) < 40 then
npcHandler:say("You are looking really bad. Let me heal your wounds.", cid)
doCreatureAddHealth(cid, 40 - getCreatureHealth(cid))
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
else
npcHandler:say("You aren't looking that bad. Sorry, I can't help you. But if you are looking for additional protection you should go on the pilgrimage of ashes.", cid)
end
end
return TRUE
end
Not Work too:
Code:
-- Healing
local function addHealKeyword(text, condition, effect)
keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = text},
function(player) return player:getCondition(condition) ~= nil end,
function(player)
player:removeCondition(condition)
player:getPosition():sendMagicEffect(effect)
end
)
end
addHealKeyword('You are burning. Let me quench those flames.', CONDITION_FIRE, CONST_ME_MAGIC_GREEN)
addHealKeyword('You are poisoned. Let me soothe your pain.', CONDITION_POISON, CONST_ME_MAGIC_RED)
addHealKeyword('You are electrified, my child. Let me help you to stop trembling.', CONDITION_ENERGY, CONST_ME_MAGIC_GREEN)
keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = 'You are hurt, my child. I will heal your wounds.'},
function(player) return player:getHealth() < 40 end,
function(player)
local health = player:getHealth()
if health < 40 then player:addHealth(40 - health) end
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
end
)
keywordHandler:addKeyword({'heal'}, StdModule.say, {npcHandler = npcHandler, text = 'You aren\'t looking that bad. Sorry, I can\'t help you. But if you are looking for additional protection you should go on the {pilgrimage} of ashes or get the protection of the {twist of fate} here.'})