Npc Healler
By: MatheusMkalo
Vá em data/npc/scripts e adicione um arquivo.lua com o nome de pokehealer.lua
Depois adicione o seguinte script dentro dele:
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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontainsalocal pokes = {
["Dragon"] = {corpseid = 5973, chance = 100, health = 12200, maxhealth = 12200},
["Dragon Lord"] = {corpseid = 5984, chance = 100, health = 12200, maxhealth = 12200},
["Demon"] = {corpseid = 5995, chance = 100, health = 12200, maxhealth = 12200},
}
local time = 4 -- Tempo para mandar as mensagens e adiciona item
function onUse(cid, item, frompos, item2, topos)
for i,x in pairs(pokes) do
if item2.itemid == x.corpseid then
doRemoveItem(item.uid, 1)
doRemoveItem(item2.uid, 1)
if math.random(1,100) <= x.chance then
function add()
local s = doPlayerAddItem(cid, pokein)
doItemSetAttribute(s, "poke", "This is "..i.."'s pokeball. HP = ["..x.health.."/"..x.maxhealth.."]")
doItemSetAttribute(s, "description", "Contains a " .. i)
end
doSendMagicEffect(topos, 24)
addEvent(add, time*1000)
return addEvent(doPlayerSendTextMessage, time*1000, cid, 27, "You catch a " .. i .. ".")
else
addEvent(doPlayerSendTextMessage, time*1000, cid, 27, "Your pokeball broke.")
return doSendMagicEffect(topos, 23)
end
end
end
return TRUE
end
dont work ;]
local pokes = {
["Bulbasaur"] = {corpseid = 5966, chance = 10, health = 12200, maxhealth = 12200},
["Dragon Lord"] = {corpseid = 5984, chance = 100, health = 12200, maxhealth = 12200},
["Demon"] = {corpseid = 5995, chance = 100, health = 12200, maxhealth = 12200},
["Weedle"] = {corpseid = 5993, chance = 100, health = 12200, maxhealth = 12200},
}
local time = 4 -- Tempo para mandar as mensagens e adiciona item
function onUse(cid, item, frompos, item2, topos)
for i,x in pairs(pokes) do
if item2.itemid == x.corpseid then
doRemoveItem(item.uid, 1)
doRemoveItem(item2.uid, 1)
if math.random(1,100) <= x.chance then
function add()
local s = doPlayerAddItem(cid, pokein)
doItemSetAttribute(s, "poke", "This is "..i.."'s pokeball. HP = ["..x.health.."/"..x.maxhealth.."]")
doItemSetAttribute(s, "description", "Contains a " .. i)
end
doSendMagicEffect(topos, 24)
addEvent(add, time*1000)
return addEvent(doPlayerSendTextMessage, time*1000, cid, 27, "You catch a " .. i .. ".")
else
addEvent(doPlayerSendTextMessage, time*1000, cid, 27, "Your pokeball broke.")
return doSendMagicEffect(topos, 23)
end
end
end
return TRUE
end
work