Ir para conteúdo
Entre para seguir isso  
J u g g e r

Teleport/Change Outfit Tile

Recommended Posts

J u g g e r    1
J u g g e r

Nome: Teleport/Change Outfit Tile

Servidor testado: TFS 0.3.6 pl1

Protocolo: 8.54

Criador do Script : Behmen

Extra: o Script esta simples por ser o meu 1º, mas estarei tentando melhorar o maximo possivel.

 

Crie um arquivo .lua na pasta "data\movements" e adicione isso nele:

 

local female = {lookType = 159, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0}
local male = {lookType = 160, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0}
local position = {x=1023, y=1020, z=7}

function onStepIn(cid, item, pos)
if getCreatureCondition(cid, CONDITION_OUTFIT) == true then
return true
end 
if isPlayer(cid) == TRUE then
if getPlayerSex(cid) == 0 then
doSetCreatureOutfit(cid, male, -1)
else
doSetCreatureOutfit(cid, female, -1)
end
doTeleportThing(cid, position)
end 
return TRUE 
end

Em Movements.xml adicione essa linha nele:

<movevent type="StepIn" actionid="2011" event="script" value="Nome do Arquivo.lua"/>

Explicações: 2011 será o ActionID que você ira Colacar no item que estara localizado em seu MAPA.

 

Editado por Behmen

Compartilhar este post


Link para o post
Oneshot    24
Oneshot

Nada mal. O script está simples, visto que você é iniciante.

 

A funcionalidade é bem interessante, mas clichê. Creio que você pode organizar todo o código um pouco mais e tornar sua configuração mais versátil tabelando os parâmetros.

 

Leia esse tutorial: Tabelas.

 

Ah e você não precisa usar um operador relacional com o valor de função, como você fez aqui:

 

if getCreatureCondition(cid, CONDITION_OUTFIT) == true then

Pois o que o interpretador lê, será algo como:

 

if true == true then

Resumindo tudo, seu script poderá ficar mais ou menos assim:

 

local config = {
  position = {x = 1023, y = 1020, z = 7},
  outfit = {
     [0] = {lookType = 159, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0},
     [1] = {lookType = 160, lookHead = 0, lookBody = 105, lookLegs = 0, lookFeet = 0}
  }
}

function onStepIn(cid, item, pos)
  if isPlayer(cid) and not(getCreatureCondition(cid, CONDITION_OUTFIT) then
     doSetCreatureOutfit(cid, config.outfit[getPlayerSex(cid)])
     doTeleportThing(cid, config.position)
  end
  return true
end

Dê uma estudada juntamente com o tutorial que te passei.

Qualquer dúvida só me contatar via mensagem pessoal.

 

Criatividade: 50

Código : 45

Utilidade : 50

 

Nota Final : 38 ou C

Remuneração Total: 15V$

Editado por Garou

Compartilhar este post


Link para o post
J u g g e r    1
J u g g e r

Obrigado por aprovar Garou, estarei lendo o tutorial que você recomendou.

Editado por Behmen

Compartilhar este post


Link para o post
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×