• 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!

Delay between Combat1 and combat2 help

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,917
Solutions
82
Reaction score
2,023
Location
Germany
Heyo could someone add a delay between combatBlast and combatHalo?
Combatblast should cast directly
and combatHalo after 200ms
using tfs 1.3
Thanks
Lua:
local blastStar = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0},
{0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0},
{1, 0, 0, 1, 1, 2, 1, 1, 0, 0, 1},
{0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0},
{0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
}

local blastHalo = {
{0, 0, 0, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 1, 0, 0, 0},
{0, 0, 1, 1, 0, 1, 1, 0, 0},
{1, 1, 0, 0, 2, 0, 0, 1, 1},
{0, 0, 1, 1, 0, 1, 1, 0, 0},
{0, 0, 0, 1, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 0, 0, 0},
}

local blastFocus = {
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 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, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 magicBlastStar  = createCombatArea(blastStar)
local magicBlastHalo  = createCombatArea(blastHalo)
local magicBlastFocus = createCombatArea(blastFocus)

local combatBlast = Combat()
local combatHalo  = Combat()
local combatFocus = Combat()

combatBlast:setArea(magicBlastStar)
combatHalo :setArea(magicBlastHalo)
combatFocus:setArea(magicBlastFocus)

combatBlast:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combatHalo :setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combatFocus:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

combatBlast:setParameter(COMBAT_PARAM_EFFECT, 221)
combatHalo :setParameter(COMBAT_PARAM_EFFECT, 222)
--combatFocus:setParameter(COMBAT_PARAM_EFFECT, 36)

combatBlast:setFormula(COMBAT_FORMULA_LEVELMAGIC, -1, -44000, -1, -45000) -- min magic, min lvl, max magic, max level
combatHalo :setFormula(COMBAT_FORMULA_LEVELMAGIC, -1, -44000, -1, -45000)
--combatFocus:setFormula(COMBAT_FORMULA_LEVELMAGIC, -13, -185, -14, -190)


function onTargetTile(creature, position)
    creature:getPosition():sendDistanceEffect(position, 30)
end

function onTargetTile1(creature, position)
    creature:getPosition():sendDistanceEffect(position, 30)
end

combatBlast:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")
combatHalo :setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile1")

function onCastSpell(caster, target)
    return combatBlast:execute(caster, target),
           combatHalo :execute(caster, target),
           combatFocus:execute(caster, target)
end
 
Solution
nice to know
thanks
Post automatically merged:

addEvent(combatHalo, 3000) <-- Would it work like that simply?
Im kinda confused and I dont have any experience sorryyyyy🙄

Lua:
local function secondCombat(cid, target)
    local caster = Player(cid)
    if not caster then return end
    return combatHalo:execute(caster, target)
end

function onCastSpell(caster, target)
    combatBlast:execute(caster, target)
    addEvent(secondCombat, 500, caster:getId(), target)
    return true
end

Lua:
local blastStar = {
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0},
    {0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0},
    {1, 0, 0, 1, 1, 2, 1, 1, 0, 0, 1}...
Is it safe to use addevent?
Someone told me its not safe at all
use safeaddevent 😁

btw 200ms addEvent shouldn't be a problem, it is too fast
 
nice to know
thanks
Post automatically merged:

addEvent(combatHalo, 3000) <-- Would it work like that simply?
Im kinda confused and I dont have any experience sorryyyyy🙄
 
Last edited:
nice to know
thanks
Post automatically merged:

addEvent(combatHalo, 3000) <-- Would it work like that simply?
Im kinda confused and I dont have any experience sorryyyyy🙄

Lua:
local function secondCombat(cid, target)
    local caster = Player(cid)
    if not caster then return end
    return combatHalo:execute(caster, target)
end

function onCastSpell(caster, target)
    combatBlast:execute(caster, target)
    addEvent(secondCombat, 500, caster:getId(), target)
    return true
end

Lua:
local blastStar = {
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0},
    {0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0},
    {1, 0, 0, 1, 1, 2, 1, 1, 0, 0, 1},
    {0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0},
    {0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}
}
    
local blastHalo = {
    {0, 0, 0, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 0, 1, 0, 0, 0},
    {0, 0, 1, 1, 0, 1, 1, 0, 0},
    {1, 1, 0, 0, 2, 0, 0, 1, 1},
    {0, 0, 1, 1, 0, 1, 1, 0, 0},
    {0, 0, 0, 1, 0, 1, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 0, 0, 0}
}
    
local blastFocus = {
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 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, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 magicBlastStar  = createCombatArea(blastStar)
local magicBlastHalo  = createCombatArea(blastHalo)
local magicBlastFocus = createCombatArea(blastFocus)

local combatBlast = Combat()
local combatHalo  = Combat()
local combatFocus = Combat()

combatBlast:setArea(magicBlastStar)
combatHalo :setArea(magicBlastHalo)
combatFocus:setArea(magicBlastFocus)

combatBlast:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combatHalo :setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combatFocus:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

combatBlast:setParameter(COMBAT_PARAM_EFFECT, 221)
combatHalo :setParameter(COMBAT_PARAM_EFFECT, 222)
--combatFocus:setParameter(COMBAT_PARAM_EFFECT, 36)

combatBlast:setFormula(COMBAT_FORMULA_LEVELMAGIC, -1, -44000, -1, -45000) -- min magic, min lvl, max magic, max level
combatHalo :setFormula(COMBAT_FORMULA_LEVELMAGIC, -1, -44000, -1, -45000)
--combatFocus:setFormula(COMBAT_FORMULA_LEVELMAGIC, -13, -185, -14, -190)


function onTargetTile(creature, position)
    creature:getPosition():sendDistanceEffect(position, 30)
end

function onTargetTile1(creature, position)
    creature:getPosition():sendDistanceEffect(position, 30)
end

combatBlast:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")
combatHalo:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile1")

local function secondCombat(cid, target)
    local caster = Player(cid)
    if not caster then return end
    return combatHalo:execute(caster, target)
end

function onCastSpell(caster, target)
    combatBlast:execute(caster, target)
    addEvent(secondCombat, 500, caster:getId(), target)
    return true
end
 
Solution
Lua:
local function secondCombat(cid, target)
    local caster = Player(cid)
    if not caster then return end
    return combatHalo:execute(caster, target)
end

function onCastSpell(caster, target)
    combatBlast:execute(caster, target)
    addEvent(secondCombat, 500, caster:getId(), target)
    return true
end

Lua:
local blastStar = {
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0},
    {0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0},
    {1, 0, 0, 1, 1, 2, 1, 1, 0, 0, 1},
    {0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0},
    {0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}
}
   
local blastHalo = {
    {0, 0, 0, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 0, 1, 0, 0, 0},
    {0, 0, 1, 1, 0, 1, 1, 0, 0},
    {1, 1, 0, 0, 2, 0, 0, 1, 1},
    {0, 0, 1, 1, 0, 1, 1, 0, 0},
    {0, 0, 0, 1, 0, 1, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 0, 0, 0, 0}
}
   
local blastFocus = {
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 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, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 magicBlastStar  = createCombatArea(blastStar)
local magicBlastHalo  = createCombatArea(blastHalo)
local magicBlastFocus = createCombatArea(blastFocus)

local combatBlast = Combat()
local combatHalo  = Combat()
local combatFocus = Combat()

combatBlast:setArea(magicBlastStar)
combatHalo :setArea(magicBlastHalo)
combatFocus:setArea(magicBlastFocus)

combatBlast:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combatHalo :setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combatFocus:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

combatBlast:setParameter(COMBAT_PARAM_EFFECT, 221)
combatHalo :setParameter(COMBAT_PARAM_EFFECT, 222)
--combatFocus:setParameter(COMBAT_PARAM_EFFECT, 36)

combatBlast:setFormula(COMBAT_FORMULA_LEVELMAGIC, -1, -44000, -1, -45000) -- min magic, min lvl, max magic, max level
combatHalo :setFormula(COMBAT_FORMULA_LEVELMAGIC, -1, -44000, -1, -45000)
--combatFocus:setFormula(COMBAT_FORMULA_LEVELMAGIC, -13, -185, -14, -190)


function onTargetTile(creature, position)
    creature:getPosition():sendDistanceEffect(position, 30)
end

function onTargetTile1(creature, position)
    creature:getPosition():sendDistanceEffect(position, 30)
end

combatBlast:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")
combatHalo:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile1")

local function secondCombat(cid, target)
    local caster = Player(cid)
    if not caster then return end
    return combatHalo:execute(caster, target)
end

function onCastSpell(caster, target)
    combatBlast:execute(caster, target)
    addEvent(secondCombat, 500, caster:getId(), target)
    return true
end

Nice thanks
 
Back
Top