JU
pedido

Spell Invisivel

Por julhinhuu, 21 de set. de 2015 em Scripts

invisible
resolvido
script
otserv
10
7.2k
julhinhuuJ
21 de setembro de 2015 às 17:59

Olá galera do Xtibia,

 

Estou aqui novamente enchendo o saco de vocês e novamente preciso de outra Spell.

 

- A condição da Spell tem que deixar o player invisível por determinado segundos, como se fosse um GM.

 

Agradeço desde já :D

RumplestiltiskinR
21 de setembro de 2015 às 21:44

1º - Crie um arquivo .lua em Data / Spells / Scripts com o nome spellinvisivel e cole isso dentro:

 

 

 

local time = 3
local spelltime = 60
local invisible = createConditionObject(CONDITION_GAMEMASTER, -1, false, GAMEMASTER_INVISIBLE)
local outfit = createConditionObject(CONDITION_INVISIBLE, -1, false)


function onCastSpell(cid, var)
if getPlayerStorageValue(cid, 2132312) < os.time () then
doAddCondition(cid, invisible)
doAddCondition(cid, outfit)
setPlayerGroupId(cid, 2)
setPlayerStorageValue(cid, 2132313, 1)
setPlayerStorageValue(cid, 2132312, os.time () + spelltime)
addEvent(function()
if isPlayer(cid) then
doRemoveCondition(cid, CONDITION_INVISIBLE)
setPlayerStorageValue(cid, 2132313, -1)
setPlayerGroupId(cid, 1)
doRemoveCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE)
end
end, time * 1000)
else
doPlayerSendCancel(cid, "Voce so pode usar esse magia daqui a "..getPlayerStorageValue(cid, 2132312) - os.time ().." segundos.")
return false
end
return true
end

 

 

 

2º - Adicione esta tag em seu spells.xml (data / spells):

 

 

 

<instant name="Invisible" words="invisible" lvl="100" mana="100" prem="0" event="script" value="spellinvisivel.lua">
</instant>

 

 

 

3º - Adicione esta tag em seu login.lua (data / creaturescripts / scripts):

 

 

 

if getPlayerStorageValue(cid, 2132313) == 1 then
doRemoveCondition(cid, CONDITION_INVISIBLE)
doRemoveCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE)
setPlayerStorageValue(cid, 2132313, -1)
end

 

 

 

Qualquer erro ou dúvida me informe aqui.

julhinhuuJ
21 de setembro de 2015 às 22:56

1º - Crie um arquivo .lua em Data / Spells / Scripts com o nome spellinvisivel e cole isso dentro:

 

 

 

local time = 3

local spelltime = 60

local invisible = createConditionObject(CONDITION_GAMEMASTER, -1, false, GAMEMASTER_INVISIBLE)

local outfit = createConditionObject(CONDITION_INVISIBLE, -1, false)

 

 

function onCastSpell(cid, var)

if getPlayerStorageValue(cid, 2132312) < os.time () then

doAddCondition(cid, invisible)

doAddCondition(cid, outfit)

setPlayerGroupId(cid, 2)

setPlayerStorageValue(cid, 2132313, 1)

setPlayerStorageValue(cid, 2132312, os.time () + spelltime)

addEvent(function()

if isPlayer(cid) then

doRemoveCondition(cid, CONDITION_INVISIBLE)

setPlayerStorageValue(cid, 2132313, -1)

setPlayerGroupId(cid, 1)

doRemoveCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE)

end

end, time * 1000)

else

doPlayerSendCancel(cid, "Voce so pode usar esse magia daqui a "..getPlayerStorageValue(cid, 2132312) - os.time ().." segundos.")

return false

end

return true

end

 

 

 

2º - Adicione esta tag em seu spells.xml (data / spells):

 

 

 

<instant name="Invisible" words="invisible" lvl="100" mana="100" prem="0" event="script" value="spellinvisivel.lua">
</instant>

 

 

 

3º - Adicione esta tag em seu login.lua (data / creaturescripts / scripts):

 

 

 

if getPlayerStorageValue(cid, 2132313) == 1 then

doRemoveCondition(cid, CONDITION_INVISIBLE)

doRemoveCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE)

setPlayerStorageValue(cid, 2132313, -1)

end

 

 

 

Qualquer erro ou dúvida me informe aqui.

 

Bem, erro no console não da, mais o player não fica invisível literalmente, outros jogadores podem ver e atacar e também o invisible não sai, só sai quando eu o ataco. Gostaria que ele ficasse imune por 3 segundos sendo que invisível.

 

 

RumplestiltiskinR
22 de setembro de 2015 às 09:16

Você tentou com 2 "players" ? Porque se você estiver em algum membro da staff ele vai ver o personagem.

 

E qual versão do tfs está usando ?

julhinhuuJ
22 de setembro de 2015 às 12:29

Você tentou com 2 "players" ? Porque se você estiver em algum membro da staff ele vai ver o personagem.

 

E qual versão do tfs está usando ?

 

Sim estou tentando com outro 2 "jogadores", ele fica como se eu estivesse usando a magia utana vid e um outro jogador pode atacá-lo.

Estou usando o console OTX server - The OTX Server Version: (2.90 - 4644)

RumplestiltiskinR
22 de setembro de 2015 às 14:34

Modifique o arquivo spellinvisivel.lua:

 

 

local time = 3
local spelltime = 60
local invisible = createConditionObject(CONDITION_GAMEMASTER, -1, true, GAMEMASTER_INVISIBLE)
local outfit = createConditionObject(CONDITION_INVISIBLE, -1, true)


function onCastSpell(cid, var)
if getPlayerStorageValue(cid, 2132312) < os.time () then
doAddCondition(cid, invisible)
doAddCondition(cid, outfit)
setPlayerGroupId(cid, 2)
setPlayerStorageValue(cid, 2132313, 1)
setPlayerStorageValue(cid, 2132312, os.time () + spelltime)
addEvent(function()
if isPlayer(cid) then
doRemoveCondition(cid, CONDITION_INVISIBLE)
setPlayerStorageValue(cid, 2132313, -1)
setPlayerGroupId(cid, 1)
doRemoveCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE)
end
end, time * 1000)
else
doPlayerSendCancel(cid, "Voce so pode usar esse magia daqui a "..getPlayerStorageValue(cid, 2132312) - os.time ().." segundos.")
return false
end
return true
end

 

julhinhuuJ
24 de setembro de 2015 às 14:48
Melhor resposta

Modifique o arquivo spellinvisivel.lua:

 

 

local time = 3

local spelltime = 60

local invisible = createConditionObject(CONDITION_GAMEMASTER, -1, true, GAMEMASTER_INVISIBLE)

local outfit = createConditionObject(CONDITION_INVISIBLE, -1, true)

 

 

function onCastSpell(cid, var)

if getPlayerStorageValue(cid, 2132312) < os.time () then

doAddCondition(cid, invisible)

doAddCondition(cid, outfit)

setPlayerGroupId(cid, 2)

setPlayerStorageValue(cid, 2132313, 1)

setPlayerStorageValue(cid, 2132312, os.time () + spelltime)

addEvent(function()

if isPlayer(cid) then

doRemoveCondition(cid, CONDITION_INVISIBLE)

setPlayerStorageValue(cid, 2132313, -1)

setPlayerGroupId(cid, 1)

doRemoveCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE)

end

end, time * 1000)

else

doPlayerSendCancel(cid, "Voce so pode usar esse magia daqui a "..getPlayerStorageValue(cid, 2132312) - os.time ().." segundos.")

return false

end

return true

end

 

Continua da mesma forma vou te mandar um script para voce que funcionou, só que eu gostaria que não aparece no default o nome /ghost, não sei se tem como mais vou te pedir assim mesmo.

 

Segue ai:

function onCastSpell(cid, var)parameters = {cid=cid}setPlayerGroupId(cid, 2)doCreatureExecuteTalkAction(cid, "/ghost", TRUE)addEvent(talk, 3000, parameters)    return trueendfunction talk(parameters)doCreatureExecuteTalkAction(parameters.cid, "/ghost", TRUE)setPlayerGroupId(parameters.cid, 1)endend

Sobeeee , ajuda ai meu povo

( risos )

Up

Editado Setembro 22 por julhinhokullitz

Dennyz DiasD
25 de setembro de 2015 às 21:31

Upp

Tambem to precisando

julhinhuuJ
25 de setembro de 2015 às 22:18

Pode fechar o tópico ja consegui. :D, vou fazer um tutorial pra ajuda a comunidade rs.

MudrockM
25 de setembro de 2015 às 22:26

Tópico movido para dúvidas / pedidos resolvidos.