Postado Outubro 22, 2023 1 ano Estou tentando editar uma spell faz um tempo já e cheguei no meu limite. Quero que o player lance um projetil de fogo para o norte, e depois de X segundos, caiam X bolas de pedra ao redor do alvo dando dano em área 3x3 de explosão. No código atual o efeito de ir para o norte com fogo funciona, mas depois caem 3 efeitos de fogo (Const_ani_fire) e fire damage normal. Já mudei de tudo e nada faz com que saia o efeito de fogo no final. Além da spell estar dando um dano absurdo. E outra coisa que não está funcionando é a funcao final do codigo, eu cheguei a deletar ela por completo e o codigo continua funcionando. E sempre com o efeito de fogo. local area = createCombatArea(AREA_SQUARE1X1) local initialArrowEffect = CONST_ANI_FIRE local meteorAttackEffect = CONST_ANI_LARGEROCK local numberOfAttacks = 3 local attackInterval = 1000 -- Intervalo de 1000 milissegundos (1 segundo) entre os ataques function onCastSpell(cid, var) local target = getCreatureTarget(cid) local playerPos = getCreaturePosition(cid) -- Envia a flecha inicial do jogador para o alvo doSendDistanceShoot(playerPos, {x = playerPos.x - math.random(4, 6), y = playerPos.y - 5, z = playerPos.z}, initialArrowEffect) -- Limita a `numberOfAttacks` meteoros caindo aleatoriamente for x = 1, numberOfAttacks do addEvent(furyAttackTarget, x * attackInterval, cid, target, {x = getCreaturePosition(target).x + math.random(-1, 1), y = getCreaturePosition(target).y + math.random(-1, 1), z = getCreaturePosition(target).z}) end end function furyAttackTarget(cid, target, pos) if isCreature(cid) and isCreature(target) then local areaPos = {x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z} doSendDistanceShoot({x = getCreaturePosition(target).x - math.random(4, 6), y = getCreaturePosition(target).y - 5, z = getCreaturePosition(target).z}, areaPos, meteorAttackEffect) doAreaCombatHealth(cid, COMBAT_FIREDAMAGE, areaPos, area, (-(getPlayerLevel(cid) * getPlayerMagLevel(cid)) / 5) + 50, (-(getPlayerLevel(cid) * getPlayerMagLevel(cid)) / 5) - 50, CONST_ME_EXPLOSIONHIT) end end
Postado Outubro 22, 2023 1 ano Solução Honestamente, nao sou especialista em lua ou em fazer spells, mas fiz algo rapido para voce aqui: local combatOne = createCombatObject() setCombatParam(combatOne, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combatOne, COMBAT_PARAM_HITCOLOR, COLOR_MAYABLUE) setCombatFormula(combatOne, COMBAT_FORMULA_LEVELMAGIC, -1.0, -500, -1.0, -650) setCombatArea(combatOne,createCombatArea( {{1, 1, 1}, {1, 3, 1}, -- Area 3X3 {1, 1, 1}} )) local function meteor_1(cid, target) if isCreature(target) then local pos = getCreaturePosition(target) local post = getThingPosition(getCreatureTarget(cid)) local fromposition = {x = pos.x - math.random(2, 5), y = pos.y - 4, z = pos.z} local toposition = {x = post.x - math.random(1, 2), y = post.y, z = post.z} doSendDistanceShoot(fromposition, toposition, CONST_ANI_FIRE) doSendMagicEffect(pos, CONST_ME_FIREAREA) end end local function meteor_2(cid, target) if isCreature(target) then local pos = getCreaturePosition(target) local post = getThingPosition(getCreatureTarget(cid)) local fromposition = {x = pos.x + math.random(2, 5), y = pos.y - 4, z = pos.z} local toposition = {x = post.x + math.random(1, 2), y = post.y, z = post.z} doSendDistanceShoot(fromposition, toposition, CONST_ANI_FIRE) doSendMagicEffect(pos, CONST_ME_FIREAREA) end end local function meteor_3(cid, target) if isCreature(target) then local pos = getCreaturePosition(target) local post = getThingPosition(getCreatureTarget(cid)) local fromposition = {x = pos.x, y = pos.y - 4, z = pos.z} local toposition = {x = post.x, y = post.y, z = post.z} doSendDistanceShoot(fromposition, toposition, CONST_ANI_FIRE) doSendMagicEffect(pos, CONST_ME_FIREAREA) end end local config = { hit = 1, time = 1200, -- meteor_1 time_2 = 1300, -- meteor_2 time_3 = 1500, -- meteor_3 numberOfAttacks = 3, attackInterval = 200 } function onCastSpell(cid, var) addEvent(function() doCombat(cid, combatOne, var) end, 1200) local pos = getCreaturePosition(cid) for i = 1, config.numberOfAttacks do addEvent(function() doSendDistanceShoot(pos, {x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, CONST_ANI_FIRE) end, config.attackInterval * i) end for fbn = 1, config.hit do addEvent(meteor_1, config.time * fbn, cid, getCreatureTarget(cid)) addEvent(meteor_2, config.time_2 * fbn, cid, getCreatureTarget(cid)) addEvent(meteor_3, config.time_3 * fbn, cid, getCreatureTarget(cid)) end return true end
Postado Outubro 22, 2023 1 ano Autor Em 22/10/2023 em 19:31, Fabi Marzan disse: Honestamente, nao sou especialista em lua ou em fazer spells, mas fiz algo rapido para voce aqui: local combatOne = createCombatObject() setCombatParam(combatOne, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combatOne, COMBAT_PARAM_HITCOLOR, COLOR_MAYABLUE) setCombatFormula(combatOne, COMBAT_FORMULA_LEVELMAGIC, -1.0, -500, -1.0, -650) setCombatArea(combatOne,createCombatArea( {{1, 1, 1}, {1, 3, 1}, -- Area 3X3 {1, 1, 1}} )) local function meteor_1(cid, target) if isCreature(target) then local pos = getCreaturePosition(target) local post = getThingPosition(getCreatureTarget(cid)) local fromposition = {x = pos.x - math.random(2, 5), y = pos.y - 4, z = pos.z} local toposition = {x = post.x - math.random(1, 2), y = post.y, z = post.z} doSendDistanceShoot(fromposition, toposition, CONST_ANI_FIRE) doSendMagicEffect(pos, CONST_ME_FIREAREA) end end local function meteor_2(cid, target) if isCreature(target) then local pos = getCreaturePosition(target) local post = getThingPosition(getCreatureTarget(cid)) local fromposition = {x = pos.x + math.random(2, 5), y = pos.y - 4, z = pos.z} local toposition = {x = post.x + math.random(1, 2), y = post.y, z = post.z} doSendDistanceShoot(fromposition, toposition, CONST_ANI_FIRE) doSendMagicEffect(pos, CONST_ME_FIREAREA) end end local function meteor_3(cid, target) if isCreature(target) then local pos = getCreaturePosition(target) local post = getThingPosition(getCreatureTarget(cid)) local fromposition = {x = pos.x, y = pos.y - 4, z = pos.z} local toposition = {x = post.x, y = post.y, z = post.z} doSendDistanceShoot(fromposition, toposition, CONST_ANI_FIRE) doSendMagicEffect(pos, CONST_ME_FIREAREA) end end local config = { hit = 1, time = 1200, -- meteor_1 time_2 = 1300, -- meteor_2 time_3 = 1500, -- meteor_3 numberOfAttacks = 3, attackInterval = 200 } function onCastSpell(cid, var) addEvent(function() doCombat(cid, combatOne, var) end, 1200) local pos = getCreaturePosition(cid) for i = 1, config.numberOfAttacks do addEvent(function() doSendDistanceShoot(pos, {x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, CONST_ANI_FIRE) end, config.attackInterval * i) end for fbn = 1, config.hit do addEvent(meteor_1, config.time * fbn, cid, getCreatureTarget(cid)) addEvent(meteor_2, config.time_2 * fbn, cid, getCreatureTarget(cid)) addEvent(meteor_3, config.time_3 * fbn, cid, getCreatureTarget(cid)) end return true end Cara ficou muito legal! Parabéns! Visualmente ficou muito show. A unica coisa é que ela está dando dano em área mas não esta aparecendo o efeito de explosão.
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.