Essa spell tem varias fases?
info
Grupo: Conde
Registrado: 04/08/12
Posts: 762
Reputação: +80

info
Grupo: Campones
Registrado: 22/11/11
Posts: 52
Reputação: 0
Char no Tibia: so jogo ots 8.4

como que vejo ? e me acc no msn kkk
info
Grupo: Conde
Registrado: 04/08/12
Posts: 762
Reputação: +80

end
local function onCastSpell2(parameters)
doCombat(parameters.cid, combat2, parameters.var)
end
local function onCastSpell3(parameters)
doCombat(parameters.cid, combat3, parameters.var)
end
local function onCastSpell4(parameters)
doCombat(parameters.cid, combat4, parameters.var)
end
local function onCastSpell5(parameters)
doCombat(parameters.cid, combat5, parameters.var)
end
local function onCastSpell6(parameters)
doCombat(parameters.cid, combat6, parameters.var)
end
function onCastSpell(cid, var)
local parameters = { cid = cid, var = var}
addEvent(onCastSpell1, 500, parameters)
addEvent(onCastSpell2, 1000, parameters)
addEvent(onCastSpell3, 1500, parameters)
addEvent(onCastSpell4, 2000, parameters)
addEvent(onCastSpell5, 2500, parameters)
addEvent(onCastSpell6, 3000, parameters)
Sua spell possui isso?
Editado Agosto 5 por Newtonnotwen
info
Grupo: Campones
Registrado: 22/11/11
Posts: 52
Reputação: 0
Char no Tibia: so jogo ots 8.4

Sim posui olha o script
local config =
{
seconds = 10,
storage = 47112120,
msg = "Voc\ê preci\ça aguardar alguns segundos para acumular o esp\írito.",
mana = 600,
semMana = "Voc\ê n\ão t\êm mana suficiente."
}
local function useAgain(cid)
setPlayerStorageValue(cid, config.storage, 2)
return TRUE
end
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 54)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -1.3, -50, -2.3, -50)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 54)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -1.3, -50, -2.3, -50)
local condition2 = createConditionObject(CONDITION_POISON)
setConditionParam(condition2, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition2, 5, 2000, -500)
setCombatCondition(combat2, condition2)
local condition2 = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition2, CONDITION_PARAM_TICKS, 20000)
--setConditionParam(condition2, CONDITION_PARAM_SPEED, -500)
setConditionFormula(condition2, -0.8, 0, -0.8, 0)
setCombatCondition(combat2, condition2)
arr1 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}
arr2 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
}
local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
setCombatArea(combat1, area1)
setCombatArea(combat2, area2)
local function onCastSpell2(parameters)
doCombat(parameters.cid, parameters.combat2, parameters.var)
end
function onCastSpell(cid, var)
if getPlayerStorageValue(cid, config.storage) == 1 then
doPlayerSendCancel(cid, config.msg)
return TRUE
end
if getPlayerStorageValue(cid, config.storage) ~= 1 then
if getPlayerMana(cid) >= config.mana then
doPlayerAddMana(cid, -config.mana)
setPlayerStorageValue(cid, config.storage, 1)
addEvent(useAgain, config.seconds*1000, cid)
local parameters = { cid = cid, var = var, combat2 = combat2 }
addEvent(onCastSpell2, 300, parameters)
return doCombat(cid, combat1, var)
else
doPlayerSendCancel(cid, config.semMana)
end
end
return TRUE
end
info
Grupo: Conde
Registrado: 04/08/12
Posts: 762
Reputação: +80

Acontece oque com o player?
info
Grupo: Campones
Registrado: 22/11/11
Posts: 52
Reputação: 0
Char no Tibia: so jogo ots 8.4

Nd Mais Comesa a travar e tem vez q aparese que o distro paro de funcionar por causa diso ;/
info
Grupo: Conde
Registrado: 04/08/12
Posts: 762
Reputação: +80

Vai em creaturescript/script abre login.lua e antes do ultimo end coloca:
setPlayerstorageValue(cid, 47112120, 2)
-------------------Editado
Editado Agosto 5 por Newtonnotwen
info
Grupo: Campones
Registrado: 22/11/11
Posts: 52
Reputação: 0
Char no Tibia: so jogo ots 8.4

Pdc vamos ver se funfa kk
Ficaria asim
function onLogin(cid)
setPlayerStorageValue(cid, 47112120, 2)
local voc = getPlayerVocation(cid)
if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then
sendGemEffect(cid, gems.storage[voc], gems.interval[voc])
end
return TRUE
setPlayerstorageValue(cid, 47112120, 2)
end
Editado Agosto 5 por angelanascimento
info
Grupo: Conde
Registrado: 04/08/12
Posts: 762
Reputação: +80

Tenta dos 3 jeitos, um deve funcionar.
function onLogin(cid)
setPlayerStorageValue(cid, 47112120, 2)
local voc = getPlayerVocation(cid)
if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then
sendGemEffect(cid, gems.storage[voc], gems.interval[voc])
end
return TRUE
setPlayerstorageValue(cid, 47112120, 2)
end
function onLogin(cid)
setPlayerStorageValue(cid, 47112120, 2)
local voc = getPlayerVocation(cid)
if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then
sendGemEffect(cid, gems.storage[voc], gems.interval[voc])
end
setPlayerstorageValue(cid, 47112120, 2)
return TRUE
end
function onLogin(cid)
setPlayerStorageValue(cid, 47112120, 2)
local voc = getPlayerVocation(cid)
if getPlayerStorageValue(cid, gems.storage[getPlayerVocation(cid)]) > 0 then
sendGemEffect(cid, gems.storage[voc], gems.interval[voc])
setPlayerstorageValue(cid, 47112120, 2)
end
return TRUE
end
Editado Agosto 5 por Newtonnotwen
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

@Newtonnotwen
Parece que o problema não é no logout, e sim na própria spell. Observe que o evento useAgain coloca uma storage de valor 2 no player e acontece dentro de 10 segundos após a magia ser utilizada, e se o player fizer logout nesse período e a ação ser executada, vai dar o erro, pois não haverá player.
No seu script, ao fazer login, a storage de valor 2 é colocada no player, mas ainda assim o evento useAgain vai continuar a ser executado, e vai dar o erro do mesmo jeito se o player fizer logout novamente. E uma falha. É só fazer logout e login com o seu script que o player vai poder usar a magia novamente, sem precisar esperar o tempo necessário. (PS: No seu script, tá adicionando a storage 2 vezes com o mesmo valor por ter 2 setPlayerStorageValue iguais)
Pra resolver isso, basta adicionar o seguinte abaixo de if getPlayerMana(cid) >= config.mana then:
local cond_pz = createConditionObject(CONDITION_INFIGHT) setConditionParam(cond_pz, CONDITION_PARAM_TICKS, 10 * 1000) doAddCondition(cid, cond_pz)
Acho que resolve. Não garanto, pois não sei mexer direito com Conditions, então fiz uma gambiarra pra ver se funciona.
Editado Agosto 5 por LuckOake
info
Grupo: Conde
Registrado: 04/08/12
Posts: 762
Reputação: +80

@LuckOake
Testado, funcionou aqui.
Editado Agosto 5 por Newtonnotwen
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

Funcionou mesmo? Viva, aprendi a mexer com Conditions. haheuheauae
Agora vamos ver se com o dono do tópico também funciona.
info
Grupo: Campones
Registrado: 22/11/11
Posts: 52
Reputação: 0
Char no Tibia: so jogo ots 8.4

N testei ainda mais vo agora tive que sair niver da minha ermã! kk
local config =
{
seconds = 10,
storage = 47112120,
msg = "Voc\ê preci\ça aguardar alguns segundos para acumular o esp\írito.",
mana = 2400,
semMana = "Voc\ê n\ão t\êm mana suficiente."
}
local function useAgain(cid)
setPlayerStorageValue(cid, config.storage, 2)
return TRUE
end
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 52)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -5.5, -32, -2.9, -400)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 52)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -5.5, -32, -2.9, -400)
arr1 = {
{0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}
arr2 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
}
local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
setCombatArea(combat1, area1)
setCombatArea(combat2, area2)
local function spell(parameters)
doCombat(parameters.cid, parameters.combat2, parameters.var)
end
function onCastSpell(cid, var)
if getPlayerStorageValue(cid, config.storage) == 1 then
doPlayerSendCancel(cid, config.msg)
return TRUE
end
if getPlayerStorageValue(cid, config.storage) ~= 1 then
if getPlayerMana(cid) >= config.mana then
local cond_pz = createConditionObject(CONDITION_INFIGHT)
setConditionParam(cond_pz, CONDITION_PARAM_TICKS, 10 * 1000)
doAddCondition(cid, cond_pz)
doPlayerAddMana(cid, -config.mana)
setPlayerStorageValue(cid, config.storage, 1)
addEvent(useAgain, config.seconds*1000, cid)
local parameters = { cid = cid, var = var, combat2 = combat2 }
addEvent(spell, 500, parameters)
return doCombat(cid, combat1, var)
else
doPlayerSendCancel(cid, config.semMana)
end
end
return TRUE
end
deu erro
[06/08/2012 13:54:34] data/spells/scripts/vip/housenka.lua:onCastSpell
[06/08/2012 13:54:34] luaCreateConditionObject(). This function can only be used while loading the script.
[06/08/2012 13:54:34] Lua Script Error: [spell Interface]
[06/08/2012 13:54:34] data/spells/scripts/vip/housenka.lua:onCastSpell
[06/08/2012 13:54:35] luaSetConditionParam(). This function can only be used while loading the script.
[06/08/2012 13:54:35] Lua Script Error: [spell Interface]
[06/08/2012 13:54:35] data/spells/scripts/vip/housenka.lua:onCastSpell
[06/08/2012 13:54:35] luaDoAddCondition(). Condition not found
[06/08/2012 13:54:45] GOD Slayer has logged out.
[06/08/2012 13:54:46] Lua Script Error: [spell Interface]
[06/08/2012 13:54:46] in a timer event called from:
[06/08/2012 13:54:46] data/spells/scripts/vip/housenka.lua:onCastSpell
[06/08/2012 13:54:46] luaSetPlayerStorageValue(). Player not found
Editado Agosto 6 por angelanascimento
info
Grupo: Conde
Registrado: 04/08/12
Posts: 762
Reputação: +80

Por favor ponha o arquivo em spoiler.
Obs: Aqui funcionou, vou dar uma olhada no erro.
------------------------------------------------------------
Não sabe botar em spoiler?
É simples, siga o exemplo:
[spoiler.]ARQUIVO[/spoiler.]
-Vermelho: Retire os pontos.
-Roxo: Seu arquivo.
Editado Agosto 6 por Newtonnotwen



info
Grupo: Campones
Registrado: 22/11/11
Posts: 52
Reputação: 0
Char no Tibia: so jogo ots 8.4
Quando o player solta a magia ela funciona tudo,
mais quando ele desloga aparese isu no distro
[05/08/2012 11:32:52] Lua Script Error: [spell Interface]
[05/08/2012 11:32:52] in a timer event called from:
[05/08/2012 11:32:52] data/spells/scripts/vip/hyakka ryouran.lua:onCastSpell
[05/08/2012 11:32:52] luaSetPlayerStorageValue(). Player not found
[05/08/2012 11:32:54] Lua Script Error: [spell Interface]
[05/08/2012 11:32:54] in a timer event called from:
[05/08/2012 11:32:54] data/spells/scripts/vip/hyakka ryouran.lua:onCastSpell
[05/08/2012 11:32:55] luaSetPlayerStorageValue(). Player not found
[05/08/2012 11:32:58] Lua Script Error: [spell Interface]
[05/08/2012 11:32:58] in a timer event called from:
[05/08/2012 11:32:58] data/spells/scripts/vip/hyakka ryouran.lua:onCastSpell