eduardo190696 47 Postado Setembro 14, 2012 Share Postado Setembro 14, 2012 Gostaria de saber o porque quando eu uso um script de spell por action pro meu pet system, ele sai normal o effeito, só que não tira dano do inimigo. Script ----------------- Ataque 1 ------------------------------ local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true) setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -15, 5, 5, 1.8, 3, -20, -40) ----------------- Ataque 2 ------------------------------ local combat1 = createCombatObject() setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat1, COMBAT_PARAM_EFFECT, 111) setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -6.3, 0, -5.5, 0) ----------------- Ataque 3 ------------------------------ local combat2 = createCombatObject() setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat2, COMBAT_PARAM_EFFECT, 42) setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -6.3, 0, -5.5, 0) arr1 = { {0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 2, 0, 0, 0, 0}, {0, 0, 0, 2, 2, 2, 0, 0, 0}, {0, 0, 2, 2, 2, 2, 2, 0, 0}, {0, 2, 2, 2, 3, 2, 2, 2, 0, {0, 0, 2, 2, 2, 2, 2, 0, 0}, {0, 0, 0, 2, 2, 2, 0, 0, 0}, {0, 0, 0, 0, 2, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, } local area1 = createCombatArea(arr1) setCombatArea(combat2, area1) ----------------- Fim ------------------------------ local c = { ["Dragon"] = {x = {atk = combat1, spell = "Meele", minLv = 1, distance = 3}}, ["Demon"] = {x = {atk = combat2, spell = "Ice", minLv = 5, distance = 3}} } function onUse(cid, item, frompos, item2, topos, var) local summ = getCreatureSummons(cid) if #summ == 0 then return doPlayerSendCancel(cid, "Sorry, but you need a dragon.") end for i = 1, #summ do for name, _ in pairs© do if getCreatureName(summ):lower() == name:lower() then local con = c[name].x local distance = (not con.distance) and 1 or con.distance if getPlayerLevel(cid) < con.minLv then return doPlayerSendCancel(cid, "Sorry, but you must be level " .. con.minLv .. " or higher to cast.") and doSendMagicEffect(getThingPos(cid), 2) end if not isCreature(getCreatureTarget(cid)) or getCreatureTarget(cid) == summ then return doPlayerSendCancel(cid, "Invalid target.") and doSendMagicEffect(getThingPos(cid), 2) end if getDistanceBetween(getThingPos(summ), getThingPos(getCreatureTarget(cid))) > distance then return doPlayerSendCancel(cid, "Sorry, your pokemon is too far away.") and doSendMagicEffect(getThingPos(cid), 2) end if getPlayerStorageValue(cid, 20000) <= os.time() then doPlayerSetStorageValue(cid, 20000, os.time()+5) doCombat(summ, con.atk, numberToVariant(getCreatureTarget(cid))) doCreatureSay(cid, name .. ", " .. con.spell .. ".") end doPlayerSendTextMessage(cid,26,"Tempo para usar este ataque denovo: "..(getPlayerStorageValue(cid, 23000)-os.time()).." sec.") doSendMagicEffect(getThingPos(cid), 2) end end end return TRUE end se alguém puder me ajudar dou +Rep Link para o comentário https://xtibia.com/forum/topic/194125-spell-por-action/ Compartilhar em outros sites More sharing options...
0 brun123 369 Postado Setembro 14, 2012 Share Postado Setembro 14, 2012 Deve ser por causa das formulas... como o summon não tem level nem magic level o resultado deve ser 0. Tente usar COMBAT_FORMULA_UNDEFINED, se não der certo, você vai ter que usar o callback onGetFormulaMinMaxValues Link para o comentário https://xtibia.com/forum/topic/194125-spell-por-action/#findComment-1338736 Compartilhar em outros sites More sharing options...
0 eduardo190696 47 Postado Setembro 14, 2012 Autor Share Postado Setembro 14, 2012 bom, consegui entre aspas, novo code ------------------------------ Ataque 1 ------------------------------ local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true) setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE) setCombatFormula(combat, COMBAT_FORMULA_UNDEFINED, -2000, 2000, -3000, 3000) ------------------------------ Ataque 2 ------------------------------ local combat1 = createCombatObject() setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat1, COMBAT_PARAM_EFFECT, 111) setCombatFormula(combat1, COMBAT_FORMULA_UNDEFINED, -2000, 2000, -3000, 3000 ------------------------------ Fim ------------------------------ local c = { ["Dragon"] = {x = {atk = combat1, spell = "Meele", minLv = 1, distance = 3}}, ["Demon"] = {x = {atk = combat1, spell = "Ice", minLv = 5, distance = 3}} } function onUse(cid, item, frompos, item2, topos, var) local summ = getCreatureSummons(cid) if #summ == 0 then return doPlayerSendCancel(cid, "Sorry, but you need a dragon.") end for i = 1, #summ do for name, _ in pairs© do if getCreatureName(summ):lower() == name:lower() then local con = c[name].x local distance = (not con.distance) and 1 or con.distance if getPlayerLevel(cid) < con.minLv then return doPlayerSendCancel(cid, "Sorry, but you must be level " .. con.minLv .. " or higher to cast.") and doSendMagicEffect(getThingPos(cid), 2) end if not isCreature(getCreatureTarget(cid)) or getCreatureTarget(cid) == summ then return doPlayerSendCancel(cid, "Invalid target.") and doSendMagicEffect(getThingPos(cid), 2) end if getDistanceBetween(getThingPos(summ), getThingPos(getCreatureTarget(cid))) > distance then return doPlayerSendCancel(cid, "Sorry, your dragon is too far away.") and doSendMagicEffect(getThingPos(cid), 2) end if getPlayerStorageValue(cid, 20000) then doPlayerSetStorageValue(cid, 20000) doCombat(summ, con.atk, numberToVariant(getCreatureTarget(cid))) doCreatureSay(cid, name .. ", " .. con.spell .. ".") end doSendMagicEffect(getThingPos(cid), 2) end end end return TRUE end Agora tipo, se o monstro der 1 rit normal a spell funciona se ele não dar um rit, sai a mensagem, sai o efeito mais não tira dano, e tem horas que buga alguma coisa que o monstro (Que eu estou atacando) começa a healar sem parar ( Sim, o hp começa a subir muito rápido). Eu testei com God, e tirei o exausted para ir mais rápido e deu esses bugs. D; essa 2° opção eu fui pesquisar só que não consegui achar nada relacionado a como usar essa função "onGetFormulaMinMaxValues". Link para o comentário https://xtibia.com/forum/topic/194125-spell-por-action/#findComment-1339179 Compartilhar em outros sites More sharing options...
0 brun123 369 Postado Setembro 15, 2012 Share Postado Setembro 15, 2012 experimenta colocar todos os nºs da formula positivo, e se não der certo, tente todos eles negativos. se não der certo ainda, experimenta usar COMBAT_FORMULA_DAMAGE no lugar de COMBAT_FORMULA_UNDEFINED, com valores negativos/positivos também. o callback é assim: setCombatCallBack(combat1, CALLBACK_PARAM_LEVELMAGICVALUE, "getMinMaxDamage") function getMinMaxDamage(cid, level, magLevel) local min, max = 100, 200 -- talvez esses valores precisem ser negativos return min, max end Link para o comentário https://xtibia.com/forum/topic/194125-spell-por-action/#findComment-1339252 Compartilhar em outros sites More sharing options...
0 eduardo190696 47 Postado Setembro 15, 2012 Autor Share Postado Setembro 15, 2012 (editado) bom, das nova formula funcionou tanto com positivo quanto com negativo, o problema é que ele rita só as vezes, e do nada fica healando o monstro que eu estou atacando. ------------------------------ Ataque 1 ------------------------------ local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, 111) setCombatFormula(combat, COMBAT_FORMULA_DAMAGE, -2000, -2000, -3000, -3000) ------------------------------ Ataque 2 ------------------------------ local combat1 = createCombatObject() setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat1, COMBAT_PARAM_EFFECT, 111) setCombatFormula(combat1, COMBAT_FORMULA_DAMAGE, 2000, 2000, 3000, 3000) o callback n testei ainda mais vou testar jaja @Edit Testei aqui o callback e não funcionou muito bem da os mesmos erros de antes, tem horas que não tira nada, e horas que quando vc usa começa a healar o inimigo local combat1 = createCombatObject() setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) function getMinMaxDamage(cid, level, magLevel) min, max = -100, -200 return min, max end setCombatCallback(combat1, CALLBACK_PARAM_LEVELMAGICVALUE, "getMinMaxDamage") bom, sabe se daria certo se eu criar um action que fala uma palavra e ai ativa um talkactions ?, porque em poketibia esses script de spell funciona por talkactions. Editado Setembro 15, 2012 por eduardobean Link para o comentário https://xtibia.com/forum/topic/194125-spell-por-action/#findComment-1339518 Compartilhar em outros sites More sharing options...
0 brun123 369 Postado Setembro 15, 2012 Share Postado Setembro 15, 2012 doCreatureExecuteTalkAction(cid, words) Link para o comentário https://xtibia.com/forum/topic/194125-spell-por-action/#findComment-1339533 Compartilhar em outros sites More sharing options...
0 eduardo190696 47 Postado Setembro 15, 2012 Autor Share Postado Setembro 15, 2012 valeu @brun123, desculpe ocupar esse seu tempo todo, e ta ai seu +Rep Link para o comentário https://xtibia.com/forum/topic/194125-spell-por-action/#findComment-1339564 Compartilhar em outros sites More sharing options...
Pergunta
eduardo190696 47
Gostaria de saber o porque quando eu uso um script de spell por action pro meu pet system, ele sai normal o effeito, só que não tira dano do inimigo.
Script
----------------- Ataque 1 ------------------------------
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -15, 5, 5, 1.8, 3, -20, -40)
----------------- Ataque 2 ------------------------------
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 111)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -6.3, 0, -5.5, 0)
----------------- Ataque 3 ------------------------------
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 42)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -6.3, 0, -5.5, 0)
arr1 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 2, 0, 0, 0, 0},
{0, 0, 0, 2, 2, 2, 0, 0, 0},
{0, 0, 2, 2, 2, 2, 2, 0, 0},
{0, 2, 2, 2, 3, 2, 2, 2, 0,
{0, 0, 2, 2, 2, 2, 2, 0, 0},
{0, 0, 0, 2, 2, 2, 0, 0, 0},
{0, 0, 0, 0, 2, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0},
}
local area1 = createCombatArea(arr1)
setCombatArea(combat2, area1)
----------------- Fim ------------------------------
local c = {
["Dragon"] = {x = {atk = combat1, spell = "Meele", minLv = 1, distance = 3}},
["Demon"] = {x = {atk = combat2, spell = "Ice", minLv = 5, distance = 3}}
}
function onUse(cid, item, frompos, item2, topos, var)
local summ = getCreatureSummons(cid)
if #summ == 0 then
return doPlayerSendCancel(cid, "Sorry, but you need a dragon.")
end
for i = 1, #summ do
for name, _ in pairs© do
if getCreatureName(summ):lower() == name:lower() then
local con = c[name].x
local distance = (not con.distance) and 1 or con.distance
if getPlayerLevel(cid) < con.minLv then
return doPlayerSendCancel(cid, "Sorry, but you must be level " .. con.minLv .. " or higher to cast.") and doSendMagicEffect(getThingPos(cid), 2)
end
if not isCreature(getCreatureTarget(cid)) or getCreatureTarget(cid) == summ then
return doPlayerSendCancel(cid, "Invalid target.") and doSendMagicEffect(getThingPos(cid), 2)
end
if getDistanceBetween(getThingPos(summ), getThingPos(getCreatureTarget(cid))) > distance then
return doPlayerSendCancel(cid, "Sorry, your pokemon is too far away.") and doSendMagicEffect(getThingPos(cid), 2)
end
if getPlayerStorageValue(cid, 20000) <= os.time() then
doPlayerSetStorageValue(cid, 20000, os.time()+5)
doCombat(summ, con.atk, numberToVariant(getCreatureTarget(cid)))
doCreatureSay(cid, name .. ", " .. con.spell .. ".")
end
doPlayerSendTextMessage(cid,26,"Tempo para usar este ataque denovo: "..(getPlayerStorageValue(cid, 23000)-os.time()).." sec.")
doSendMagicEffect(getThingPos(cid), 2)
end
end
end
return TRUE
end
se alguém puder me ajudar dou +Rep
Link para o comentário
https://xtibia.com/forum/topic/194125-spell-por-action/Compartilhar em outros sites
6 respostass a esta questão
Posts Recomendados