Ir para conteúdo
  • Cadastre-se

(Resolvido)Ajudem com esse Talkactions


Ir para solução Resolvido por najatheus,

Posts Recomendados

tfs 1.3

 

gostaria de fazer essa script: 

local config = {
--[vocation id] = { level, nova voc, looktype, efeito}
-- Goku
[1] = { 25, 2, 3, 32},
[2] = { 50, 3, 4, 32},
[3] = { 75, 4, 5, 32},
[4] = { 100, 5, 7, 32},
[5] = { 125, 6, 6, 32},
[6] = { 150, 7, 8, 32},
[7] = { 200, 8, 9, 32},
[8] = { 250, 9, 17, 32},
[9] = { 300, 10, 630, 32}
}
function onSay(cid, words, param, channel)
local voc = config[getPlayerVocation(cid)]
if voc then
if getPlayerLevel(cid) >= voc[1] then
doPlayerSetVocation(cid, voc[2])
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Voce se transformou!")
doCreatureSay(cid, "Transformar", 19)
local outfit = {lookType = voc[3]}
doCreatureChangeOutfit(cid, outfit)
doSendMagicEffect(getCreaturePosition(cid), voc[4])
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Voce precisa estar no level " .. voc[1] .. " para transformar.")
end
else
doPlayerSendCancel(cid, "Nao é possível se transformar.")
end
return true
end

 

 

Virar em TFS 1.3, pois funciona, mais a outfit não muda só se eu relogar! e o efeito tbm não esta indo!

Link para o post
Compartilhar em outros sites
  • Solução
local config = {
    --[vocation id] = { level, nova voc, looktype, efeito}
    -- Goku
    [1] = { 25, 2, 3, 32},
    [2] = { 50, 3, 4, 32},
    [3] = { 75, 4, 5, 32},
    [4] = { 100, 5, 7, 32},
    [5] = { 125, 6, 6, 32},
    [6] = { 150, 7, 8, 32},
    [7] = { 200, 8, 9, 32},
    [8] = { 250, 9, 17, 32},
    [9] = { 300, 10, 630, 32}
  }
  function onSay(player, words, param)
      local vocation = player:getVocation():getId()
      local voc = config[vocation]
  if(not(voc))then
      return(player:sendTextMessage(MESSAGE_STATUS_SMALL, player:getName() .. " Nao é possível se transformar.") and false)
    end
  
      if(player:getLevel() >= voc[1])then
        player:setVocation(voc[2])
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, player:getName() .. " Voce se transformou!")
        player:say("Transformar")
        player:setOutfitLookType(voc[3])
        player:getPosition():sendMagicEffect(voc[4])
        return(false)
      else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, player:getName() .. " Nao é possível se transformar.")
        return(false)
      end
  end

 

Coloque em lib/core/creature.lua :

 

function Creature:setOutfitLookType(value)
  local outfit = self:getOutfit()
  outfit.lookType = value
  self:setOutfit(outfit)
  return(true)
end

 

Editado por najatheus (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
10 minutos atrás, najatheus disse:

local config = {
  --[vocation id] = { level, nova voc, looktype, efeito}
  -- Goku
  [1] = { 25, 2, 3, 32},
  [2] = { 50, 3, 4, 32},
  [3] = { 75, 4, 5, 32},
  [4] = { 100, 5, 7, 32},
  [5] = { 125, 6, 6, 32},
  [6] = { 150, 7, 8, 32},
  [7] = { 200, 8, 9, 32},
  [8] = { 250, 9, 17, 32},
  [9] = { 300, 10, 630, 32}
}

local function transformOutfit(player, value)
  local outfit = player:getOutfit()
  outfit.lookType = value
  player:setOutfit(outfit)
  return(true)
end

function onSay(player, words, param)
    local vocation = player:getVocation()
    local voc = config[vocation]
    if(not(voc))then
      return(false)
    end

    if(player:getLevel() >= voc[1])then
      player:setVocation(voc[2])
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, player:getName() .. " Voce se transformou!")
      player:say("Transformar")
      transformOutfit(voc[3])
      player:getPosition():sendMagicEffect(voc[4])
      return(false)
    else
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, player:getName() .. " Nao é possível se transformar.")
      return(false)
    end
end

 

Não acontece nada, e não dar erro na source, como nada tivesse escrito. 

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo