RA
pedido

[8.54] Pedido Efeito Na Vocation

Por Raidou, 12 de set. de 2012 em Scripts

pedido efeito na vocation
otserv
tibia
script
33
3.9k
RaidouR
12 de setembro de 2012 às 19:19

Olá galerinha do Xtibia,hoje estou aqui para pedir um script,que provavelmente irá ficar na pasta creaturescripts.Bom agora leiam abaixo o que eu quero que o script Faça...

 

-Quero que quando o player se transforma nakela vocation,ele fike soltando um efeito(configurável.),e so saia,quando o player virar outra vocation,que eu n por para dar efeito.

 

 

O que quero que esteja no Script?

-Parte do script,para mim configurar,tal vocations,com tal ID de efeito.

 

Muito Obrigado,pela atençao.

caoticC
12 de setembro de 2012 às 19:32

o efeito e constante(infinito)?

RaidouR
12 de setembro de 2012 às 19:34

Sim.Mais dai se ele troka de vocation.

 

E a nova vocation for uma da que eu botei,no script,ele muda o efeito.

 

 

E se a proxima vocation n tiver no script,ela n fica com efeito nenhum

Editado Setembro 12 por Raidou

SkyLighS
12 de setembro de 2012 às 19:35

Você quer direto ou so as vezes?

RaidouR
12 de setembro de 2012 às 19:45

Eu quero.Assim.

 

Vou dar um exemplo.

 

Eu sou vocaçao goku de dragon ball

Dai eu falo transformar.

Ele muda de vocation,e outfit.Entao quero que quando ele ficar nakela tal vocation,ele de um efeito.Que eu botarei o ID.

 

obs:Quero,que de pra por,varias vocations.com efeito neste script.

 

Obrigado.

NewtonnotwenN
12 de setembro de 2012 às 19:53

Como o outfit é próprio da vocação use esse script:

 

(Autor desconhecido, encontrei em meu ot):

 

Em data/creaturescripts/scripts crie um arquivo.lua nomeie para voceff e adicione:

function onLogin(cid)

registerCreatureEvent(cid, "EffectOutLogin")

registerCreatureEvent(cid, "OutfitEffects")

return doCreatureChangeOutfit(cid,{lookType = getCreatureOutfit(cid).lookType, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet, lookAddons = getCreatureOutfit(cid).lookAddons})

end

local events = {}

function onOutfit(cid, old, current)

local effect = {

[138] = 40, [130] = 40, -- mage

[270] = 27,[273] = 27, -- jester

[156] = 61,[152] = 61, -- assassin

[147] = 44,[143] = 44, -- barbarian

[148] = 45,[144] = 45, -- druid

[157] = 68,[153] = 68, -- beggar

[149] = 36,[145] = 36, -- wizard

[279] = 17,[278] = 17, -- brotherwood

[137] = 39,[129] = 39, -- hunter

[141] = 66,[133] = 66, -- summoner

[142] = 34,[134] = 34, -- warrior

[155] = 31,[151] = 31, -- pirate

[158] = 46,[154] = 46, -- shaman

[288] = 6,[289] = 6, -- demonhunter

[139] = 7,[131] = 7 -- knight

}

local o,c= effect[old.lookType],effect[current.lookType]

if getPlayerAccess(cid) > 2 then return true

elseif (not o or not c or old.lookAddons <= 3 and o) then stopEvent(events[getPlayerGUID(cid)]) end

if current.lookAddons <= 3 and c then

function WalkEffect(cid, c, pos)

if not isCreature(cid) then return LUA_ERROR end

if c then frompos = getThingPos(cid)

if frompos.x ~= pos.x or frompos.y ~= pos.y or frompos.z ~= pos.z then doSendMagicEffect(frompos, c) end

events[getPlayerGUID(cid)] = addEvent(WalkEffect, 100, cid, c, frompos)

end return true end

WalkEffect(cid, c, {x=0, y=0, z=0}) end

return true

end

-Vermelho: numero da outfit e efeito (z).

 

Em creaturescripts.xml adicione:

<event type="login" name="EffectOutLogin" event="script" value="voceff.lua"/>

LuckOakeL
12 de setembro de 2012 às 19:57

Ou use esse aqui que é direto no talkactions, caso o do Newtonnowtwen não for o que deseja.

 

 

-- Script by LuckOake

local tempo = 1 -- De quanto em quantos segundos sairá o efeito

local voc_ef = { -- Vocation ID / efeito

[1] = 10,

[2] = 10,

[3] = 10

}

 

local voc_table = voc_ef[getPlayerVocation(cid)]

 

function efeito(cid)

for i = 1, #voc_ef do

if getPlayerVocation(cid) ~= i then return true

end

end

 

doSendMagicEffect(getCreaturePos(cid), voc_table)

addEvent(efeito, tempo*1000, cid)

end

 

function onSay(cid, words)

efeito(cid)

return true

end

 

 

Use a tag que desejar. Não garanto que funciona, mas tente ai.

Editado Setembro 12 por LuckOake

caoticC
12 de setembro de 2012 às 20:00

Na ultima configuração se deixa sem virgula

 

 

Cria um arquivo lua chamado efeito.

 

 
local vocs = {
["Sorcerer"] = {effect = 12},
["Paladin"] = {effect = 13}

}

function onThink(cid, interval)
local voc = getPlayerVocationName(cid)
if vocs[voc] then
local efeito = vocs[voc].effect
doSendMagicEffect(getCreaturePosition(cid), efeito)
return true
end
return true
end

 

 

tag:

 

<event type="think" name="efe" event="script" value="efeito.lua"/>

 

Registra no login.lua

 

registerCreatureEvent(cid, "efe")

RaidouR
12 de setembro de 2012 às 20:07

Amigo,eu nao consigui por pra funcionar olha como o meu ficou.

 

 

 

function onLogin(cid)

registerCreatureEvent(cid, "EffectOutLogin")

registerCreatureEvent(cid, "OutfitEffects")

return doCreatureChangeOutfit(cid,{lookType = getCreatureOutfit(cid).lookType, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet, lookAddons = getCreatureOutfit(cid).lookAddons})

end

local events = {}

function onOutfit(cid, old, current)

local effect = {

[68] = 14, [67] = 14, -- mage

[270] = 27,[273] = 27 -- jester

}

local o,c= effect[old.lookType],effect[current.lookType]

if getPlayerAccess(cid) > 2 then return true

elseif (not o or not c or old.lookAddons <= 3 and o) then stopEvent(events[getPlayerGUID(cid)]) end

if current.lookAddons <= 3 and c then

function WalkEffect(cid, c, pos)

if not isCreature(cid) then return LUA_ERROR end

if c then frompos = getThingPos(cid)

if frompos.x ~= pos.x or frompos.y ~= pos.y or frompos.z ~= pos.z then doSendMagicEffect(frompos, c) end

events[getPlayerGUID(cid)] = addEvent(WalkEffect, 100, cid, c, frompos)

end return true end

WalkEffect(cid, c, {x=0, y=0, z=0}) end

return true

end

 

 

 

Se tiver algum por vocation em ves de outfit,fica melhor obrigado.

 

 

@Caotic

 

Nao tem como por,pra por o ID da vocation,em ves do nome?

 

@LuckOake

 

Como eu ponho ele no talkaction?

Editado Setembro 12 por Raidou

caoticC
12 de setembro de 2012 às 20:30

Ta feito

 

 

local vocs = {
[1] = {effect = 12},
[2] = {effect = 12},
[4] = {effect = 12},
[3] = {effect = 12},
[5] = {effect = 12},
[6] = {effect = 12},
[7] = {effect = 12},
[8] = {effect = 12},
[9] = {effect = 12},
[10] = {effect = 12},
[11] = {effect = 13}

}

function onThink(cid, interval)
local voc = getPlayerVocation(cid)
if vocs[voc] then
local efeito = vocs[voc].effect
doSendMagicEffect(getCreaturePosition(cid), efeito)
return true
end
return true
end

RaidouR
12 de setembro de 2012 às 20:34

Vou testar aki,ja edito.

 

 

@Edit

Desculpe amigo,nao funcionou.

Editado Setembro 12 por Raidou

caoticC
12 de setembro de 2012 às 20:50

Acabei de testar e funcionou.

 

Deixa eu ver como você pos

RaidouR
12 de setembro de 2012 às 20:53

Eu botei assim:

 

local vocs = {
[7] = {effect = 14},
[6] = {effect = 13},
[5] = {effect = 14}

}

function onThink(cid, interval)
local voc = getPlayerVocation(cid)
if vocs[voc] then
local efeito = vocs[voc].effect
doSendMagicEffect(getCreaturePosition(cid), efeito)
return true
end
return true
end

SnowszS
12 de setembro de 2012 às 20:54

Ae fiz que, usa a mesma tag do caotic e a tag do onlogin

local pos = getCreaturePosition(cid)
function onThink(cid, interval)
if getPlayerVocation(cid) == 2 then
doSendMagicEffect(pos, 29)
elseif getPlayerVocation(cid) == 5 then
doSendMagicEffect(pos, 65)
end
return true
end

 

só é ir copiando o

 

elseif getPlayerVocation(cid) == 5 then

doSendMagicEffect(pos, 65)

 

e colando antes do end, o == 5 é a vocation id e o 65 é o id do efeito

Editado Setembro 12 por Snowsz

RaidouR
12 de setembro de 2012 às 21:06

Ae fiz que, usa a mesma tag do caotic e a tag do onlogin

local pos = getCreaturePosition(cid)
function onThink(cid, interval)
if getPlayerVocation(cid) == 2 then
doSendMagicEffect(pos, 29)
elseif getPlayerVocation(cid) == 5 then
doSendMagicEffect(pos, 65)
end
return true
end

 

só é ir copiando o

 

elseif getPlayerVocation(cid) == 5 then

doSendMagicEffect(pos, 65)

 

e colando antes do end, o == 5 é a vocation id e o 65 é o id do efeito

 

Quando eu adicionei este script.Ele nem transforma e nem reverte mais o.O