[npc] Preciso De Um Npc Que Recarregar

TulioXD35
em Lixeira Pública

TulioXD35

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 18/03/08Posts: 28

Por favor,preciso de um npc pra ot 8.5 (TFS 3.5.1) que recarrege soft e firewalker boots.

Por favor,me ajudem!!!

Khost

~~ Khost ~~
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 24/06/08Posts: 23

primeiro os npcs não são de minha autoria !!

 

Primeiro oque recarrega Firewalker Boots

<?xml version="1.0" encoding="UTF-8"?>

 

<npc name="Firewalker" script="data/npc/scripts/firewalker.lua" access="3" lookdir="3" walkinterval="2000" floorchange="0">

<health now="100" max="100"/>

<look type="128" head="40" body="37" legs="116" feet="95" addons="0"/>

<parameters>

<parameter key="message_greet" value="Ola, |PLAYERNAME|. Voce vai querer {reparar} sua firewalker boots?."/>

<parameter key="message_farewell" value="Isto eh musica para meus ouvidos." />

<parameter key="message_walkaway" value="Yeah, se perca." />

<parameter key="message_onsendtrade" value="Yeah, compre algo." />

<parameter key="module_shop" value="1" />

</parameters>

</npc>

 

depois vá em Scripts crie um arquivo lua com o nome de firewalker e addcione isso 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

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

if(msgcontains(msg, 'reparar') or msgcontains(msg, 'firewalker boots')) then

selfSay('Voce deseja reparar sua worn firewalker boots por 30000 moedas de ouro?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if(getPlayerItemCount(cid, 9934) >= 1) then

if(doPlayerRemoveMoney(cid, 30000) == TRUE) then

doPlayerRemoveItem(cid, 9934, 1)

doPlayerAddItem(cid, 9933)

selfSay('Here you are.', cid)

else

selfSay('Desculpe, volte quando tiver dinheiro.', cid)

end

else

selfSay('desculpe, voce nao tem este item.', cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Ok then.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Agora vamos ao de Soft Boots msm coisa ....

vá em npcs crie um arquivo ou bote no lugar de um npc ja existente que você não vá usar bote isto:

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Roy" script="data/npc/scripts/soft.lua" walkinterval="2000" floorchange="0">

<health now="100" max="100"/>

<look type="128" head="40" body="37" legs="116" feet="95" addons="0"/>

<parameters>

<parameter key="message_greet" value="Ola, |PLAYERNAME|. Voce veio para {reparar} sua soft boots?."/>

<parameter key="message_farewell" value="Isto eh musica para meus ouvidos." />

<parameter key="message_walkaway" value="Yeah, se perca." />

<parameter key="message_onsendtrade" value="Yeah, compre algo." />

<parameter key="module_shop" value="1" />

<parameter key="shop_buyable" value="leather boots,2643,2;leather helmet,2461,12;leather legs,2649,10;sandals,2642,2;studded helmet,2482,63;studded legs,2468,60" />

</parameters>

</npc>

 

vai em scripts e crie um arquivo lua com o nome de soft ,abra o e addcione isto :

 

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

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

if(msgcontains(msg, 'reparar') or msgcontains(msg, 'soft boots')) then

selfSay('Voce deseja reparar sua worn soft boots por 10000 moedas de ouro?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if(getPlayerItemCount(cid, 6530) >= 1) then

if(doPlayerRemoveMoney(cid, 10000) == TRUE) then

doPlayerRemoveItem(cid, 6530, 1)

doPlayerAddItem(cid, 2640)

selfSay('Here you are.', cid)

else

selfSay('Desculpe, volte quando tiver dinheiro.', cid)

end

else

selfSay('desculpe, voce nao tem este item.', cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Ok then.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Obrigado!

Se sanei sua dúvida dê o tópico com dúvida sanada, pois assim estará ajudando os Moderadores...

TulioXD35

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 18/03/08Posts: 28

Quero um npc so com as 2 funçoes,se for possivel cria-lo

satan666

Antichrist Superstar
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 07/05/08Posts: 612Char no Tibia: leviana luciferiana

feito.

 

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

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

if(msgcontains(msg, 'worn soft boots') or msgcontains(msg, 'wsb')) then

selfSay('Do you want to repair your worn soft boots for 10000 gold coins?', cid)

talkState[talkUser] = 1

 

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

talkState[talkUser] = 0

if(getPlayerItemCount(cid, 6530) >= 1) then

if(doPlayerRemoveMoney(cid, 10000) == TRUE) then

local item = getPlayerItemById(cid, TRUE, 6530)

doTransformItem(item.uid, 6132)

selfSay('Here you are.', cid)

else

selfSay('Sorry, you don\'t have enough gold.', cid)

end

else

selfSay('Sorry, you don\'t have the item.', cid)

end

 

 

elseif(msgcontains(msg, 'worn firewalker boots') or msgcontains(msg, 'wfb')) then

selfSay('Do you want to repair your worn firewalker boots for 10000 gold coins?', cid)

talkState[talkUser] = 2

 

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then

talkState[talkUser] = 0

if(getPlayerItemCount(cid, 9934) >= 1) then

if(doPlayerRemoveMoney(cid, 10000) == TRUE) then

local item = getPlayerItemById(cid, TRUE, 9934)

doTransformItem(item.uid, 9933)

selfSay('Here you are.', cid)

else

selfSay('Sorry, you don\'t have enough gold.', cid)

end

else

selfSay('Sorry, you don\'t have the item.', cid)

end

 

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Ok then.', cid)

end

return TRUE

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

creationb.jpg

"Um Deus que usasse seu poder para criar seres humanos que de antemão sabia que seriam atormentados eternamente, e que os predestinasse a isso,



não poderia ser sábio, nem justo e tampouco amoroso.

Além de nos submeter a isso vim a nos julgar e condenar por nossos atos aos tormentos do inferno.

pra minha pessoa isso não é um Deus Pai amoroso e bondoso como o chaman, seu padrão seria muito mais inferior do que o de muitos homens."