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

custom spell tfs 1.3

jel

Member
Joined
Mar 22, 2014
Messages
302
Reaction score
12
solution?

Lua:
AREA1 = {
    {0, 0, 0},
    {0, 3, 0},
    {0, 0, 0}
}

local function sendHealingEffect(cid, position, loopCount)
    local player = Player(cid)
    if not player then
        return
    end

    position:sendDistanceEffect(player:getPosition(), CONST_ANI_SMALLHOLY)
    player:addHealth(math.max(100, 150))
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    if loopCount == 0 then
        player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
    end
end

function onCastSpell(creature, var)
    local playerPos = creature:getPosition()
    local loopCount = 12
    
    local combat = Combat()

    creature:say('Heal me my brothers!', TALKTYPE_MONSTER_SAY)
  
    for i = 1, loopCount do
        local position = Position(playerPos.x + math.random(-4, 3), playerPos.y + math.random(-3, 2), playerPos.z)
        addEvent(doAreaCombatHealth, i * 75, creature:getId(), COMBAT_PHYSICALDAMAGE, position, createCombatArea(AREA1), 0, 0, CONST_ME_ASSASSIN)
        addEvent(sendHealingEffect, i * 75, creature:getId(), position, loopCount - i)
    end
    return false
end
Lua Script Error: [Spell Interface] data/spells/scripts/spell1.lua:onCastSpell luaCreateCombatArea(). This function can only be used while loading the script. stack traceback: [C]: in function 'createCombatArea' data/spells/scripts/spell1.lua:31: in function <data/spells/scripts/spell1.lua:21>
 
Try this:
Lua:
AREA1 = {
    {0, 0, 0},
    {0, 3, 0},
    {0, 0, 0}
}

local cbarea = createCombatArea(AREA1)

local function sendHealingEffect(cid, position, loopCount)
    local player = Player(cid)
    if not player then
        return
    end

    position:sendDistanceEffect(player:getPosition(), CONST_ANI_SMALLHOLY)
    player:addHealth(math.max(100, 150))
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    if loopCount == 0 then
        player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
    end
end

function onCastSpell(creature, var)
    local playerPos = creature:getPosition()
    local loopCount = 12
    
    local combat = Combat()

    creature:say('Heal me my brothers!', TALKTYPE_MONSTER_SAY)
 
    for i = 1, loopCount do
        local position = Position(playerPos.x + math.random(-4, 3), playerPos.y + math.random(-3, 2), playerPos.z)
        addEvent(doAreaCombatHealth, i * 75, creature:getId(), COMBAT_PHYSICALDAMAGE, position, cbarea, 0, 0, CONST_ME_ASSASSIN)
        addEvent(sendHealingEffect, i * 75, creature:getId(), position, loopCount - i)
    end
    return false
end
 
Back
Top