[Npc] Citzen Global

lelesho
em Scripts

lelesho

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/09/12Posts: 73Char no Tibia: palasho

Eu gostaria de um npc que da as 2 addons,

 

 

Citizen Hat:

 

 

Requisitos:

 

chickenfeatherap5.gif

honeycombhh8.giflegionhelmetmn5.gif

 

100 Chicken Feathers

50 Honeycombs

1 Legion Helmet

 

 

 

Citação:

Hi

hat

yes

Bye

*Ela te da a addon.

 

 

 

Recompensa

 

outfitcitizenmaleaddon2kw3.gif

 

 

 

Citizen Backpack

 

Requisitos:

 

minotaurleatheryo8.gif

 

100 Minotaur Leather

Citação: Hi

backpack

yes

*Ela lhe dará a addon.

 

 

alguem poderia fazer ou me ensinar porfavor?

Projeto

 

Venha fazer parte desta equipe.

 

Precisamos de scripter urgente.

 

http://www.xtibia.co...ma-nova-equipe/

KUNGLOW

avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 19/06/11Posts: 195Char no Tibia: Desconhecido

O script do NPC:

 

 

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

 

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

 

-- Storage IDs --

local citizen = 22001

 

 

local newaddon = 'Here you are, enjoy your brand new addon!'

local noitems = 'You do not have all the required items.'

local noitems2 = 'You do not have all the required items or you do not have the first addon, which by the way, is a requirement for this addon.'

local already = 'It seems you already have this addon, don\'t you try to mock me son!'

 

-- CITIZEN START --

function CitizenFirst(cid, message, keywords, parameters, node)

 

if(not npcHandler:isFocused(cid)) then

return false

end

 

if isPremium(cid) then

addon = getPlayerStorageValue(cid,citizen)

if addon == -1 then

if getPlayerItemCount(cid,5878) >= 100 then

if doPlayerRemoveItem(cid,5878,100) then

selfSay(newaddon)

 

doSendMagicEffect(getCreaturePosition(cid), 13)

doPlayerAddOutfit(cid, 128, 1)

doPlayerAddOutfit(cid, 136, 1)

setPlayerStorageValue(cid,citizen,1)

end

else

selfSay(noitems)

end

else

selfSay(already)

end

end

 

end

 

function CitizenSecond(cid, message, keywords, parameters, node)

 

if(not npcHandler:isFocused(cid)) then

return false

end

 

if isPremium(cid) then

addon = getPlayerStorageValue(cid,citizen+1)

if addon == -1 then

if getPlayerItemCount(cid,5890) >= 100 and getPlayerItemCount(cid,5902) >= 50 and getPlayerItemCount(cid,2480) >= 1 then

if doPlayerRemoveItem(cid,5890,100) and doPlayerRemoveItem(cid,5902,50) and doPlayerRemoveItem(cid,2480,1) then

selfSay(newaddon)

 

doSendMagicEffect(getCreaturePosition(cid), 13)

doPlayerAddOutfit(cid, 128, 2)

doPlayerAddOutfit(cid, 136, 2)

setPlayerStorageValue(cid,citizen+1,1)

end

else

selfSay(noitems)

end

else

selfSay(already)

end

end

 

end

 

keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you first & second addons of the Citizen outfit."})

keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "What you do is that you type 'first citizen addon' or 'second citizen addon'. Assuming that you already collected all the required pieces, say 'yes' and voíla - you got yourself an addon!"})

 

local node1 = keywordHandler:addKeyword({'first citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To achieve the first citizen addon you need to give me 100 minotaur leathers. Do you have them with you?'})

node1:addChildKeyword({'yes'}, CitizenFirst, {npcHandler = npcHandler, onlyFocus = true, reset = true})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

 

local node2 = keywordHandler:addKeyword({'second citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To achieve the first citizen addon you need to give me 100 chicken feathers, 50 honeycombs and a legion helmet. Do you have them with you?'})

node2:addChildKeyword({'yes'}, CitizenSecond, {npcHandler = npcHandler, onlyFocus = true, reset = true})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true})

 

npcHandler:addModule(FocusModule:new())

"Sua vida não é uma coincidência, é um reflexo do amor de Deus por ti..."

lelesho

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/09/12Posts: 73Char no Tibia: palasho

Obrigado. funcionou muito bem.

Projeto

 

Venha fazer parte desta equipe.

 

Precisamos de scripter urgente.

 

http://www.xtibia.co...ma-nova-equipe/

KUNGLOW

avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 19/06/11Posts: 195Char no Tibia: Desconhecido

De nada. Irei reportar para que movam o tópico.

"Sua vida não é uma coincidência, é um reflexo do amor de Deus por ti..."

Critical

A fumaça queimando, tá escutando?
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 05/11/07Posts: 544

Dúvida sanada, tópico movido.

 

Atenciosamente, Critical.

"Educai as crianças para não precisar punir os homens."