Postado Setembro 13, 2014 10 anos Teste assim o do Piso: local newtype = XXX -- ID da Outfit function onStepIn(cid, item, pos, fromPos) if isPlayer(cid) then get = getCreatureOutfit(cid) a = {lookType = newtype, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) end return true end function onStepOut(cid, item, pos, fromPos) if isPlayer(cid) then doRemoveCondition(cid, CONDITION_OUTFIT) end end Caso vá fazer um piso para cada Outfit, me avise. #EDIT: Já a do NPC, você pode adicionar as outfits no outfit.xml e adicionar para só poder usá-la quem tiver XXX storage, aí coloca para o NPC dar esta storage. Entendeu? #EDIT² Bom, eu basicamente nunca havia criado script com a função de adicionar outfit usando esta tag, mas conforme pesquisei, compensa testar novamente como abaixo: 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 ------------------- CONFIG INICIAIS -------------- local diamond, qtdd = 2145, 5 -- ID do Diamante, Quantidade local nome1, name1 = 'ash', 'Ash Ketchum' -- Palavra falada ao NPC, Nome do Outfit local outfitid1 = 1912 -- Aqui a id da outfit 1 local nome2, name2 = 'scorpion', 'Scorpion' -- Palavra falada ao NPC, Nome do Outfit local outfitid2 = 1907 -- Aqui a id da outfit 2 local nome3, name3 = 'sub zero', 'Sub Zero' -- Palavra falada ao NPC, Nome do Outfit local outfitid3 = 1906 -- Aqui a id da outfit 3 local nome4, name4 = 'homer', 'Homer' -- Palavra falada ao NPC, Nome do Outfit local outfitid4 = 1905 -- Aqui a id da outfit 4 local nome5, name5 = 'panico', 'Panico' -- Palavra falada ao NPC, Nome do Outfit local outfitid5 = 1904 -- Aqui a id da outfit 5 local nome6, name6 = 'spider man', 'Spider Man' -- Palavra falada ao NPC, Nome do Outfit local outfitid6 = 1903 -- Aqui a id da outfit 6 ------------------ MESSAGENS -------------------------- if msgcontains(msg, nome1) then selfSay('Voce deseja comprar a outfit do '..name1..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 3 elseif msgcontains(msg, nome2) then selfSay('Voce deseja comprar a outfit do '..name2..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 5 elseif msgcontains(msg, nome3) then selfSay('Voce deseja comprar a outfit do '..name3..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 7 elseif msgcontains(msg, nome4) then selfSay('Voce deseja comprar a outfit do '..name4..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 9 elseif msgcontains(msg, nome5) then selfSay('Voce deseja comprar a outfit do '..name5..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 11 elseif msgcontains(msg, nome6) then selfSay('Voce deseja comprar a outfit do '..name6..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 13 elseif (msgcontains(msg, 'trade') or msgcontains(msg, 'hi')) then selfSay(' Digite qual Outfit deseja adquirir.', cid) selfSay('Atualmente temos a do ash, scorpion, sub zero, homer, panico e spider man', cid) talkState[talkUser] = 0 ---------------------- NEGOCIAÇÃO --------------------------------------- elseif talkState[talkUser] == 3 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid1, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid1, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end elseif talkState[talkUser] == 5 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid2, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid2, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end elseif talkState[talkUser] == 7 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid3, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid3, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end elseif talkState[talkUser] == 9 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid4, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid4, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end elseif talkState[talkUser] == 11 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid5, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid5, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end elseif talkState[talkUser] == 13 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid6, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid6, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Boa sorte. Editado Setembro 13, 2014 10 anos por Adriano SwaTT (veja o histórico de edições) Gosta do meu trabalho? Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs. Atenciosamente,Adriano Swatt' Para ver meus tutoriais acesse meu perfil.
Postado Setembro 13, 2014 10 anos Autor Teste assim o do Piso: local newtype = XXX -- ID da Outfit function onStepIn(cid, item, pos, fromPos) if isPlayer(cid) then get = getCreatureOutfit(cid) a = {lookType = newtype, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) end return true end function onStepOut(cid, item, pos, fromPos) if isPlayer(cid) then doRemoveCondition(cid, CONDITION_OUTFIT) end end Caso vá fazer um piso para cada Outfit, me avise. #EDIT: Já a do NPC, você pode adicionar as outfits no outfit.xml e adicionar para só poder usá-la quem tiver XXX storage, aí coloca para o NPC dar esta storage. Entendeu? #EDIT² Bom, eu basicamente nunca havia criado script com a função de adicionar outfit usando esta tag, mas conforme pesquisei, compensa testar novamente como abaixo: 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 ------------------- CONFIG INICIAIS -------------- local diamond, qtdd = 2145, 5 -- ID do Diamante, Quantidade local nome1, name1 = 'ash', 'Ash Ketchum' -- Palavra falada ao NPC, Nome do Outfit local outfitid1 = 1912 -- Aqui a id da outfit 1 local nome2, name2 = 'scorpion', 'Scorpion' -- Palavra falada ao NPC, Nome do Outfit local outfitid2 = 1907 -- Aqui a id da outfit 2 local nome3, name3 = 'sub zero', 'Sub Zero' -- Palavra falada ao NPC, Nome do Outfit local outfitid3 = 1906 -- Aqui a id da outfit 3 local nome4, name4 = 'homer', 'Homer' -- Palavra falada ao NPC, Nome do Outfit local outfitid4 = 1905 -- Aqui a id da outfit 4 local nome5, name5 = 'panico', 'Panico' -- Palavra falada ao NPC, Nome do Outfit local outfitid5 = 1904 -- Aqui a id da outfit 5 local nome6, name6 = 'spider man', 'Spider Man' -- Palavra falada ao NPC, Nome do Outfit local outfitid6 = 1903 -- Aqui a id da outfit 6 ------------------ MESSAGENS -------------------------- if msgcontains(msg, nome1) then selfSay('Voce deseja comprar a outfit do '..name1..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 3 elseif msgcontains(msg, nome2) then selfSay('Voce deseja comprar a outfit do '..name2..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 5 elseif msgcontains(msg, nome3) then selfSay('Voce deseja comprar a outfit do '..name3..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 7 elseif msgcontains(msg, nome4) then selfSay('Voce deseja comprar a outfit do '..name4..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 9 elseif msgcontains(msg, nome5) then selfSay('Voce deseja comprar a outfit do '..name5..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 11 elseif msgcontains(msg, nome6) then selfSay('Voce deseja comprar a outfit do '..name6..' por '..qtdd..' '..getItemNameById(diamond)..'?', cid) talkState[talkUser] = 13 elseif (msgcontains(msg, 'trade') or msgcontains(msg, 'hi')) then selfSay(' Digite qual Outfit deseja adquirir.', cid) selfSay('Atualmente temos a do ash, scorpion, sub zero, homer, panico e spider man', cid) talkState[talkUser] = 0 ---------------------- NEGOCIAÇÃO --------------------------------------- elseif talkState[talkUser] == 3 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid1, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid1, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end elseif talkState[talkUser] == 5 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid2, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid2, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end elseif talkState[talkUser] == 7 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid3, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid3, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end elseif talkState[talkUser] == 9 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid4, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid4, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end elseif talkState[talkUser] == 11 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid5, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid5, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end elseif talkState[talkUser] == 13 then if (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) then if getPlayerItemCount(cid, diamond) >= qtdd then doPlayerRemoveItem(cid, diamond, qtdd) doPlayerAddOutfit(cid, outfitid6, 2) get = getCreatureOutfit(cid) a = {lookType = outfitid6, lookHead = get.lookHead, lookBody = get.lookBody, lookLegs = get.lookLegs, lookFeet = get.lookFeet} doSetCreatureOutfit(cid, a, -1) selfSay('Obrigado, ai estah sua outfit.', cid) else selfSay('Voce nao tem '..qtdd..' '..getItemNameById(diamond)..' contigo.', cid) talkState[talkUser] = 0 end end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Boa sorte. o seu script do tile funcionou, só que eu queria que depois que o player saisse de cima do piso a outfit voltasse a normal http://www.weblara.com.br/
Postado Setembro 13, 2014 10 anos Eu criei isso, quais fora as tags que registrou no movements.xml? Gosta do meu trabalho? Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs. Atenciosamente,Adriano Swatt' Para ver meus tutoriais acesse meu perfil.
Postado Setembro 13, 2014 10 anos deu erro nessa função doSetCreatureOutfit Ops!! Apenas substitua a primeira linha do script por: local poutfit = {lookType = 104} Ficando assim: local poutfit = {lookType = 104} function onStepIn(cid, item, pos, fromPos) if isPlayer(cid) then doSetCreatureOutfit(cid, poutfit, -1) end return 1 end function onStepOut(cid, item, pos, fromPos) if isPlayer(cid) then doRemoveCondition(cid, CONDITION_OUTFIT) end return 1 end E não se esqueça de adicionar corretamente as tags em movements.xml Se te ajudei com o que postei, clique em Bizzle
Postado Setembro 14, 2014 10 anos Fiz da outra maneira porque não sei se esta função mantém as cores personalizadas do player. Gosta do meu trabalho? Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs. Atenciosamente,Adriano Swatt' Para ver meus tutoriais acesse meu perfil.
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.