niivalerio 0 Postado Dezembro 9, 2013 Share Postado Dezembro 9, 2013 Eae galera beleza?? Bom eu presciso de um NPC de addon que funcione assim: O npc so te da um addon se você tiver storage x, ou seja... Player: Hi Npc: Olá bla bla bla Player: first addon Npc: Você tem storage x? Player: yes Npc: aqui esta... Facil não é? não eu não sei fazer! ME dêm uma luzz :x REP + Link para o comentário https://xtibia.com/forum/topic/225294-npc-que-verifica-storage/ Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Dezembro 9, 2013 Share Postado Dezembro 9, 2013 (editado) Será de apenas 1 outfit, o addon recebido? Ou será de todas? Se for a primeira opção, poderia informar qual o ID da outfit? De qualquer maneira, tenta assim: Primeira opção: 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 local cfg = { outfit = xxx, --ID da outfit. sto = xxx, --Storage. } if msgcontains(msg, 'first addon') then if getPlayerStorageValue(cid, 845511) < 1 then selfSay("Você tem storage "..cfg.sto.."?", cid) talkState[talkUser] = 1 return true else selfSay("Você já pegou seu primeiro addon.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, cfg.sto) >= 1 then selfSay("Ok, aqui está.", cid) doPlayerAddAddon(cid, cfg.outfit, 1) setPlayerStorageValue(cid, 845511, 1) talkState[talkUser] = 0 return true else selfSay("Você não tem a storage!", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then selfSay("Ok, então,") talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Segunda opção: 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 local sto = xxx --Storage. if msgcontains(msg, 'first addon') then if getPlayerStorageValue(cid, 845511) < 1 then selfSay("Você tem storage "..sto.."?", cid) talkState[talkUser] = 1 return true else selfSay("Você já pegou seu primeiro addon.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, sto) >= 1 then selfSay("Ok, aqui está.", cid) doPlayerAddAddons(cid, 1) setPlayerStorageValue(cid, 845511, 1) talkState[talkUser] = 0 return true else selfSay("Você não tem a storage!", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then selfSay("Ok, então,") talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Sabe fazer o XML? Editado Dezembro 9, 2013 por zipter98 Link para o comentário https://xtibia.com/forum/topic/225294-npc-que-verifica-storage/#findComment-1590869 Compartilhar em outros sites More sharing options...
0 niivalerio 0 Postado Dezembro 9, 2013 Autor Share Postado Dezembro 9, 2013 (editado) Então cara, o addon é de insectoid full... VLW! Mas so presciso de uma mãozinha aqui pq tipo o script ta daora!! mas se o player continua falando "yes" "yes" "yes" "yes" ele continua respondendo "aqui esta" "aqui esta" "aqui esta" Tem como fazer ele dar o segundo addon tbm??? Editado Dezembro 9, 2013 por niivalerio Link para o comentário https://xtibia.com/forum/topic/225294-npc-que-verifica-storage/#findComment-1590927 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Dezembro 9, 2013 Share Postado Dezembro 9, 2013 (editado) Tenta assim: 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 local cfg = { outfit = xxx, --ID da outfit. sto = xxx, --Storage. sto_two = xxx, --Storage do segundo addon. } if msgcontains(msg, 'first addon') then if getPlayerStorageValue(cid, 845511) < 1 then selfSay("Você tem storage "..cfg.sto.."?", cid) talkState[talkUser] = 1 return true else selfSay("Você já pegou seu primeiro addon.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, 845511) < 1 then if getPlayerStorageValue(cid, cfg.sto) >= 1 then selfSay("Ok, aqui está.", cid) doPlayerAddAddon(cid, cfg.outfit, 1) setPlayerStorageValue(cid, 845511, 1) talkState[talkUser] = 0 return true else selfSay("Você não tem a storage!", cid) talkState[talkUser] = 0 return true end else selfSay("Você já pegou seu primeiro addon.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then selfSay("Ok, então...") talkState[talkUser] = 0 return true elseif msgcontains(msg, 'second addon') then if getPlayerStorageValue(cid, 845512) < 1 then selfSay("Você tem storage "..cfg.sto_two.."?", cid) talkState[talkUser] = 2 return true else selfSay("Você já pegou seu segundo addon!", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then if getPlayerStorageValue(cid, 845512) < 1 then if getPlayerStorageValue(cid, cfg.sto_two) >= 1 then selfSay("Aqui está!", cid) doPlayerAddAddon(cid, cfg.outfit, 2) setPlayerStorageValue(cid, 845512, 1) talkState[talkUser] = 0 return true else selfSay("Você não têm essa storage!", cid) talkState[talkUser] = 0 return true end else selfSay("Você já pegou seu segundo addon!", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'no') and talkState[talkUser] == 2 then selfSay("Ok, então...", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Dezembro 9, 2013 por zipter98 Link para o comentário https://xtibia.com/forum/topic/225294-npc-que-verifica-storage/#findComment-1591004 Compartilhar em outros sites More sharing options...
0 niivalerio 0 Postado Dezembro 10, 2013 Autor Share Postado Dezembro 10, 2013 FUNFO 100% VLW!!! So posso pedir so mais 1 coisa?? com eu coloco female addon tbm? Link para o comentário https://xtibia.com/forum/topic/225294-npc-que-verifica-storage/#findComment-1591069 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Dezembro 10, 2013 Share Postado Dezembro 10, 2013 (editado) Tenta assim: 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 local cfg = { outfit = getPlayerSex(cid) == 0 and x or y, --ID da outfit. (x = id da outfit female, y da male.) sto = xxx, --Storage. sto_two = xxx, --Storage do segundo addon. } if msgcontains(msg, 'first addon') then if getPlayerStorageValue(cid, 845511) < 1 then selfSay("Você tem storage "..cfg.sto.."?", cid) talkState[talkUser] = 1 return true else selfSay("Você já pegou seu primeiro addon.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, 845511) < 1 then if getPlayerStorageValue(cid, cfg.sto) >= 1 then selfSay("Ok, aqui está.", cid) doPlayerAddAddon(cid, cfg.outfit, 1) setPlayerStorageValue(cid, 845511, 1) talkState[talkUser] = 0 return true else selfSay("Você não tem a storage!", cid) talkState[talkUser] = 0 return true end else selfSay("Você já pegou seu primeiro addon.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then selfSay("Ok, então...") talkState[talkUser] = 0 return true elseif msgcontains(msg, 'second addon') then if getPlayerStorageValue(cid, 845512) < 1 then selfSay("Você tem storage "..cfg.sto_two.."?", cid) talkState[talkUser] = 2 return true else selfSay("Você já pegou seu segundo addon!", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then if getPlayerStorageValue(cid, 845512) < 1 then if getPlayerStorageValue(cid, cfg.sto_two) >= 1 then selfSay("Aqui está!", cid) doPlayerAddAddon(cid, cfg.outfit, 2) setPlayerStorageValue(cid, 845512, 1) talkState[talkUser] = 0 return true else selfSay("Você não têm essa storage!", cid) talkState[talkUser] = 0 return true end else selfSay("Você já pegou seu segundo addon!", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, 'no') and talkState[talkUser] == 2 then selfSay("Ok, então...", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Dezembro 10, 2013 por zipter98 Link para o comentário https://xtibia.com/forum/topic/225294-npc-que-verifica-storage/#findComment-1591072 Compartilhar em outros sites More sharing options...
0 niivalerio 0 Postado Dezembro 10, 2013 Autor Share Postado Dezembro 10, 2013 *100% vlw !!!!! REP + Link para o comentário https://xtibia.com/forum/topic/225294-npc-que-verifica-storage/#findComment-1591085 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Dezembro 10, 2013 Share Postado Dezembro 10, 2013 Sanado, movido. Link para o comentário https://xtibia.com/forum/topic/225294-npc-que-verifica-storage/#findComment-1591088 Compartilhar em outros sites More sharing options...
Pergunta
niivalerio 0
Eae galera beleza??
Bom eu presciso de um NPC de addon que funcione assim:
O npc so te da um addon se você tiver storage x, ou seja...
Player: Hi
Npc: Olá bla bla bla
Player: first addon
Npc: Você tem storage x?
Player: yes
Npc: aqui esta...
Facil não é? não eu não sei fazer! ME dêm uma luzz :x
REP +
Link para o comentário
https://xtibia.com/forum/topic/225294-npc-que-verifica-storage/Compartilhar em outros sites
7 respostass a esta questão
Posts Recomendados