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

Solved Script question TFS 1.2

Aeronx

Intermediate OT User
Joined
Dec 17, 2015
Messages
738
Solutions
9
Reaction score
123
Hello ladies and gentlemen! I've got a little script that tp summons to master:

Code:
local distFromMaster = 6

function onThink(interval)
    for _, player in ipairs(Game.getPlayers()) do
        local playerPos = player:getPosition()
        if not Tile(playerPos):hasFlag(TILESTATE_PROTECTIONZONE) then
            local summons = player:getSummons()
            if #summons ~= 0 then
                for i = 1, #summons do
                    local summon = summons[i]
                    local summonPos = summon:getPosition()
                    if summonPos.z ~= playerPos.z or summonPos:getDistance(playerPos) > distFromMaster then
                        summon:teleportTo(playerPos)
                                            end
                end
            end
        end
    end
    return true
end

But now, i have a summon that i dont want to be teleported to master, how can i make "if summon == fire elemental" no telportTo..!

Thanks everybody!
 
I wish id know what that means :'D

creature
- npc
- monster
- player

npc, monster and player are creatures

i.e
Creature(creature_id):getHealth() -- works for all creatures
Player(creature_id):getHealth() -- player only, others will drop error

it can also be used like that(works on players only because getSlotItem is for player metatable)
Creature(player_id):getSlotItem(CONST_SLOT_HEAD)
 
That doesnt help me to know how to do that monsters dont get healed or why getmaster is not working :'D! But thanks! Any more help is welcome, havent solved it yet after much testing.
 
That doesnt help me to know how to do that monsters dont get healed or why getmaster is not working :'D! But thanks! Any more help is welcome, havent solved it yet after much testing.
We are helping you, if you just want the code corrected then you should just say so.
 
Actually, its not 100% necessary.. an exemple about it would be enough.. im trying to learn, but it takes time, and i dont really get what you are trying to say.
Even so, im thankfull for your time and help.
 
Hello all! I really appreciate your help! I did get :getMaster working thanks to that link, but im not close to know how to use that callback so monsters doesnt get healed.

I dont know if it metters but my script is not a spell, is a creaturescript used by a players summon.

Here's what I have until now.

Code:
addEvent(function(cid)
            local creature = Creature(cid)
            if creature then
                local player = creature:getMaster()
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

             
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
         
            end
        end, 1000, creature:getId())

I've tried many diferent ways and i cant get it working :/ My low skills on scripting are not enough right now :'D
 
Hello all! I really appreciate your help! I did get :getMaster working thanks to that link, but im not close to know how to use that callback so monsters doesnt get healed.

I dont know if it metters but my script is not a spell, is a creaturescript used by a players summon.

Here's what I have until now.

Code:
addEvent(function(cid)
            local creature = Creature(cid)
            if creature then
                local player = creature:getMaster()
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

     
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
 
            end
        end, 1000, creature:getId())

I've tried many diferent ways and i cant get it working :/ My low skills on scripting are not enough right now :'D
A callback is a function which is the last thing to execute in a script e.g.
Code:
-- create an instance of Combat and store it in combat
local combat = Combat()

-- this is just a definition of the callback function
function onTargetCreature(creature, target)
     -- place code here to execute
end

-- this is set now but is executed last
combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
object
object's metamethod
constant
name of the callback function as a string

The setCallback of the combat object its 1st argument differs depending on the intended outcome, the 2nd argument is the name of callback function passed as a string.

Example Diagram:
combat:setCallback(1st_argument, "2nd_argument")
 
Last edited:
Thanks @Omni Cloud ! That helped me a bit to understand how it works or at least i though so.. :'D

Have this, but this doesnt seem to work. I feel retarded..

Code:
local hitArea = createCombatArea(AREA_CIRCLE2X2)
local eventsFired = {}

function onTargetCreature(creature, target)
            local creature = Creature(cid)
            if creature then
                local player = creature:getMaster()
                local target = creature:getTarget()
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)
                    if target:isMonster() and not player then
                    return true
                    end
                local combat = Combat()
                combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
                combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
                combat:setArea(createCombatArea(AREA_CIRCLE3X3))
                combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
                combat:execute(creature, var)
          
            end
        end

function onThink(creature)

    if not eventsFired[creature:getId()] then
        addEvent(function(cid)
            local creature = Creature(cid)
            if creature then
                creature:remove()
            end
        end, 10000, creature:getId())
       local damage = onTargetCreature(creature, target)
        addEvent(damage, 1000, creature:getId())
 
Thanks @Omni Cloud ! That helped me a bit to understand how it works or at least i though so.. :'D

Have this, but this doesnt seem to work. I feel retarded..

Code:
local hitArea = createCombatArea(AREA_CIRCLE2X2)
local eventsFired = {}

function onTargetCreature(creature, target)
            local creature = Creature(cid)
            if creature then
                local player = creature:getMaster()
                local target = creature:getTarget()
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)
                    if target:isMonster() and not player then
                    return true
                    end
                local combat = Combat()
                combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
                combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
                combat:setArea(createCombatArea(AREA_CIRCLE3X3))
                combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
                combat:execute(creature, var)
       
            end
        end

function onThink(creature)

    if not eventsFired[creature:getId()] then
        addEvent(function(cid)
            local creature = Creature(cid)
            if creature then
                creature:remove()
            end
        end, 10000, creature:getId())
       local damage = onTargetCreature(creature, target)
        addEvent(damage, 1000, creature:getId())
The Combat object and its metamethods are always executed and loaded into memory before the the script executes.

The Combat object can have any name associated with it, because we are creating an instance of, think of it as a copy of the Combat object but with a different name.

The combat object must exist outside of a function or interface.
Code:
local careBears = Combat()
Now we set its parameters by calling its metamethod setParameter
Code:
careBears:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
careBears:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
Next we set its area if any
Code:
careBears:setArea( createCombatArea(AREA_CIRCLE2X2) )
Then we define our callback function, if we intend the script to do a specific calculation.
Code:
function onTargetCreature(creature, target)
    -- code goes here
end
Finally we set the callback function of the Combat object (if it has one).
Code:
careBears:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

Once these steps are followed you can continue to write the rest of the script, although looking back I think you might be over complicating things.
 
Okay okay! getting closer.. it feels warmer lol! I feel bad for all that time you spend explaining to me @Omni Cloud but im so thankfull!
i've got this for now.. it feels better, it "works" but it says onTargetCreature (a nil value). I though it was because i didnt have any target.. but nah! so i got a little bit lost there.

Code:
local eventsFired = {}

local combat = Combat()
                combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
                combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
                combat:setArea(createCombatArea(AREA_CIRCLE2X2))
               

function onTargetCreature(creature, target)
            local creature = Creature(cid)
            if creature then
                local player = creature:getMaster()
                local target = creature:getTarget()
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)
                    if target:isMonster() and not player then
                    return false
                    end
               
                combat:execute(creature, var)
           
            end
        end
combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onThink(creature)

    if not eventsFired[creature:getId()] then
        addEvent(function(cid)
            local creature = Creature(cid)
            if creature then
                creature:remove()
            end
        end, 10000, creature:getId())
       local damage = onTargetCreature(creature, target)
        addEvent(damage, 1000, creature:getId())
 
In order for the callback to execute (remember it is the last thing to execute) the combat object needs to execute 1st which initiates the process.
So it makes absolutely zero sense to call combat:execute inside of the callback function onTargetCreature.
Code:
combat:execute(creature, var)
When I write scripts for myself or others I usually look at pre-existing scripts to get an idea on how the code is structured, even if you don't understand the execution 100% you will still see a pattern, which goes something like this.
Code:
-- loaded into memory start
settings start
settings end

combat object creation
setting combat object parameter
set area

define callback
set callback

condition object creation if any
setting condition object parameter
set combat to condition if combat exists
-- loaded into memory end

interface start
-- when the interface is executed so is the code defined inside of it
combat:execute
interface end
 
Hello guys! I've solved my problem with a simple:

Code:
if attacker and attacker:isMonster() and primaryType == COMBAT_HEALING then
return false
end

But, now i have a new problem.. this is the finished script:
When used with a GM character it works perfectly, if used on a normal character i get an error player nil value :/

Code:
local hitArea = createCombatArea(AREA_CIRCLE2X2)
local eventsFired = {}

function onThink(creature)

    if not eventsFired[creature:getId()] then
        addEvent(function(cid)
            local creature = Creature(cid)
            if creature then
                creature:remove()
            end
        end, 10000, creature:getId())
      -- local damage = onTargetCreature(creature, target)
        addEvent(function(cid)
            local creature = Creature(cid)
            local player = creature:getMaster()
           
            if creature then
           
                   
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

               
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
           
            end
        end, 1000, creature:getId())

        addEvent(function(cid)
            local creature = Creature(cid)
              
            local player = creature:getMaster()
           
            if creature then
           
                   
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

               
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
           
            end
        end, 3000, creature:getId())

        addEvent(function(cid)
            local creature = Creature(cid)
              
            local player = creature:getMaster()
           
            if creature then
           
                   
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

               
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
           
            end
        end, 5000, creature:getId())

        addEvent(function(cid)
            local creature = Creature(cid)
              
            local player = creature:getMaster()
           
            if creature then
           
                   
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

               
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
           
            end
        end, 7000, creature:getId())

        addEvent(function(cid)
        local creature = Creature(cid)
              
            local player = creature:getMaster()
           
            if creature then
           
                   
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

               
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
           
            end
        end, 9500, creature:getId())
      
        eventsFired[creature:getId()] = true
    end
    return true
end
 
Hello guys! I've solved my problem with a simple:

Code:
if attacker and attacker:isMonster() and primaryType == COMBAT_HEALING then
return false
end

But, now i have a new problem.. this is the finished script:
When used with a GM character it works perfectly, if used on a normal character i get an error player nil value :/

Code:
local hitArea = createCombatArea(AREA_CIRCLE2X2)
local eventsFired = {}

function onThink(creature)

    if not eventsFired[creature:getId()] then
        addEvent(function(cid)
            local creature = Creature(cid)
            if creature then
                creature:remove()
            end
        end, 10000, creature:getId())
      -- local damage = onTargetCreature(creature, target)
        addEvent(function(cid)
            local creature = Creature(cid)
            local player = creature:getMaster()
          
            if creature then
          
                  
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

              
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
          
            end
        end, 1000, creature:getId())

        addEvent(function(cid)
            local creature = Creature(cid)
             
            local player = creature:getMaster()
          
            if creature then
          
                  
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

              
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
          
            end
        end, 3000, creature:getId())

        addEvent(function(cid)
            local creature = Creature(cid)
             
            local player = creature:getMaster()
          
            if creature then
          
                  
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

              
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
          
            end
        end, 5000, creature:getId())

        addEvent(function(cid)
            local creature = Creature(cid)
             
            local player = creature:getMaster()
          
            if creature then
          
                  
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

              
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
          
            end
        end, 7000, creature:getId())

        addEvent(function(cid)
        local creature = Creature(cid)
             
            local player = creature:getMaster()
          
            if creature then
          
                  
                local min = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 4.6) + 100)
                local max = ((player:getLevel() * 0.3) + (player:getMagicLevel() * 9.6) + 125)

              
                doAreaCombatHealth(creature, COMBAT_HEALING, creature:getPosition(), hitArea, min, max, CONST_ME_MAGIC_BLUE)
          
            end
        end, 9500, creature:getId())
     
        eventsFired[creature:getId()] = true
    end
    return true
end
Copy the error.
 
Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/creaturescripts/scripts/custom/healing totem.lua:21: attempt to index local 'player' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/custom/healing totem.lua:21: in function <data/creaturescripts/scripts/custom/healing totem.lua:14>
 
Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/creaturescripts/scripts/custom/healing totem.lua:21: attempt to index local 'player' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/custom/healing totem.lua:21: in function <data/creaturescripts/scripts/custom/healing totem.lua:14>
creature:getMaster returns nil if the creature has no master. The problem probably is that your GM can convince any monster while normal players cannot. You have to add convinceable flag in the monster.
 
Hello guys! This is the new code im using. Im using part of another code i found and edited it to my purpose.

Code:
local c = {
    health = 1000,
    rangex = 3,
    rangey = 3,
    multifloor = false
}
local eventsFired = {}
local hitArea = createCombatArea(AREA_CIRCLE3X3)
function isInArray(array, value)
    if type(array) == 'table' then
        for _, v in pairs(array) do
            if v == value then
                return true
            end
        end
    end
    return false
end

function onThink(creature)

    if not eventsFired[creature:getId()] then
        addEvent(function(cid)
            local creature = Creature(cid)
            if creature then
            creature:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONAREA)
                creature:remove()
            end
        end, 10000, creature:getId())
      -- local damage = onTargetCreature(creature, target)
        addEvent(function(cid)
        
    local master = getCreatureMaster(cid)
                if master then
                    local party = getPartyMembers(master)
                    local masterPosition = getCreaturePosition(master)
                    local totempos = getCreaturePosition(cid)
                    if party == nil or type(party) ~= "table" or #party <= 1 then
                        doCreatureAddHealth(master, c.health)
                        doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                        doSendMagicEffect(masterPosition, 12)
                        return true
                    end
                    local players = getSpectators(totempos, c.rangex, c.rangey, c.multifloor)
                        for _, member in pairs(party) do
                            if isInArray(players, member) then
                                doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                                doCreatureAddHealth(member, c.health)
                                doSendMagicEffect(getCreaturePosition(member), 12)
                             
                            end
                        end
                        end
        end, 1000, creature:getId())

        addEvent(function(cid)
     local master = getCreatureMaster(cid)
                if master then
                    local party = getPartyMembers(master)
                    local masterPosition = getCreaturePosition(master)
                    local totempos = getCreaturePosition(cid)
                    if party == nil or type(party) ~= "table" or #party <= 1 then
                        doCreatureAddHealth(master, c.health)
                        doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                        doSendMagicEffect(masterPosition, 12)
                        return true
                    end
                    local players = getSpectators(totempos, c.rangex, c.rangey, c.multifloor)
                        for _, member in pairs(party) do
                            if isInArray(players, member) then
                                doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                                doCreatureAddHealth(member, c.health)
                                doSendMagicEffect(getCreaturePosition(member), 12)
                             
                            end
                        end
                        end
        end, 3000, creature:getId())

        addEvent(function(cid)
         local master = getCreatureMaster(cid)
                if master then
                    local party = getPartyMembers(master)
                    local masterPosition = getCreaturePosition(master)
                    local totempos = getCreaturePosition(cid)
                    if party == nil or type(party) ~= "table" or #party <= 1 then
                        doCreatureAddHealth(master, c.health)
                        doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                        doSendMagicEffect(masterPosition, 12)
                        return true
                    end
                    local players = getSpectators(totempos, c.rangex, c.rangey, c.multifloor)
                        for _, member in pairs(party) do
                            if isInArray(players, member) then
                                doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                                doCreatureAddHealth(member, c.health)
                                doSendMagicEffect(getCreaturePosition(member), 12)
                             
                            end
                        end
                        end
        end, 5000, creature:getId())

        addEvent(function(cid)
          local master = getCreatureMaster(cid)
                if master then
                    local party = getPartyMembers(master)
                    local masterPosition = getCreaturePosition(master)
                    local totempos = getCreaturePosition(cid)
                    if party == nil or type(party) ~= "table" or #party <= 1 then
                        doCreatureAddHealth(master, c.health)
                        doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                        doSendMagicEffect(masterPosition, 12)
                        return true
                    end
                    local players = getSpectators(totempos, c.rangex, c.rangey, c.multifloor)
                        for _, member in pairs(party) do
                            if isInArray(players, member) then
                                doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                                doCreatureAddHealth(member, c.health)
                                doSendMagicEffect(getCreaturePosition(member), 12)
                             
                            end
                        end
                        end
        end, 7000, creature:getId())

        addEvent(function(cid)
                local master = getCreatureMaster(cid)
                if master then
                    local party = getPartyMembers(master)
                    local masterPosition = getCreaturePosition(master)
                    local totempos = getCreaturePosition(cid)
                    if party == nil or type(party) ~= "table" or #party <= 1 then
                        doCreatureAddHealth(master, c.health)
                        doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                        doSendMagicEffect(masterPosition, 12)
                        return true
                    end
                    local players = getSpectators(totempos, c.rangex, c.rangey, c.multifloor)
                        for _, member in pairs(party) do
                            if isInArray(players, member) then
                                doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                                doCreatureAddHealth(member, c.health)
                                doSendMagicEffect(getCreaturePosition(member), 12)
                             
                            end
                        end
                        end
        end, 9000, creature:getId())
    
        eventsFired[creature:getId()] = true
    end
    return true
end

This works flawless! No bugs. The problem is if you are not in party, you get healed no metter where you are.
 
Sorry for the double post, too much characters.

I've tried adding this:

Code:
if totempos.z ~= masterPosition.z or totempos:getDistance(masterPosition) > distFromMaster then
like this:

Code:
local master = getCreatureMaster(cid)
                if master then
                    local party = getPartyMembers(master)
                    local masterPosition = getCreaturePosition(master)
                    local totempos = getCreaturePosition(cid)
                    local distFrommaster = 3
                    if party == nil or type(party) ~= "table" or #party <= 1 then
                    if totempos.z ~= masterPosition.z or totempos:getDistance(masterPosition) > distFromMaster then
                        doCreatureAddHealth(master, c.health)
                        doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                        doSendMagicEffect(masterPosition, 12)
                        return true
                      end
                    end
                    local players = getSpectators(totempos, c.rangex, c.rangey, c.multifloor)
                        for _, member in pairs(party) do
                            if isInArray(players, member) then
                                doAreaCombatHealth(creature, COMBAT_FIREDAMAGE, creature:getPosition(), hitArea, 0, 0, CONST_ME_MAGIC_BLUE)
                                doCreatureAddHealth(member, c.health)
                                doSendMagicEffect(getCreaturePosition(member), 12)
                               
                            end
                        end
                        end
but, if i do that, i get this error:
Code:
 bad argument #1 to 'pairs' (table expected, got boolean)

What i am missing? Thanks for your time and help.
 
Back
Top