1
Npc Recompense el Miér Nov 08, 2017 1:03 pm
blanca77

Nuevo Miembro

Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...
if msgcontains(msg, 'job') then
return npcHandler:say('I\'m the officer responsible for this area. I give out missions, accept mission reports and oversee our defences.', cid)
end
if msgcontains(msg, 'gnome') then
return npcHandler:say('We are the only protectors of the world against the enemies below. With small stature comes great responsibilities, as they say.', cid)
end
if msgcontains(msg, 'area') then
return npcHandler:say({
"On these levels we found evidence of some monumental battle that has taken place here centuries ago. We also found some grave sites, but oddly enough no clues of any form of settlement. ...",
"Some evidence we have found suggests that at least one of the battles here was fought for many, many years. People came here, lived here, fought here and died here. ...",
"The battles continued until someone or something literally ploughed through the battlefields, turning everything upside down. All this killing and death soaked the area with negative energy. ...",
"Necromantic forces are running wild all over the place and we are hard-pressed to drive all these undead, spirits and ghosts, away from the Spike. ...",
"Unless we can secure that area somehow, the Spike operation is threatened to become crippled by the constant attacks of the undead. ...",
"The whole growing downwards could come to a halt, leaving us exposed to even more attacks, counter attacks, and giving the enemy time to prepare their defences. There's a lot to do for aspiring adventurers."
}, cid)
end
if msgcontains(msg, 'pacifiers') then -------> pacifiers mensaje identificador de la mision o palabra que hay que decirle al npc
if player:getItemCount(8262) == 0 then -------> mensaje si no tiene el item 8262
npcHandler:say('Usted necesita el item 8262.', cid)
elseif player:getItemCount(8262) == 2 then ----------->necesita 2 item 8262 para el reward
npcHandler:say('felicidades aqui tiene su reward.', cid)
playerAddPoints(player, 10) ------> añadir 10 premium point
player:addExperience(1000, true)
player:removeItem(8262, 2) -------> te remueve 2 item 8262
else
npcHandler:say('lamentablemente no tienes los item necesarios necesitas 2 del item 8262.', cid) -----> mensaje si no contienes 2 item 8262
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local levels = {25, 300}
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
local player = Player(cid)
if msgcontains(msg, 'job') then
return npcHandler:say('I\'m the officer responsible for this area. I give out missions, accept mission reports and oversee our defences.', cid)
end
if msgcontains(msg, 'gnome') then
return npcHandler:say('We are the only protectors of the world against the enemies below. With small stature comes great responsibilities, as they say.', cid)
end
if msgcontains(msg, 'area') then
return npcHandler:say({
"On these levels we found evidence of some monumental battle that has taken place here centuries ago. We also found some grave sites, but oddly enough no clues of any form of settlement. ...",
"Some evidence we have found suggests that at least one of the battles here was fought for many, many years. People came here, lived here, fought here and died here. ...",
"The battles continued until someone or something literally ploughed through the battlefields, turning everything upside down. All this killing and death soaked the area with negative energy. ...",
"Necromantic forces are running wild all over the place and we are hard-pressed to drive all these undead, spirits and ghosts, away from the Spike. ...",
"Unless we can secure that area somehow, the Spike operation is threatened to become crippled by the constant attacks of the undead. ...",
"The whole growing downwards could come to a halt, leaving us exposed to even more attacks, counter attacks, and giving the enemy time to prepare their defences. There's a lot to do for aspiring adventurers."
}, cid)
end
if msgcontains(msg, 'mission') then
if player:getLevel() > levels[2] then
npcHandler:say('Sorry, but no! Your expertise could be put to better use elsewhere. Here awaits you no challenge. You are desperately needed in the deeper levels of the Spike. Report there immediately. ', cid)
else
npcHandler:say('I can offer you several missions: to recharge our ghost {pacifiers}, to {release} the spiritual anger, to {track} an evil presence and to {kill} some demon skeletons.', cid)
end
return
end
if msgcontains(msg, 'pacifiers') then
if player:getItemCount(8262) == 0 then
npcHandler:say('Usted necesita el item 8262.', cid)
elseif player:getItemCount(8262) == 2 then
npcHandler:say('felicidades aqui tiene su reward.', cid)
playerAddPoints(player, 10)
player:addExperience(1000, true)
player:removeItem(8262, 2)
else
npcHandler:say('lamentablemente no tienes los item necesarios necesitas 2 del item 8262.', cid)
end
elseif msgcontains(msg, 'release') then
if player:getItemCount(8262) == 0 then
npcHandler:say('Usted necesita el item 8262.', cid)
elseif player:getItemCount(8262) == 2 then
npcHandler:say('felicidades aqui tiene su reward.', cid)
playerAddPoints(player, 10)
player:addExperience(1000, true)
player:removeItem(8262, 2)
else
npcHandler:say('lamentablemente no tienes los item necesarios necesitas 2 del item 8262.', cid)
end
elseif msgcontains(msg, 'tracking') then
if player:getItemCount(8262) == 0 then
npcHandler:say('Usted necesita el item 8262.', cid)
elseif player:getItemCount(8262) == 2 then
npcHandler:say('felicidades aqui tiene su reward.', cid)
playerAddPoints(player, 10)
player:addExperience(1000, true)
player:removeItem(8262, 2)
else
npcHandler:say('lamentablemente no tienes los item necesarios necesitas 2 del item 8262.', cid)
end
elseif msgcontains(msg, 'killing') then
if player:getItemCount(8262) == 0 then
npcHandler:say('Usted necesita el item 8262.', cid)
elseif player:getItemCount(8262) == 2 then
npcHandler:say('felicidades aqui tiene su reward.', cid)
playerAddPoints(player, 10)
player:addExperience(1000, true)
player:removeItem(8262, 2)
else
npcHandler:say('lamentablemente no tienes los item necesarios necesitas 2 del item 8262.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
function playerAddPoints(player, amount)
local plural = ''
db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. amount .. " WHERE `id` = " .. player:getAccountId() .. ' LIMIT 1;')
if amount > 1 then plural = 's' end
return true
end
if msgcontains(msg, 'pacifiers') then -------> pacifiers mensaje identificador de la mision o palabra que hay que decirle al npc
if player:getItemCount(8262) == 0 then -------> mensaje si no tiene el item 8262
npcHandler:say('Usted necesita el item 8262.', cid)
elseif player:getItemCount(8262) == 2 then ----------->necesita 2 item 8262 para el reward
npcHandler:say('felicidades aqui tiene su reward.', cid)
playerAddPoints(player, 10) ------> añadir 10 premium point
player:addExperience(1000, true)
player:removeItem(8262, 2) -------> te remueve 2 item 8262
else
npcHandler:say('lamentablemente no tienes los item necesarios necesitas 2 del item 8262.', cid) -----> mensaje si no contienes 2 item 8262
end
Permisos de este foro:
No puedes responder a temas en este foro.
|
|