Boa noite,
Crie o NPC conforme costume e adicione este script como .LUA:
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)NpcSystem.parseParameters(npcHandler)local talkState = {}function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) endfunction onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) endfunction onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) endfunction onThink() npcHandler:onThink() endfunction creatureSayCallback(cid, type, msg)if(not npcHandler:isFocused(cid)) thenreturn falseendlocal talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid----------- CONFIG ----------local opt = { ["agility"] = {sto = 12456, cost = 5, value = 10}, -- Nome, Storage Controle, Custo em Soul, Valor de Atributos que Adicionará ["strength"] = {sto = 12455, cost = 5, value = 10},}------------ MESSAGENS -----------------attr = opt[string.lower(msg)]if attr then if getPlayerStorageValue(cid, attr.sto) <= 0 then setPlayerStorageValue(cid, attr.sto, 1) end getSto = getPlayerStorageValue(cid, attr.sto) SoulCost = (attr.cost*getSto) StoKey = attr.sto selfSay('Deseja aumentar '..attr.value..' pontos de '..msg..' por '..SoulCost..' pontos de soul?', cid) talkState[talkUser] = 1elseif (msgcontains(msg, 'help') or msgcontains(msg, 'ajuda')) then selfSay('Temos como opção agility e strenght para dar upgrade.', cid) talkState[talkUser] = 0--------------- NEGOCIANDO INICIANDO -----------------elseif talkState[talkUser] == 1 then if (msgcontains(msg, 'sim') or msgcontains(msg, 'yes')) then if getPlayerSoul(cid) >= SoulCost then doPlayerAddSoul(cid, -SoulCost) setPlayerStorageValue(cid, StoKey, getSto+1) selfSay('Parabéns, tudo ocorreu perfeitamente.', cid) talkState[talkUser] = 0 else selfSay('Você não tem soul o suficiente.', cid) talkState[talkUser] = 0 end else selfSay('Tudo bem, espero você em breve.', cid) talkState[talkUser] = 1 endend return trueendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new())
Boa sorte.




info
Grupo: Artesão
Registrado: 04/02/08
Posts: 112
Reputação: +3
Char no Tibia: Pizza de Churros
Preciso de ajuda pra criar um npc que é o seguinte:
ao escolher entre agility e strength
se for a primeira vez, ele remove valor X de soul, se for for a segunda vez ele remove o mesmo valor de antes só que vezes 2, na terceira é vezes 3 e por assim em diante... lembrando que depende do que ele escolher, por exemplo, se ele foi duas vezes pedindo agility e na terceira vez ele pediu por strength, vai remover o valor inicial de soul só, entenderam?
e dai dependendo da vez ele vai dando tipo pro agility a "storage = 12456, 1", na segunda vez ele dá "storage = 12456, 2" e por assim em diante, e se for o strength ele da o storage 12465, seguindo a lógica do agility