tavax 3 Postado Fevereiro 26, 2009 Share Postado Fevereiro 26, 2009 Olá galera tentei modar o npc dos addons para pegar so uns itens banais tipow mpa etc.... mas ele rouba o dnheiro so e da o addon -.- scrpits \/ 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 buyAddons(cid, message, keywords, parameters, node) --TODO: buyAddons function in modules.lua if(not npcHandler:isFocused(cid)) then return false end local addon = parameters.addon local cost = parameters.cost local items = parameters.items local premium = (parameters.premium ~= nil and parameters.premium) if isPlayerPremiumCallback == nil or (isPlayerPremiumCallback(cid) and premium) then if doPlayerRemoveMoney(cid, cost) and doPlayerRemoveItems(cid, items) == TRUE then doPlayerAddAddons(cid, addon) npcHandler:say('There, you are now able to use all addons!', cid) else npcHandler:say('Sorry, you do not have enough money.', cid) end else npcHandler:say('I only serve customers with premium accounts.', cid) end keywordHandler:moveUp(1) return true end local node1 = keywordHandler:addKeyword({'first addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first addons set for 100000 gold coins?'}) node1:addChildKeyword({'yes'}, buyAddons, {addon = 1, cost = 100000, items = {{2182,1}, {2186,1}, {2185,1}}, premium = true}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'}) local node2 = keywordHandler:addKeyword({'second addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to buy the second addons set for 500000 gold coins?'}) node2:addChildKeyword({'yes'}, buyAddons, {addon = 2, cost = 500000, items = {{2471,20}}, premium = true}) node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'}) keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell the first addons set for 100000 gold coins and the second addons set for 500000 gold coins.'}) npcHandler:addModule(FocusModule:new()) Esperando respostas rapido Obrigado pela atençao Link para o comentário https://xtibia.com/forum/topic/108527-npc-nao-pega-os-itens-so-o-money/ Compartilhar em outros sites More sharing options...
MUTAN0 1 Postado Fevereiro 27, 2009 Share Postado Fevereiro 27, 2009 Vo te passar um exemplo. Esse NPC, ele dá addon de Assassin e Brotherhood. Edita ai conforme quiser: 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 npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|. You are looking for a Assassin Addon or Brotherhood Addon, certainly! Just say {addons} or {help} if you don't know what to do.") function playerBuyAddonNPC(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if (parameters.confirm ~= true) and (parameters.decline ~= true) then if(getPlayerPremiumDays(cid) == 0) and (parameters.premium == true) then npcHandler:say('Sorry, but this addon is only for premium players!', cid) npcHandler:resetNpc() return true end if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then npcHandler:say('You already have this addon!', cid) npcHandler:resetNpc() return true end local itemsTable = parameters.items local items_list = '' if table.maxn(itemsTable) > 0 then for i = 1, table.maxn(itemsTable) do local item = itemsTable items_list = items_list .. item[2] .. ' ' .. getItemNameById(item[1]) if i ~= table.maxn(itemsTable) then items_list = items_list .. ', ' end end end local text = '' if (parameters.cost > 0) and table.maxn(parameters.items) then text = items_list .. ' and ' .. parameters.cost .. ' gp' elseif (parameters.cost > 0) then text = parameters.cost .. ' gp' elseif table.maxn(parameters.items) then text = items_list end npcHandler:say('Did you bring me ' .. text .. ' for ' .. keywords[1] .. '?', cid) return true elseif (parameters.confirm == true) then local addonNode = node:getParent() local addoninfo = addonNode:getParameters() local items_number = 0 if table.maxn(addoninfo.items) > 0 then for i = 1, table.maxn(addoninfo.items) do local item = addoninfo.items if (getPlayerItemCount(cid,item[1]) >= item[2]) then items_number = items_number + 1 end end end if(getPlayerMoney(cid) >= addoninfo.cost) and (items_number == table.maxn(addoninfo.items)) then doPlayerRemoveMoney(cid, addoninfo.cost) if table.maxn(addoninfo.items) > 0 then for i = 1, table.maxn(addoninfo.items) do local item = addoninfo.items doPlayerRemoveItem(cid,item[1],item[2]) end end doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon) doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon) setPlayerStorageValue(cid,addoninfo.storageID,1) npcHandler:say('Here you are.', cid) else npcHandler:say('You do not have needed items or cash!', cid) end npcHandler:resetNpc() return true elseif (parameters.decline == true) then npcHandler:say('Not interested? Maybe other addon?', cid) npcHandler:resetNpc() return true end return false end local noNode = KeywordNode:new({'no'}, playerBuyAddonNPC, {decline = true}) local yesNode = KeywordNode:new({'yes'}, playerBuyAddonNPC, {confirm = true}) -- assassin (done) local outfit_node = keywordHandler:addKeyword({'first assassin addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5912,50}, {5910,50}, {5911,50}, {5912,50}, {5913,50}, {5914,50}, {5909,50}, {5886,10}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10023}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second assassin addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5804,1}, {5930,10}}, outfit_female = 156, outfit_male = 152, addon = 2, storageID = 10024}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- brotherhood (done)(custom) local outfit_node = keywordHandler:addKeyword({'first brotherhood addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1500}}, outfit_female = 136, outfit_male = 278, addon = 1, storageID = 10039}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second brotherhood addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1500}}, outfit_female = 136, outfit_male = 278, addon = 2, storageID = 10040}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can give you assassin addon or brotherhood addon.'}) keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want the {first assassin addon}, {first brotherhood addon}, {second brotherhood addon} or the {second assassin addon}?'}) npcHandler:addModule(FocusModule:new()) E ai você muda o que ta em negrito. -Cost é o preço em gps. -depois vem items onde voce vai mudar os IDs. Por exemplo = {{5804,1}, {5930,10}}. Id e quantidade. -outfit_female = 136, outfit_male = 278, addon = 2; o outfit da mulher (female), do homem (male) e o addon (1 ou 2). Tenta ai, ve se da certo. Abraços. Link para o comentário https://xtibia.com/forum/topic/108527-npc-nao-pega-os-itens-so-o-money/#findComment-701679 Compartilhar em outros sites More sharing options...
brainless 0 Postado Fevereiro 27, 2009 Share Postado Fevereiro 27, 2009 eu axo q outra alternativa seria substituir todas as ocorrencias de doPlayerRemoveItems por doPlayerRemoveItem(cid,item,count) sem o S Link para o comentário https://xtibia.com/forum/topic/108527-npc-nao-pega-os-itens-so-o-money/#findComment-701768 Compartilhar em outros sites More sharing options...
tavax 3 Postado Fevereiro 27, 2009 Autor Share Postado Fevereiro 27, 2009 manow tentei modificar mas nao deu certo ele pega os itens mas nao da addons 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 npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|. You are looking for a FreeOufits Addon, certainly! Just say {addons} or {help} if you don't know what to do.") function playerBuyAddonNPC(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if (parameters.confirm ~= true) and (parameters.decline ~= true) then if(getPlayerPremiumDays(cid) == 0) and (parameters.premium == true) then npcHandler:say('Sorry, but this addon is only for premium players!', cid) npcHandler:resetNpc() return true end if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then npcHandler:say('You already have this addon!', cid) npcHandler:resetNpc() return true end local itemsTable = parameters.items local items_list = '' if table.maxn(itemsTable) > 0 then for i = 1, table.maxn(itemsTable) do local item = itemsTable items_list = items_list .. item[2] .. ' ' .. getItemNameById(item[1]) if i ~= table.maxn(itemsTable) then items_list = items_list .. ', ' end end end local text = '' if (parameters.cost > 0) and table.maxn(parameters.items) then text = items_list .. ' and ' .. parameters.cost .. ' gp' elseif (parameters.cost > 0) then text = parameters.cost .. ' gp' elseif table.maxn(parameters.items) then text = items_list end npcHandler:say('Did you bring me ' .. text .. ' for ' .. keywords[1] .. '?', cid) return true elseif (parameters.confirm == true) then local addonNode = node:getParent() local addoninfo = addonNode:getParameters() local items_number = 0 if table.maxn(addoninfo.items) > 0 then for i = 1, table.maxn(addoninfo.items) do local item = addoninfo.items if (getPlayerItemCount(cid,item[1]) >= item[2]) then items_number = items_number + 1 end end end if(getPlayerMoney(cid) >= addoninfo.cost) and (items_number == table.maxn(addoninfo.items)) then doPlayerRemoveMoney(cid, addoninfo.cost) if table.maxn(addoninfo.items) > 0 then for i = 1, table.maxn(addoninfo.items) do local item = addoninfo.items doPlayerRemoveItem(cid,item[1],item[2]) end end doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon) doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon) setPlayerStorageValue(cid,addoninfo.storageID,1) npcHandler:say('Here you are.', cid) else npcHandler:say('You do not have needed items or cash!', cid) end npcHandler:resetNpc() return true elseif (parameters.decline == true) then npcHandler:say('Not interested? Maybe other addon?', cid) npcHandler:resetNpc() return true end return false end local noNode = KeywordNode:new({'no'}, playerBuyAddonNPC, {decline = true}) local yesNode = KeywordNode:new({'yes'}, playerBuyAddonNPC, {confirm = true}) -- free (done) local outfit_node = keywordHandler:addKeyword({'first free addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2472,7}, {2646,10}, {7393,10}}, outfit_female = 136, outfit_female = 137, outfit_female = 138, outfit_female = 139, outfit_male = 128, outfit_male = 129, outfit_male = 130, outfit_male = 131, addon = 1, storageID = 10023, storageID = 10024, storageID = 10025, storageID = 10026}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second free addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2472,14}, {7393,15}, {2646,15}}, outfit_female = 136, outfit_female = 137, outfit_female = 138, outfit_female = 139, outfit_male = 128, outfit_male = 129, outfit_male = 130, outfit_male = 131, addon = 2, storageID = 10027, storageID = 10028, storageID = 10029, storageID = 10030}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- premium (done)(custom) local outfit_node = keywordHandler:addKeyword({'first brotherhood addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1500}}, outfit_female = 136, outfit_male = 278, addon = 1, storageID = 10031, storageID = 10032, storageID = 10033, storageID = 10034}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second brotherhood addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1500}}, outfit_female = 136, outfit_male = 278, addon = 2, storageID = 10035, storageID = 10036, storageID = 10037, storageID = 10038}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can give you assassin addon or brotherhood addon.'}) keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'You want the {first free addon}, {first premium addon}, {second free addon} or the {second premium addon}?'}) npcHandler:addModule(FocusModule:new()) nem acabei o premium addon ... nem valeu a pena visto o free addons nao funcionar -.- Esperando respostas Link para o comentário https://xtibia.com/forum/topic/108527-npc-nao-pega-os-itens-so-o-money/#findComment-701826 Compartilhar em outros sites More sharing options...
MUTAN0 1 Postado Fevereiro 27, 2009 Share Postado Fevereiro 27, 2009 Seu TFS é 0.3? Caso contrário não irá funcionar mesmo. Porque esse NPC de addons ta funcionando no TFS 0.3 {alpha 4}. Abraços. Link para o comentário https://xtibia.com/forum/topic/108527-npc-nao-pega-os-itens-so-o-money/#findComment-702005 Compartilhar em outros sites More sharing options...
tavax 3 Postado Fevereiro 27, 2009 Autor Share Postado Fevereiro 27, 2009 (editado) na faço ideia andei aqui vendo os docs mas nao encontrei nada... sei que tem o map Yourts.... matuno nao tem maneira de me ajudar aqui neste scripit? ele rouba dinheiro nao da addon e nem pega os itens -.- 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 buyAddons(cid, message, keywords, parameters, node) --TODO: buyAddons function in modules.lua if(not npcHandler:isFocused(cid)) then return false end local addon = parameters.addon local cost = parameters.cost local items = parameters.items local premium = (parameters.premium ~= nil and parameters.premium) if isPlayerPremiumCallback == nil or (isPlayerPremiumCallback(cid) and premium) then if doPlayerRemoveMoney(cid, cost) and doPlayerRemoveItems(cid, items) == TRUE then doPlayerAddAddons(cid, addon) npcHandler:say('There, you are now able to use all addons!', cid) else npcHandler:say('Sorry, you do not have enough money.', cid) end else npcHandler:say('I only serve customers with premium accounts.', cid) end keywordHandler:moveUp(1) return true end local node1 = keywordHandler:addKeyword({'first addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first addons set for 100000 gold coins?'}) node1:addChildKeyword({'yes'}, buyAddons, {addon = 1, cost = 10000, items = {{2182,1}, {2186,1}, {2185,1}}, premium = true}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'}) local node2 = keywordHandler:addKeyword({'second addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to buy the second addons set for 500000 gold coins?'}) node2:addChildKeyword({'yes'}, buyAddons, {addon = 2, cost = 50000, items = {{2471,20}}, premium = true}) node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'}) keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell the first addons set for 100000 gold coins and the second addons set for 500000 gold coins.'}) npcHandler:addModule(FocusModule:new()) Editado Fevereiro 27, 2009 por tavax Link para o comentário https://xtibia.com/forum/topic/108527-npc-nao-pega-os-itens-so-o-money/#findComment-702024 Compartilhar em outros sites More sharing options...
MUTAN0 1 Postado Fevereiro 28, 2009 Share Postado Fevereiro 28, 2009 Vo te dar uma dica, brother. Migra pro TFS 0.3. Não tenho certeza, mas acho que voce ta usando o Mystic Spirit talvez, dai é dificil esses scripts ai pegarem. Eu usava mystic spirit, tfs 0.2 (eu acho), e migrei para tfs 0.3 e valeu a pena. Agora sobre o script, o que eu posso te dizer é sobre aquele doPlayerRemoveItems(cid, items) que você pode trocar por doPlayerRemoveItem(cid, item) e trocar o buyAddons por playerBuyAddonNPC, dai ver se da algum resultado. Caso contrário, ve se acha o the forgotten server 0.3 (alpha 4) pra download, que aquele script que te passei antes vai funcionar. Abraços. Link para o comentário https://xtibia.com/forum/topic/108527-npc-nao-pega-os-itens-so-o-money/#findComment-702211 Compartilhar em outros sites More sharing options...
brainless 0 Postado Fevereiro 28, 2009 Share Postado Fevereiro 28, 2009 só acrescentando, já existe o TFS 3.1 final (superior às versões beta e alpha) http://www.xtibia.com/forum/84-Tfs-31-Official-t108457.html Link para o comentário https://xtibia.com/forum/topic/108527-npc-nao-pega-os-itens-so-o-money/#findComment-702303 Compartilhar em outros sites More sharing options...
tavax 3 Postado Fevereiro 28, 2009 Autor Share Postado Fevereiro 28, 2009 vou testar e ja falo para voces como correu ^^ bom so posso agradeçer a vossa ajuda... mas o meu ot é tutalmente imcopavivel com essa versao npcs e monster sao imcopativeis nessa versao... ate a base de dados da erro.... =/ Obrigado pela ajudar Link para o comentário https://xtibia.com/forum/topic/108527-npc-nao-pega-os-itens-so-o-money/#findComment-702555 Compartilhar em outros sites More sharing options...
Merchant 0 Postado Março 1, 2009 Share Postado Março 1, 2009 Dúvida Sanada, :button_cancel: Tópico Fechado. Abraços Link para o comentário https://xtibia.com/forum/topic/108527-npc-nao-pega-os-itens-so-o-money/#findComment-702684 Compartilhar em outros sites More sharing options...
Posts Recomendados