Ir para conteúdo

Fazer o Buff trocar de vocation por 30 min depois voltar ao normal.

Featured Replies

Postado

AQUI ESTOU EU COM MAIS UM PEDIDO KKK, GOSTARIA DE SABER SE ALGUEM CONSEGUE FAZER ESSE MEU BUFF TROCA A VOCATION ATUAL PARA A VOCATION NUMERO 11 DURANTE 30 MIN. TENHO O BUFF QUE DESENVOLVI COM AJUDA DO PESSOAL AQUI QUE FUNCIONA LEGAL NO MEU SERVER. ELE JA TEM A FUNÇÃO DE TEMPO QUE EU CONSIGO ALTERAR, ELE JA TROCA A OUTFIT E TEM O EXAUST. ACHO QUE APENAS SERIA ADCIONAR MESMO A TROCA DE VOCATION.
CASO ALGUEM QUEIRA ME AJUDAR A FAZER, FAÇA DA MANEIRA QUE ACHAR MAIS FACIL. NÃO TEM IMPORTANCIA DO PLAYER MORRER E CONTINUAR TRANSFORMADO. 

 

 

 local tempo = 30
local effect = {80}
local effect1 = {80}
local outfit = {lookType = 3}
     
local points = 20
local combat = createCombatObject()
local health = 0.05
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, points)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setCombatCondition(combat, condition)

function doHealthSecond(cid, amount, delay) -- function by vodka
if not isCreature(cid) then return LUA_ERROR end
doCreatureAddHealth(cid, amount)
if delay ~= 1 then addEvent(doHealthSecond, 1000, cid, amount, delay -1) end
end

local function Magica(tempo2,tempo3,cid)
if isCreature(cid) then
for i=1, #effect do
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
local position1 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
doSendMagicEffect(position, effect[i])
doSendMagicEffect(position1, effect1[i])
end
end
end

local function Outfitzinha(cid)
doRemoveCondition(cid, CONDITION_OUTFIT)
end
                  
function onCastSpell(cid, var)
if exhaustion.check(cid, 102053) == FALSE then
doCombat(cid, combat, var)
tempo2 = 0
while (tempo2 ~= (tempo*1000)) do
addEvent(Magica, tempo2, tempo2, tempo*1000, cid)
addEvent(Outfitzinha, tempo*1000, cid)
tempo2 = tempo2 + 1000
end
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
exhaustion.set(cid, 102053, tempo)
doCreatureSay(cid, "KAIOKEEEEEEEN", TALKTYPE_MONSTER)
doSendMagicEffect(position, 80)
doHealthSecond(cid, -getCreatureMaxHealth(cid) * health, tempo)
doSetCreatureOutfit(cid, outfit)

else
doPlayerSendCancel(cid, "Desculpe, voce ja esta Transformado.")
end
end

ESSE É O CODIGO DO BUFF.
USO TFS 0.4 E TIBIA 8.60

 

 

Resolvido por Nother

Ir para solução
  • Respostas 18
  • Visualizações 1.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Testa,  

  • Agora que eu parei pra ler o script inteiro. Tava cheio de problemas, esse do tempo era um deles, a vocação de fato mudava pra 11, mas 0.030 segundos depois o char voltava pra voc original  Essa var

  • Se deslogar, morrer, ou passar 30 min, perde a transformação. O cooldown é 30 min e continua contando mesmo se o player morrer.

Posted Images

Postado
local tempo = 30
local effect = {80}
local effect1 = {80}
local outfit = {lookType = 3}
local voc = 6 --- VOCATION
     
local points = 20
local combat = createCombatObject()
local health = 0.05
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, points)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setCombatCondition(combat, condition)

function doHealthSecond(cid, amount, delay) -- function by vodka
if not isCreature(cid) then return LUA_ERROR end
doCreatureAddHealth(cid, amount)
if delay ~= 1 then addEvent(doHealthSecond, 1000, cid, amount, delay -1) end
end

local function Magica(tempo2,tempo3,cid)
if isCreature(cid) then
for i=1, #effect do
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
local position1 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
doSendMagicEffect(position, effect[i])
doSendMagicEffect(position1, effect1[i])
end
end
end

local function Outfitzinha(cid)
doRemoveCondition(cid, CONDITION_OUTFIT)
end
                  
function onCastSpell(cid, var)
  registerCreatureEvent(cid, "stordeath")
	setPlayerStorageValue(cid, voc_stor, getPlayerVocation(cid))
	doPlayerSetVocation(cid, voc)
	addEvent(doPlayerSetVocation,tempo,cid,getPlayerStorageValue(cid, voc_stor))
	addEvent(setPlayerStorageValue,tempo,cid,voc_stor,0)
if exhaustion.check(cid, 102053) == FALSE then
doCombat(cid, combat, var)
tempo2 = 0
while (tempo2 ~= (tempo*1000)) do
addEvent(Magica, tempo2, tempo2, tempo*1000, cid)
addEvent(Outfitzinha, tempo*1000, cid)
tempo2 = tempo2 + 1000
end
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
exhaustion.set(cid, 102053, tempo)
doCreatureSay(cid, "KAIOKEEEEEEEN", TALKTYPE_MONSTER)
doSendMagicEffect(position, 80)
doHealthSecond(cid, -getCreatureMaxHealth(cid) * health, tempo)
doSetCreatureOutfit(cid, outfit)

else
doPlayerSendCancel(cid, "Desculpe, voce ja esta Transformado.")
end
end

 

Em creaturescripts/scripts/

function onDeath(cid, corpse, deathList)
	local i = getPlayerStorageValue(cid, voc_stor)
	if i > 0 then
		doPlayerSetVocation(cid, i)
		setPlayerStorageValue(cid, voc_stor, 0)
	end
	return true
end
<event type="death" name="stordeath" event="script" value="stordeath.lua"/>

 

Postado
  • Autor
30 minutos atrás, Fabi Marzan disse:

local tempo = 30
local effect = {80}
local effect1 = {80}
local outfit = {lookType = 3}
local voc = 6 --- VOCATION
     
local points = 20
local combat = createCombatObject()
local health = 0.05
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, tempo*1000)
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, points)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, points)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setCombatCondition(combat, condition)

function doHealthSecond(cid, amount, delay) -- function by vodka
if not isCreature(cid) then return LUA_ERROR end
doCreatureAddHealth(cid, amount)
if delay ~= 1 then addEvent(doHealthSecond, 1000, cid, amount, delay -1) end
end

local function Magica(tempo2,tempo3,cid)
if isCreature(cid) then
for i=1, #effect do
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
local position1 = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
doSendMagicEffect(position, effect[i])
doSendMagicEffect(position1, effect1[i])
end
end
end

local function Outfitzinha(cid)
doRemoveCondition(cid, CONDITION_OUTFIT)
end
                  
function onCastSpell(cid, var)
  registerCreatureEvent(cid, "stordeath")
	setPlayerStorageValue(cid, voc_stor, getPlayerVocation(cid))
	doPlayerSetVocation(cid, voc)
	addEvent(doPlayerSetVocation,tempo,cid,getPlayerStorageValue(cid, voc_stor))
	addEvent(setPlayerStorageValue,tempo,cid,voc_stor,0)
if exhaustion.check(cid, 102053) == FALSE then
doCombat(cid, combat, var)
tempo2 = 0
while (tempo2 ~= (tempo*1000)) do
addEvent(Magica, tempo2, tempo2, tempo*1000, cid)
addEvent(Outfitzinha, tempo*1000, cid)
tempo2 = tempo2 + 1000
end
local position = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
exhaustion.set(cid, 102053, tempo)
doCreatureSay(cid, "KAIOKEEEEEEEN", TALKTYPE_MONSTER)
doSendMagicEffect(position, 80)
doHealthSecond(cid, -getCreatureMaxHealth(cid) * health, tempo)
doSetCreatureOutfit(cid, outfit)

else
doPlayerSendCancel(cid, "Desculpe, voce ja esta Transformado.")
end
end

 

Em creaturescripts/scripts/


function onDeath(cid, corpse, deathList)
	local i = getPlayerStorageValue(cid, voc_stor)
	if i > 0 then
		doPlayerSetVocation(cid, i)
		setPlayerStorageValue(cid, voc_stor, 0)
	end
	return true
end

<event type="death" name="stordeath" event="script" value="stordeath.lua"/>

 

Testei aqui amigo, e acabou que não mudou de vocação, a sprite ainda muda mas a vocativo continua a que usou o buff.

Agora, Nother disse:

Testei aqui amigo, e acabou que não mudou de vocação, a sprite ainda muda mas a vocativo continua a que usou o buff.

E não apareceu nenhum erro na distro

Postado

Tem que colocar um check no logout também, se não o char desloga e fica com o vocação trocada pra sempre.

Na spell, embaixo do:

 registerCreatureEvent(cid, "stordeath")



Adiciona:

 registerCreatureEvent(cid, "stordeath_off")



Complementando o stordeath.lua:

function onLogout(cid)
    local i = getPlayerStorageValue(cid, voc_stor)
    if i > 0 then
        doPlayerSetVocation(cid, i)
        setPlayerStorageValue(cid, voc_stor, 0)
    end
	return true
end

function onDeath(cid, corpse, deathList)
	local i = getPlayerStorageValue(cid, voc_stor)
	if i > 0 then
		doPlayerSetVocation(cid, i)
		setPlayerStorageValue(cid, voc_stor, 0)
	end
	return true
end



Por fim, adicione também essa tag no creaturescripts.xml:

<event type="logout" name="stordeath_off" event="script" value="stordeath.lua"/>

 

Postado
  • Autor
5 minutos atrás, 139 disse:

Tem que colocar um check no logout também, se não o char desloga e fica com o vocação trocada pra sempre.

Na spell, embaixo do:


 registerCreatureEvent(cid, "stordeath")



Adiciona:


 registerCreatureEvent(cid, "stordeath_off")



Complementando o stordeath.lua:


function onLogout(cid)
    local i = getPlayerStorageValue(cid, voc_stor)
    if i > 0 then
        doPlayerSetVocation(cid, i)
        setPlayerStorageValue(cid, voc_stor, 0)
    end
	return true
end

function onDeath(cid, corpse, deathList)
	local i = getPlayerStorageValue(cid, voc_stor)
	if i > 0 then
		doPlayerSetVocation(cid, i)
		setPlayerStorageValue(cid, voc_stor, 0)
	end
	return true
end



Por fim, adicione também essa tag no creaturescripts.xml:


<event type="logout" name="stordeath_off" event="script" value="stordeath.lua"/>

 

Fiz essas alterações que me informou mas ainda esta da mesma forma, ele usa o buff mas a vocation não muda e não apresenta nenhum erro na distro

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo