Ir para conteúdo
  • 0

spell dando erro


nbb147

Pergunta

galera eu estava tentando fazer uma spell que o player muda a vocação do oponente mais esta dando um erro quando o player nao coloca target no oponente, abaixo o script:

 

local combat1 = createCombatObject()

setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 27)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -0.0, -0, -0.0, -0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 8)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -0.0, -0, -0.0, -0)

arr1 = {
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 2, 1, 0, 0},
{0, 0, 0, 1, 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, 3, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
}

local area1 = createCombatArea(arr1)
setCombatArea(combat1, area1)

local area2 = createCombatArea(arr2)
setCombatArea(combat2, area2)

function onCastSpell(cid, var)

local player = getCreatureTarget(cid)

if getPlayerVocation(player) == 4 or getPlayerVocation(player) == 5 or getPlayerVocation(player) == 6 then
doPlayerSetVocation(player, 1)
doSetCreatureOutfit(player, {lookType = 1}, -1)
end

if getPlayerVocation(player) == 7 or getPlayerVocation(player) == 8 or getPlayerVocation(player) == 9 or getPlayerVocation(player) == 10 or getPlayerVocation(player) == 11 then
doPlayerSetVocation(player, 2)
doSetCreatureOutfit(player, {lookType = 2}, -1)
end

if getPlayerVocation(player) == 12 then
doPlayerSetVocation(player, 3)
doSetCreatureOutfit(player, {lookType = 3}, -1)
end

doCombat(cid, combat1, var)
doCombat(cid, combat2, var)
return true
end

 

 

abaixo o erro quando nao esta em target:

 

[17/07/2013 19:21:22] [Error - Spell Interface]
[17/07/2013 19:21:22] data/spells/scripts/hashirama/Kakuan Nitten Suishu.lua:onCastSpell
[17/07/2013 19:21:22] Description:
[17/07/2013 19:21:22] (internalGetPlayerInfo) Player not found when requesting player info #6

 

 

Link para o comentário
Compartilhar em outros sites

13 respostass a esta questão

Posts Recomendados

  • 0

Boa tarde nbb147

 

Tente o Script assim (eu não testei se nao funcionar me avise)

 

local combat1 = createCombatObject()

setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 27)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -0.0, -0, -0.0, -0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 8)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -0.0, -0, -0.0, -0)

arr1 = {
{3}

arr2 = {
{3}

local area1 = createCombatArea(arr1)
setCombatArea(combat1, area1)

local area2 = createCombatArea(arr2)
setCombatArea(combat2, area2)

function onCastSpell(cid, var)

local player = getCreatureTarget(cid)

if getPlayerVocation(player) == 4 or getPlayerVocation(player) == 5 or getPlayerVocation(player) == 6 then
doPlayerSetVocation(player, 1)
doSetCreatureOutfit(player, {lookType = 1}, -1)
end

if getPlayerVocation(player) == 7 or getPlayerVocation(player) == 8 or getPlayerVocation(player) == 9 or getPlayerVocation(player) == 10 or getPlayerVocation(player) == 11 then
doPlayerSetVocation(player, 2)
doSetCreatureOutfit(player, {lookType = 2}, -1)
end

if getPlayerVocation(player) == 12 then
doPlayerSetVocation(player, 3)
doSetCreatureOutfit(player, {lookType = 3}, -1)
end

doCombat(cid, combat1, var)
doCombat(cid, combat2, var)
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

deu esse erro:

 

[20/07/2013 14:08:24] [Error - Spell Interface]
[20/07/2013 14:08:24] data/spells/scripts/hashirama/Kakuan Nitten Suishu.lua:onCastSpell
[20/07/2013 14:08:24] Description:
[20/07/2013 14:08:24] (internalGetPlayerInfo) Player not found when requesting player info #6
Link para o comentário
Compartilhar em outros sites

  • 0

tente assim.

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 27)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -0.0, -0, -0.0, -0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 8)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -0.0, -0, -0.0, -0)

arr1 = {
{3}

arr2 = {
{3}

local area1 = createCombatArea(arr1)
setCombatArea(combat1, area1)

local area2 = createCombatArea(arr2)
setCombatArea(combat2, area2)

function onCastSpell(cid, var)

local player = getCreatureTarget(cid)

if getPlayerVocation(player) == 4 or getPlayerVocation(player) == 5 or getPlayerVocation(player) == 6 then
doPlayerSetVocation(player, 1)
doSetCreatureOutfit(player, {lookType = 1}, -1)
end

if getPlayerVocation(player) == 7 or getPlayerVocation(player) == 8 or getPlayerVocation(player) == 9 or getPlayerVocation(player) == 10 or getPlayerVocation(player) == 11 then
doPlayerSetVocation(player, 2)
doSetCreatureOutfit(player, {lookType = 2}, -1)
end

if getPlayerVocation(player) == 12 then
doPlayerSetVocation(player, 3)
doSetCreatureOutfit(player, {lookType = 3}, -1)
end
 
function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
if (isPlayer(target)) or (isMonster(target)) then
doCombat(cid, combat1, var) 
doCombat(cid, combat2, var) 
end 
return TRUE 
end
Editado por Maenilse
Link para o comentário
Compartilhar em outros sites

  • 0

cara vc tirou um end deu esse erro:

 

[20/07/2013 15:02:23] [Error - LuaScriptInterface::loadFile] data/spells/scripts/hashirama/Kakuan Nitten Suishu.lua:46: 'end' expected (to close 'function' at line 24) near '<eof>'
[20/07/2013 15:02:23] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/hashirama/Kakuan Nitten Suishu.lua)
[20/07/2013 15:02:23] data/spells/scripts/hashirama/Kakuan Nitten Suishu.lua:46: 'end' expected (to close 'function' at line 24) near '<eof>'
ai eu coloquei o end entao deu o msm erro de antes..
Link para o comentário
Compartilhar em outros sites

  • 0

msm erro pelo q eu entendi nesse erro diz q nao esta reconhecendo o player, abaixo o erro:

 

[20/07/2013 15:13:20] [Error - Spell Interface]
[20/07/2013 15:13:20] data/spells/scripts/hashirama/Kakuan Nitten Suishu.lua:onCastSpell
[20/07/2013 15:13:20] Description:
[20/07/2013 15:13:20] (internalGetPlayerInfo) Player not found when requesting player info #6
Link para o comentário
Compartilhar em outros sites

  • 0

 

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 27)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -0.0, -0, -0.0, -0)
 
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 8)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -0.0, -0, -0.0, -0)
 
arr1 = {
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 2, 1, 0, 0},
{0, 0, 0, 1, 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, 3, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
}
 
local area1 = createCombatArea(arr1)
setCombatArea(combat1, area1)
 
local area2 = createCombatArea(arr2)
setCombatArea(combat2, area2)
 
function onCastSpell(cid, var)
 
local player = getCreatureTarget(cid)
 
if not isCreature(player) then
return not doPlayerSendCancel(cid, "You need a target to cast this spell!")
end
 
if getPlayerVocation(player) == 4 or getPlayerVocation(player) == 5 or getPlayerVocation(player) == 6 then
doPlayerSetVocation(player, 1)
doSetCreatureOutfit(player, {lookType = 1}, -1)
end
 
if getPlayerVocation(player) == 7 or getPlayerVocation(player) == 8 or getPlayerVocation(player) == 9 or getPlayerVocation(player) == 10 or getPlayerVocation(player) == 11 then
doPlayerSetVocation(player, 2)
doSetCreatureOutfit(player, {lookType = 2}, -1)
end
 
if getPlayerVocation(player) == 12 then
doPlayerSetVocation(player, 3)
doSetCreatureOutfit(player, {lookType = 3}, -1)
end
 
doCombat(cid, combat1, var)
doCombat(cid, combat2, var)
return true
end
Link para o comentário
Compartilhar em outros sites

  • 0

deu certo so acerta com o target mais ta dando esse erro:

 

[21/07/2013 13:06:34] [Error - Spell Interface]
[21/07/2013 13:06:34] data/spells/scripts/hashirama/Kakuan Nitten Suishu.lua:onCastSpell
[21/07/2013 13:06:34] Description:
[21/07/2013 13:06:34] (internalGetPlayerInfo) Player not found when requesting player info #6
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...