Postado Abril 13, 2017 8 anos Seria o script de um npc? Se ninguém disponibilizar mais tarde quando eu chegar do curso eu deixo ele aqui pra você.
Postado Abril 14, 2017 8 anos Solução @Jinx Mano, não sei do que se trata, mas se for de um npc tente assim: Em Data/npc crie um arquivo .xml com o nome que quiser e adicione: <?xml version="1.0" encoding="UTF-8"?> <npc name="Nome do NPC" script="data/npc/scripts/NPC.LUA" walkinterval="2000" lookdir="3" floorchange="0"> <health now="100" max="100"/> <look type="145" head="40" body="37" legs="116" feet="95" addons="3"/> <parameters> <parameter key="message_greet" value="E ae matador! Você trouxe mais {bones} para mim? Preciso de 30 bones, se voce trouxe diga {bones}." /> <parameter key="message_farewell" value="Mas que beleza... Quantos ossos!" /> <parameter key="message_walkaway" value="Yeah, mate mais!" /> <parameter key="message_onsendtrade" value="Yeah, mate mais!" /> <parameter key="module_shop" value="1" /> </parameters> </npc> Agoraa em Data/npc/scripts crie um arquivo .lua e adicione: 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, 'ossos') or msgcontains(msg, 'bones') or msgcontains(msg, 'bone')) then selfSay('Você realmente deseja trocar seus preciosos bones por um item aleatório? Diga {yes}.', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 5925) >= 30) then if(doPlayerRemoveItem(cid, 5925, 30) == TRUE) then doPlayerAddItem(cid, 6571) selfSay('Here you are.', cid) else selfSay('Desculpe, mas você não tem 30 bones.', cid) end else selfSay('Desculpe, mas você não tem 30 bones.', 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()) Obs: Não testei e não sei se funciona, eu dei uma procuradinha aqui e achei ele, teste e mande resposta. Obs²: Não esqueça de mudar o Nome do Npc, o .Lua e o .Xml dele, para funcionar corretamente. Boa sorte e abraços! =)
Postado Abril 15, 2017 8 anos Autor 9 horas atrás, Mathwsz disse: @Jinx Mano, não sei do que se trata, mas se for de um npc tente assim: Em Data/npc crie um arquivo .xml com o nome que quiser e adicione: <?xml version="1.0" encoding="UTF-8"?> <npc name="Nome do NPC" script="data/npc/scripts/NPC.LUA" walkinterval="2000" lookdir="3" floorchange="0"> <health now="100" max="100"/> <look type="145" head="40" body="37" legs="116" feet="95" addons="3"/> <parameters> <parameter key="message_greet" value="E ae matador! Você trouxe mais {bones} para mim? Preciso de 30 bones, se voce trouxe diga {bones}." /> <parameter key="message_farewell" value="Mas que beleza... Quantos ossos!" /> <parameter key="message_walkaway" value="Yeah, mate mais!" /> <parameter key="message_onsendtrade" value="Yeah, mate mais!" /> <parameter key="module_shop" value="1" /> </parameters> </npc> Agoraa em Data/npc/scripts crie um arquivo .lua e adicione: 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, 'ossos') or msgcontains(msg, 'bones') or msgcontains(msg, 'bone')) then selfSay('Você realmente deseja trocar seus preciosos bones por um item aleatório? Diga {yes}.', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 5925) >= 30) then if(doPlayerRemoveItem(cid, 5925, 30) == TRUE) then doPlayerAddItem(cid, 6571) selfSay('Here you are.', cid) else selfSay('Desculpe, mas você não tem 30 bones.', cid) end else selfSay('Desculpe, mas você não tem 30 bones.', 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()) Obs: Não testei e não sei se funciona, eu dei uma procuradinha aqui e achei ele, teste e mande resposta. Obs²: Não esqueça de mudar o Nome do Npc, o .Lua e o .Xml dele, para funcionar corretamente. Boa sorte e abraços! =) Vllw man
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.