Ir para conteúdo

[tfs] Npc De Soft Boots


noobinhu

Posts Recomendados

Este NPC pede uma quantia em dinheiro e renova a soft boots.

 

Crie um arquivo chamado Soft Boots Recharger.xml em data/npc contendo:

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

<npc name="Soft Boots Recharger" script="data/npc/scripts/softboots.lua" walkinterval="2000" floorchange="0">

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

<look type="132" head="20" body="39" legs="45" feet="7" addons="0"/>

</npc>

 

Crie outro arquivo chamado softboots.lua em npc/scripts contendo:

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

 

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

if(not npcHandler:isFocused(cid)) then

return false

end

local playermoney = getPlayerMoney(cid)

if playermoney >= 10000 then

if doPlayerRemoveItem(cid,6530,1) == 1 then

doPlayerAddItem(cid, 6132, 1)

doPlayerRemoveMoney(cid, 10000)

npcHandler:say("Here are your new soft boots!", cid)

else

npcHandler:say("You don't have worn soft boots.", cid)

end

else

npcHandler:say("You don't have enough money.", cid)

end

keywordHandler:moveUp(1)

return true

end

 

local node1 = keywordHandler:addKeyword({'soft boots'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to repair your soft boots for 10000 gold coins?'})

node1:addChildKeyword({'yes'}, rechargeSoft, {blessing = 1})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})

 

keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can repair a pair of worn soft boots for 10000 gold coins."})

keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can repair a pair of worn soft boots for 10000 gold coins."})

 

npcHandler:addModule(FocusModule:new())

 

Está feito seu NPC, fale hi soft boots yes, e terá sua soft boots nova :)

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...