Postado Janeiro 25, 2014 11 anos Bom, estou aqui para pedir tipo, o player entra no jogo e nao vai escolher a vocation pelo acc manager, eu queria um npc que o player escolhe-se a vocation e depois o player e teleportado para o Templo, pfv ajuda ae, dou REP+
Postado Janeiro 25, 2014 11 anos Bem amigo ver se isso te ajuda vá em data/npc crie um arquivo chamado vocation.xml e coloque isso dentro. <?xml version="1.0" encoding="UTF-8"?><npc name="Vocation" script="data/npc/scripts/vocation.lua" walkinterval="2000" floorchange="0"><mana now="800" max="800"/><health now="200" max="200"/><look type="133" head="114" body="119" legs="132" feet="114"/></npc> Agora vá em data/npc/scripts e crie um arquivo chamado vocation.lua e coloque isso dentro 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 cidif(msgcontains(msg, 'sorcerer') or msgcontains(msg, 'sorcerer')) thenselfSay('Deseja virar {Sorcerer} ?', cid)talkState[talkUser] = 1elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) thendoPlayerSetVocation(cid,9)selfSay('Vocação trocada com sucesso , Agora você é um Sorcerer.', cid) else if(msgcontains(msg, 'knight') or msgcontains(msg, 'knight')) thenselfSay('Deseja virar {knight} ?', cid)talkState[talkUser] = 1elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) thendoPlayerSetVocation(cid,9)selfSay('Vocação trocada com sucesso , Agora você é um Knight.', cid)endtalkState[talkUser] = 0endreturn trueendnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new()) Vermelho:VocaçãoRoxo:ID Da Voc Obs: Eu só coloquei o Sorcerer e Kinght como exemplo se quiser mais é só fazer do mesmo jeito Se for de tibia as vocações não estão configuradas corretamente então configureas Editado Janeiro 25, 2014 11 anos por Teiko (veja o histórico de edições) Atenciosamente, Teiko
Postado Janeiro 25, 2014 11 anos arquivo.xml <?xml version="1.0"?> <npc name="Daniel" script="data/npc/scripts/setvocation.lua" walkinterval="1000" floorchange="0"> <health now="100" max="100"/> <look type="133" head="114" body="119" legs="132" feet="114" addons="3"/> <parameters> <parameter key="message_greet" value="Ola {|PLAYERNAME|}, voce pode se transformar em um {sorcerer}, {druid}, {paladin} ou {knight}." /> </parameters> </npc> setvocation.lua 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 storage = 67413 if msgcontains(msg, 'sorcerer') then if getPlayerStorageValue(cid, storage) == -1 then doPlayerSetVocation(cid, 1) doSendMagicEffect(getPlayerPosition(cid), 28) doPlayerSetStorageValue(cid, storage, 1) selfSay('Parabéns {'..getPlayerName(cid)..'} agora você é um {'..getPlayerVocation(cid)..'}!', cid) else selfSay('Desculpe {'..getPlayerName(cid)..'} mais você já tem uma vocação!', cid) end elseif msgcontains(msg, 'druid') then if getPlayerStorageValue(cid, storage) == -1 then doPlayerSetVocation(cid, 2) doSendMagicEffect(getPlayerPosition(cid), 28) doPlayerSetStorageValue(cid, storage, 1) selfSay('Parabéns {'..getPlayerName(cid)..'} agora você é um {'..getPlayerVocation(cid)..'}!', cid) else selfSay('Desculpe {'..getPlayerName(cid)..'} mais você já tem uma vocação!', cid) end elseif msgcontains(msg, 'paladin') then if getPlayerStorageValue(cid, storage) == -1 then doPlayerSetVocation(cid, 3) doSendMagicEffect(getPlayerPosition(cid), 28) doPlayerSetStorageValue(cid, storage, 1) selfSay('Parabéns {'..getPlayerName(cid)..'} agora você é um {'..getPlayerVocation(cid)..'}!', cid) else selfSay('Desculpe {'..getPlayerName(cid)..'} mais você já tem uma vocação!', cid) end elseif msgcontains(msg, 'knight') then if getPlayerStorageValue(cid, storage) == -1 then doPlayerSetVocation(cid, 4) doSendMagicEffect(getPlayerPosition(cid), 28) doPlayerSetStorageValue(cid, storage, 1) selfSay('Parabéns {'..getPlayerName(cid)..'} agora você é um {'..getPlayerVocation(cid)..'}!', cid) else selfSay('Desculpe {'..getPlayerName(cid)..'} mais você já tem uma vocação!', cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) 16/11/2014 23/11/2014 RIP AnneMotta 21/01/2012 - 15/01/2014 Liga das lendas: DIAMOND É A META
Postado Janeiro 29, 2014 11 anos 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 storage = 67413 if msgcontains(msg, 'sorcerer') then if getPlayerStorageValue(cid, storage) == -1 then doPlayerSetVocation(cid, 1) doSendMagicEffect(getPlayerPosition(cid), 28) doPlayerSetStorageValue(cid, storage, 1) selfSay('Parabéns {'..getPlayerName(cid)..'} agora você é um {'..getPlayerVocation(cid)..'}!', cid) doTeleportThing(cid,{x= 000, y=000, z=000}) ---- Aqui colocara as coordenadas que o player será mandado doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Bem vindo, novo' .. getPlayerVocation(cid) .. ' !') else selfSay('Desculpe {'..getPlayerName(cid)..'} mais você já tem uma vocação!', cid) end elseif msgcontains(msg, 'druid') then if getPlayerStorageValue(cid, storage) == -1 then doPlayerSetVocation(cid, 2) doSendMagicEffect(getPlayerPosition(cid), 28) doPlayerSetStorageValue(cid, storage, 1) selfSay('Parabéns {'..getPlayerName(cid)..'} agora você é um {'..getPlayerVocation(cid)..'}!', cid) doTeleportThing(cid,{x= 000, y=000, z=000}) ---- Aqui colocara as coordenadas que o player será mandado doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Bem vindo, novo' .. getPlayerVocation(cid) .. ' !') else selfSay('Desculpe {'..getPlayerName(cid)..'} mais você já tem uma vocação!', cid) end elseif msgcontains(msg, 'paladin') then if getPlayerStorageValue(cid, storage) == -1 then doPlayerSetVocation(cid, 3) doSendMagicEffect(getPlayerPosition(cid), 28) doPlayerSetStorageValue(cid, storage, 1) selfSay('Parabéns {'..getPlayerName(cid)..'} agora você é um {'..getPlayerVocation(cid)..'}!', cid) doTeleportThing(cid,{x= 000, y=000, z=000}) ---- Aqui colocara as coordenadas que o player será mandado doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Bem vindo, novo' .. getPlayerVocation(cid) .. ' !') else selfSay('Desculpe {'..getPlayerName(cid)..'} mais você já tem uma vocação!', cid) end elseif msgcontains(msg, 'knight') then if getPlayerStorageValue(cid, storage) == -1 then doPlayerSetVocation(cid, 4) doSendMagicEffect(getPlayerPosition(cid), 28) doPlayerSetStorageValue(cid, storage, 1) selfSay('Parabéns {'..getPlayerName(cid)..'} agora você é um {'..getPlayerVocation(cid)..'}!', cid) doTeleportThing(cid,{x= 000, y=000, z=000}) ---- Aqui colocara as coordenadas que o player será mandado doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Bem vindo, novo' .. getPlayerVocation(cid) .. ' !') else selfSay('Desculpe {'..getPlayerName(cid)..'} mais você já tem uma vocação!', cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Edit ao .lua da AnneMotta, para o script também teleportar o player, como pediu. Editado Janeiro 29, 2014 11 anos por Legnus (veja o histórico de edições)
Postado Fevereiro 19, 2014 11 anos Queria essa script com uma parte pra cobrar itens dos players, alguem manda ae?
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.