data\npc\scripts\nomedoarquivo.lua
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
npcHandler:setMessage(MESSAGE_GREET, "posso te editar só uma vez diz (yes)") -- muda a frase menos yes
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'yes')) then
sto = getPlayerStorageValue(cid,55782)
if sto == -1 then
local h = 20000 -- quantos que vai aumenta na life
local m = 20000 -- quantos que vai aumenta na mana
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+(h))
doCreatureAddHealth(cid,h)
setCreatureMaxMana(cid, getPlayerMaxMana(cid)+(m))
doPlayerAddMana(cid,m)
setPlayerStorageValue(cid,55782,1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "pronto já te editei") -- muda frase
doSendMagicEffect(getCreaturePosition(cid), math.random(28,30))
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "huum pensa que me engana ja te editei safado...") -- muda a frase
return TRUE
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
data\npc\nomedoarquivo.xml
<npc name="NOMEDONPC" script="data/npc/scripts/nomedoarquivo.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="134" head="78" body="88" legs="0" feet="88" addons="3"/>
<parameters>
<parameter key="message_greet" value="OK." />
<parameter key="message_farewell" value="Tchau." />
<parameter key="message_walkaway" value="Tchau." />
</parameters>
</npc>