LucasFerraz
Systems Analyst
When player say hi
Why do not work?
LUA:
doRemoveCondition(cid, CONDITION_ENERGY)
doRemoveCondition(cid, CONDITION_PHYSICAL)
doRemoveCondition(cid, CONDITION_FIRE)
doRemoveCondition(cid, CONDITION_POISON)
npcHandler:say("Removed Condidions", cid)
if getPlayerHealth(cid) <= 100 then
doCreatureAddHealth(cid, 150)
npcHandler:say("take healt", cid)
end
Why do not work?
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
local cost = 0
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)
doRemoveCondition(cid, CONDITION_ENERGY)
doRemoveCondition(cid, CONDITION_PHYSICAL)
doRemoveCondition(cid, CONDITION_FIRE)
doRemoveCondition(cid, CONDITION_POISON)
npcHandler:say("Removed Condidions", cid)
if getPlayerHealth(cid) <= 100 then
doCreatureAddHealth(cid, 150)
npcHandler:say("take healt", cid)
end
if not npcHandler:isFocused(cid) then
return false
elseif msgcontains(msg, "twist") and msgcontains(msg, "fate") then
if getPlayerLevel(cid) < 31 then
cost = 2000
else
cost = ((getPlayerLevel(cid) - 30) * 200) + 2000
end
if cost > 20000 then
cost = 20000
end
selfSay('This is a special blessing I can bestow upon you once you have obtained at least one of the other blessings and which functions a bit differently. ...', cid)
selfSay('It only works when you\'re killed by other adventurers, which means that at least fourty percent of the damage leading to your death was caused by others, not by monsters or the environment. ...', cid)
selfSay('The {twist of fate} will not reduce the death penalty like the other blessings, but instead prevent you from losing your other blessings as well as the amulet of loss, should you wear one. It costs the same as the other blessings. ...', cid)
selfSay('Would you like to receive that protection for a sacrifice of '.. cost ..' gold, child?', cid)
Topic[cid] = 1
elseif Topic[cid] == 1 then
if msgcontains(msg, "no") then
npcHandler:say("You are free to decline my offer.", cid)
Topic[cid] = nil
elseif msgcontains(msg, "yes") then
if (getPlayerStorageValue(cid,88880) <=0) then
if (getPlayerMoney(cid) >= cost) then
if getPlayerBlessing(cid, 5) then
doPlayerRemoveMoney(cid,cost)
doPlayerAddPVPBlessing(cid)
selfSay('So receive the protection of the twist of fate, pilgrim.', cid)
Topic[cid] = 2
else
npcHandler:say("You don\'t have any of the other (blessings) nor an amulet of loss, so it wouldn\'t make sense to bestow this protection on you now. Remember that it can only protect you from the loss of those!", cid)
end
else
npcHandler:say("You don\'t have enough money", cid)
end
else
npcHandler:say("You already possess this blessing.", cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())