• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How do I add another visual effect to combat spell?

liqeen

Active Member
Joined
Nov 26, 2014
Messages
151
Solutions
1
Reaction score
30
Location
Poland
Hello I got a problem with script, I just don't know how to add another visual effect with damage same as it is in forumla below

Code:
   arr = {
    {0, 0, 1, 0, 0},
    {0, 1, 1, 1, 0},
    {1, 1, 3, 1, 1},
    {0, 1, 1, 1, 0},
    {0, 0, 1, 0, 0},
}

local area = createCombatArea(arr)
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BIGCLOUDS)
combat:setParameter(arr, COMBAT_PARAM_EFFECT, CONST_ME_BIGCLOUDS)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setArea(area)


function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 4.5) + 20
    local max = (level / 5) + (maglevel * 7.6) + 48
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    if creature:getStorageValue(warPrivate_UE) > 0 then
          return false
     else
          return combat:execute(creature, var)
     end
end
Thats my code, currently the spell is doing 3X3 with some modifications as u can see by the area in script.
I want to add another combat area, for example 4x4 with mortarea inside the bigclouds effect. How do I add it into this script?
If somebody does not understood me I attach a gif below (thats the thing I want to do)
 

Attachments

Solution
Lua:
   arr1 = {
    {0, 0, 1, 0, 0},
    {0, 1, 1, 1, 0},
    {1, 1, 3, 1, 1},
    {0, 1, 1, 1, 0},
    {0, 0, 1, 0, 0},
}

   arr2 = {
   {1, 0, 0, 0, 1, 0, 0, 0, 1},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{1, 1, 1, 1, 3, 1, 1, 1, 1},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{1, 0, 0, 0, 1, 0, 0, 0, 1},
}


local combat1 = Combat()
combat1:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat1:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BIGCLOUDS)
combat1:setParameter(arr, COMBAT_PARAM_EFFECT, CONST_ME_BIGCLOUDS)
combat1:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

local combat2 = Combat()...
Copy/paste lines 9-24, rename combat to combat2 (and everywhere it gets used afterwards), onGetFormulaValues to onGetFormulaValues2, replace the "onGetFormulaValues" with the same thing in setCallback, set different effects for combat2 and you're all set. Don't forget to also use combat2:execute(creature, variant).
 
Copy/paste lines 9-24, rename combat to combat2 (and everywhere it gets used afterwards), onGetFormulaValues to onGetFormulaValues2, replace the "onGetFormulaValues" with the same thing in setCallback, set different effects for combat2 and you're all set. Don't forget to also use combat2:execute(creature, variant).
I did this so far
Code:
   arr = {
{1, 0, 0, 0, 1, 0, 0, 0, 1},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{1, 1, 1, 1, 3, 1, 1, 1, 1},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{1, 0, 0, 0, 1, 0, 0, 0, 1},
}

local area = createCombatArea(arr)
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 67)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setArea(area)


function onGetFormulaValues(player, level, maglevel)
    local min = (level / 0.15) + (maglevel * 4.5) + 20
    local max = (level / 0.10) + (maglevel * 7.6) + 48
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")


local area2 = createCombatArea(arr)
local combat2 = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 66)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setArea(area2)


function onGetFormulaValues2(player, level, maglevel)
    local min = (level / 0.15) + (maglevel * 4.5) + 20
    local max = (level / 0.10) + (maglevel * 7.6) + 48
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")

function onCastSpell(creature, var)
    if creature:getStorageValue(warPrivate_UE) > 0 then
          return false
     else
          return combat:execute(creature, var)
     end
end

function onCastSpell(creature, var)
    if creature:getStorageValue(warPrivate_UE) > 0 then
          return false
     else
          return combat2:execute(creature, var)
     end
end
but when I cast the spell it does not deal any damage and there is no any visual effect. Also no errors in CMD
What I am doing wrong?
 
Lua:
   arr1 = {
    {0, 0, 1, 0, 0},
    {0, 1, 1, 1, 0},
    {1, 1, 3, 1, 1},
    {0, 1, 1, 1, 0},
    {0, 0, 1, 0, 0},
}

   arr2 = {
   {1, 0, 0, 0, 1, 0, 0, 0, 1},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{1, 1, 1, 1, 3, 1, 1, 1, 1},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{1, 0, 0, 0, 1, 0, 0, 0, 1},
}


local combat1 = Combat()
combat1:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat1:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BIGCLOUDS)
combat1:setParameter(arr, COMBAT_PARAM_EFFECT, CONST_ME_BIGCLOUDS)
combat1:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat2:setParameter(arr2, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat2:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)

combat1:setArea(createCombatArea(arr1))
combat2:setArea(createCombatArea(arr2))

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 4.5) + 20
    local max = (level / 5) + (maglevel * 7.6) + 48
    return -min, -max
end

combat1:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onGetFormulaValues2(player, level, maglevel)
    local min = (level / 5) + (maglevel * 4.5) + 20
    local max = (level / 5) + (maglevel * 7.6) + 48
    return -min, -max
end

combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")

function onCastSpell(creature, var)
    if creature:getStorageValue(warPrivate_UE) > 0 then
          return false
     else
     combat1:execute(creature, var)
     combat2:execute(creature, var)
          return true
     end
end
Read this too
 
Last edited:
Solution
Lua:
   arr1 = {
    {0, 0, 1, 0, 0},
    {0, 1, 1, 1, 0},
    {1, 1, 3, 1, 1},
    {0, 1, 1, 1, 0},
    {0, 0, 1, 0, 0},
}

   arr2 = {
   {1, 0, 0, 0, 1, 0, 0, 0, 1},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{1, 1, 1, 1, 3, 1, 1, 1, 1},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 0, 0, 1, 0, 0, 1, 0},
{1, 0, 0, 0, 1, 0, 0, 0, 1},
}


local combat1 = Combat()
combat1:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat1:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BIGCLOUDS)
combat1:setParameter(arr, COMBAT_PARAM_EFFECT, CONST_ME_BIGCLOUDS)
combat1:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat2:setParameter(arr2, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat2:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)

combat1:setArea(createCombatArea(arr1))
combat2:setArea(createCombatArea(arr2))

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 4.5) + 20
    local max = (level / 5) + (maglevel * 7.6) + 48
    return -min, -max
end

combat1:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onGetFormulaValues2(player, level, maglevel)
    local min = (level / 5) + (maglevel * 4.5) + 20
    local max = (level / 5) + (maglevel * 7.6) + 48
    return -min, -max
end

combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")

function onCastSpell(creature, var)
    if creature:getStorageValue(warPrivate_UE) > 0 then
          return false
     else
     combat1:execute(creature, var)
     combat2:execute(creature, var)
          return true
     end
end
Read this too
But I have one problem about this, I can spam the spell no matter what cooldown I will set in spells.xml it is like 0, how do I fix it?
 
Back
Top