Ir para conteúdo
  • 0

Checar se player está vivo na magia


danilo9317

Pergunta

7 respostass a esta questão

Posts Recomendados

  • 0

Tenta usar algo como if isCreature(cid) then ... end. (dependendo da estrutura da spell, como um addEvent, não daria mais erros no console de player not found.)

Editado por zipter98
Link para o comentário
Compartilhar em outros sites

  • 0

Como ficaria pra uma spell dessa?

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 5)

function onGetFormulaValues(cid, level)
min = -(level * 0.80) / 1.0
max = -(level * 1.50) / 1.0

        return min, max
end

setCombatCallback(combat1, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 5)

function onGetFormulaValues(cid, level)
min = -(level * 0.80) / 1.0
max = -(level * 1.50) / 1.0

        return min, max
end

setCombatCallback(combat2, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 5)

function onGetFormulaValues(cid, level)
min = -(level * 0.80) / 1.0
max = -(level * 1.50) / 1.0

        return min, max
end

setCombatCallback(combat3, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, 5)

function onGetFormulaValues(cid, level)
min = -(level * 0.80) / 1.0
max = -(level * 1.50) / 1.0

        return min, max
end

setCombatCallback(combat4, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local combat5 = createCombatObject()
setCombatParam(combat5, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat5, COMBAT_PARAM_CREATEITEM, 1494)

local combat6 = createCombatObject()
setCombatParam(combat6, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat6, COMBAT_PARAM_CREATEITEM, 1494)

local combat7 = createCombatObject()
setCombatParam(combat7, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat7, COMBAT_PARAM_CREATEITEM, 1494)

local combat8 = createCombatObject()
setCombatParam(combat8, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat8, COMBAT_PARAM_CREATEITEM, 1494)

arr1 = {
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 3, 0, 0},
}

arr2 = {
{0, 0, 0, 0, 0},
{0, 1, 1, 1, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}

arr3 = {
{1, 1, 1, 1, 1},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}

arr4 = {
{1, 1, 1, 1, 1},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}

arr5 = {
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 3, 0, 0},
}

arr6 = {
{0, 0, 0, 0, 0},
{0, 1, 1, 1, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}


arr7 = {
{1, 1, 1, 1, 1},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}

arr8 = {
{1, 1, 1, 1, 1},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}
local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
local area3 = createCombatArea(arr3)
local area4 = createCombatArea(arr4)
local area5 = createCombatArea(arr5)
local area6 = createCombatArea(arr6)
local area7 = createCombatArea(arr7)
local area8 = createCombatArea(arr8)
setCombatArea(combat1, area1)
setCombatArea(combat2, area2)
setCombatArea(combat3, area3)
setCombatArea(combat4, area4)
setCombatArea(combat5, area5)
setCombatArea(combat6, area6)
setCombatArea(combat7, area7)
setCombatArea(combat8, area8)

local function onCastSpell1(parameters)
if not isPlayer(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat1, parameters.var)
end
local function onCastSpell2(parameters)
if not isPlayer(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat2, parameters.var)
end
local function onCastSpell3(parameters)
if not isPlayer(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat3, parameters.var)
end
local function onCastSpell4(parameters)
if not isPlayer(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat4, parameters.var)
end
local function onCastSpell5(parameters)
if not isPlayer(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat5, parameters.var)
end
local function onCastSpell6(parameters)
if not isPlayer(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat6, parameters.var)
end
local function onCastSpell7(parameters)
if not isPlayer(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat7, parameters.var)
end
local function onCastSpell8(parameters)
if not isPlayer(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat8, parameters.var)
end

function onCastSpell(cid, var)
if isHandsFree(cid) then
return true
end  

local spellname = "disparar chamas"
         
if exhaustion.check(cid, 26000) == FALSE then 
      
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3, combat4 = combat4, combat5 = combat5, combat6 = combat6, combat7 = combat7, combat8 = combat8 }    
addEvent(onCastSpell1, 0, parameters)
addEvent(onCastSpell2, 200, parameters)
addEvent(onCastSpell3, 300, parameters)
addEvent(onCastSpell4, 500, parameters)
addEvent(onCastSpell1, 600, parameters)
addEvent(onCastSpell2, 800, parameters)
addEvent(onCastSpell3, 900, parameters)
addEvent(onCastSpell4, 1100, parameters)
addEvent(onCastSpell5, 30, parameters)
addEvent(onCastSpell6, 230, parameters)
addEvent(onCastSpell7, 330, parameters)
addEvent(onCastSpell8, 530, parameters)
exhaustion.set(cid, 26000, 0.9)
doSendAnimatedText(getCreaturePosition(cid), "Chamas", TEXTCOLOR_RED)
else
   doPlayerSendCancel(cid, "Preparando habilidade " .. spellname .. ", preciso de " ..exhaustion.get(cid, 26000).." segundo.")
end  
          
return FALSE
end

Link para o comentário
Compartilhar em outros sites

  • 0

Tenta assim:

 

 

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 5)
 
function onGetFormulaValues(cid, level)
min = -(level * 0.80) / 1.0
max = -(level * 1.50) / 1.0
 
        return min, max
end
 
setCombatCallback(combat1, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
 
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 5)
 
function onGetFormulaValues(cid, level)
min = -(level * 0.80) / 1.0
max = -(level * 1.50) / 1.0
 
        return min, max
end
 
setCombatCallback(combat2, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
 
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 5)
 
function onGetFormulaValues(cid, level)
min = -(level * 0.80) / 1.0
max = -(level * 1.50) / 1.0
 
        return min, max
end
 
setCombatCallback(combat3, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
 
local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, 5)
 
function onGetFormulaValues(cid, level)
min = -(level * 0.80) / 1.0
max = -(level * 1.50) / 1.0
 
        return min, max
end
 
setCombatCallback(combat4, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
 
local combat5 = createCombatObject()
setCombatParam(combat5, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat5, COMBAT_PARAM_CREATEITEM, 1494)
 
local combat6 = createCombatObject()
setCombatParam(combat6, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat6, COMBAT_PARAM_CREATEITEM, 1494)
 
local combat7 = createCombatObject()
setCombatParam(combat7, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat7, COMBAT_PARAM_CREATEITEM, 1494)
 
local combat8 = createCombatObject()
setCombatParam(combat8, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat8, COMBAT_PARAM_CREATEITEM, 1494)
 
arr1 = {
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 3, 0, 0},
}
 
arr2 = {
{0, 0, 0, 0, 0},
{0, 1, 1, 1, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}
 
arr3 = {
{1, 1, 1, 1, 1},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}
 
arr4 = {
{1, 1, 1, 1, 1},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}
 
arr5 = {
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 3, 0, 0},
}
 
arr6 = {
{0, 0, 0, 0, 0},
{0, 1, 1, 1, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}
 
 
arr7 = {
{1, 1, 1, 1, 1},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}
 
arr8 = {
{1, 1, 1, 1, 1},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 2, 0, 0},
}
local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
local area3 = createCombatArea(arr3)
local area4 = createCombatArea(arr4)
local area5 = createCombatArea(arr5)
local area6 = createCombatArea(arr6)
local area7 = createCombatArea(arr7)
local area8 = createCombatArea(arr8)
setCombatArea(combat1, area1)
setCombatArea(combat2, area2)
setCombatArea(combat3, area3)
setCombatArea(combat4, area4)
setCombatArea(combat5, area5)
setCombatArea(combat6, area6)
setCombatArea(combat7, area7)
setCombatArea(combat8, area8)
 
local function onCastSpell1(parameters)
if not isPlayer(parameters.cid) then return true end
if not isCreature(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat1, parameters.var)
end
local function onCastSpell2(parameters)
if not isPlayer(parameters.cid) then return true end
if not isCreature(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat2, parameters.var)
end
local function onCastSpell3(parameters)
if not isPlayer(parameters.cid) then return true end
if not isCreature(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat3, parameters.var)
end
local function onCastSpell4(parameters)
if not isPlayer(parameters.cid) then return true end
if not isCreature(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat4, parameters.var)
end
local function onCastSpell5(parameters)
if not isPlayer(parameters.cid) then return true end
if not isCreature(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat5, parameters.var)
end
local function onCastSpell6(parameters)
if not isPlayer(parameters.cid) then return true end
if not isCreature(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat6, parameters.var)
end
local function onCastSpell7(parameters)
if not isPlayer(parameters.cid) then return true end
if not isCreature(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat7, parameters.var)
end
local function onCastSpell8(parameters)
if not isPlayer(parameters.cid) then return true end
if not isCreature(parameters.cid) then return true end
doCombat(parameters.cid, parameters.combat8, parameters.var)
end
 
function onCastSpell(cid, var)
if isHandsFree(cid) then
return true
end  
 
local spellname = "disparar chamas"
         
if exhaustion.check(cid, 26000) == FALSE then 
      
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3, combat4 = combat4, combat5 = combat5, combat6 = combat6, combat7 = combat7, combat8 = combat8 }    
addEvent(onCastSpell1, 0, parameters)
addEvent(onCastSpell2, 200, parameters)
addEvent(onCastSpell3, 300, parameters)
addEvent(onCastSpell4, 500, parameters)
addEvent(onCastSpell1, 600, parameters)
addEvent(onCastSpell2, 800, parameters)
addEvent(onCastSpell3, 900, parameters)
addEvent(onCastSpell4, 1100, parameters)
addEvent(onCastSpell5, 30, parameters)
addEvent(onCastSpell6, 230, parameters)
addEvent(onCastSpell7, 330, parameters)
addEvent(onCastSpell8, 530, parameters)
exhaustion.set(cid, 26000, 0.9)
doSendAnimatedText(getCreaturePosition(cid), "Chamas", TEXTCOLOR_RED)
else
   doPlayerSendCancel(cid, "Preparando habilidade " .. spellname .. ", preciso de " ..exhaustion.get(cid, 26000).." segundo.")
end  
          
return FALSE
end

Editado por zipter98
Link para o comentário
Compartilhar em outros sites

  • 0

Continua mesma coisa... =/


também tem outra dúvida quando coloco imobilidade

 

local target = getCreatureTarget(cid)
if target ~= 0 and target ~= nill then
if isPlayer(target) == true then
elseif isMonster(target) == true then
doCreatureSetNoMove(target, true)
addEvent(doCreatureSetNoMove, 4500, target, false)
else
return false
end
end

e o player ou monstro morre antes do tempo da imobilidade acabar da o seguinte erro

 

[02/12/2013 16:09:49] [Error - Spell Interface]
[02/12/2013 16:09:49] In a timer event called from:
[02/12/2013 16:09:49] Description:
[02/12/2013 16:09:49] (luaDoCreatureSetNoMove) Creature not found

 

Link para o comentário
Compartilhar em outros sites

  • 0

 

local target = getCreatureTarget(cid)
if target ~= 0 and target ~= nill then
if isPlayer(target) == true then
elseif isMonster(target) == true then
doCreatureSetNoMove(target, true)
    addEvent(function()
        if not isCreature(cid) then return true end
        doCreatureSetNoMove(target, false)
    end, 4500)
else
return false
end
end
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...