• 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 globalevent area heal

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,398
Reaction score
165
Hey so i found this script to heal area place but it has some error. i use 0.4 can someone please help fixing it ?
PHP:
  --[[
        Idea by Pitufo
        Script by Shawak
]]--

local config = {

        healHP = 10000,
        healPlayers = "yes",
        healMonsters = "yes",
}

local healthArea = {

        fromX = 1002,
        fromY = 997,
        fromZ = 5,
        toX = 1004,
        toY = 999,
        toZ = 5,

}

function onThink(cid, interval, lastExecution)
        for x = healthArea.fromX, healthArea.toX do
                for y = healthArea.fromY, healthArea.toY do
                        for z = healthArea.fromZ, healthArea.toZ do
                                local pos = {x=x, y=y, z=z, stackpos = 253}
                                local thing = getThingfromPos(pos)
                                doSendMagicEffect(pos, 1)
                                if thing.itemid > 0 then
                                        if(isPlayer(thing.uid) == TRUE and string.lower(config.healPlayers) == "yes") then
                                                doCreatureAddHealth(thing.uid, config.healHP)
                                                if string.lower(getConfigValue("showHealingDamage")) == "yes" then
                                                        doSendAnimatedText(pos, "+"..config.healHP.."", 18)
                                                end
                                        elseif(isMonster(thing.uid) == TRUE and string.lower(config.healMonsters) == "yes") then
                                                doCreatureAddHealth(thing.uid, config.healHP)
                                                if string.lower(getConfigValue("showHealingDamageForMonsters")) == "yes" then
                                                        doSendAnimatedText(pos, "+"..config.healHP.."", 18)
                                                end
                                        end
                                end
                        end
                end
        end
        return TRUE
end

but i get error if monster or player is on area of heal
error
Code:
[18:17:24.249] [Error - GlobalEvent Interface]
[18:17:24.249] data/globalevents/scripts/healplace.lua:onThink
[18:17:24.249] Description:
[18:17:24.249] data/globalevents/scripts/healplace.lua:34: bad argument #1 to 'lower' (string expected, got boolean)
[18:17:24.249] stack traceback:
[18:17:24.249]  [C]: in function 'lower'
[18:17:24.249]  data/globalevents/scripts/healplace.lua:34: in function <data/globalevents/scripts/healplace.lua:24>
[18:17:24.249] [Error - GlobalEvents::think] Couldn't execute event: healspot
 
didn't test it
PHP:
local config = {

    healSettings = {

    healHP = 10000,
    healPlayers = true,
    healMonsters = true
   },

   healthArea = {

   fromX = 1002,
   fromY = 997,
   fromZ = 5,

   toX = 1004,
   toY = 999,
   toZ = 5
   }
}

function onThink(cid, interval, lastExecution)
    for x = config.healthArea.fromX, config.healthArea.toX do
        for y = config.healthArea.fromY, config.healthArea.toY do
            for z = config.healthArea.fromZ, config.healthArea.toZ do
                local pos = {x=x, y=y, z=z, stackpos = 253}
                local thing = getThingfromPos(pos)
                doSendMagicEffect(pos, 1)
                    if thing.itemid > 0 then
                        if(isPlayer(thing.uid) == TRUE and (config.healSettings.healPlayers) then
                            doCreatureAddHealth(thing.uid, config.healSettings.healHP)
                            if(getBooleanFromString(getConfigValue('showHealingDamage'))) then
                                doSendAnimatedText(pos, "+"..config.healSettings.healHP.."", 18)
                            end
                        elseif isMonster(thing.uid) == TRUE and (config.healSettings.healMonsters) then
                            doCreatureAddHealth(thing.uid, config.healSettings.healHP)
                            if(getBooleanFromString(getConfigValue('showHealingDamageForMonsters'))) then
                                doSendAnimatedText(pos, "+"..config.healSettings.healHP.."", 18)
                            end
                        end
                    end
                end
            end
        end
        return true
    end
 
didn't test it
PHP:
local config = {

    healSettings = {

    healHP = 10000,
    healPlayers = true,
    healMonsters = true
   },

   healthArea = {

   fromX = 1002,
   fromY = 997,
   fromZ = 5,

   toX = 1004,
   toY = 999,
   toZ = 5
   }
}

function onThink(cid, interval, lastExecution)
    for x = config.healthArea.fromX, config.healthArea.toX do
        for y = config.healthArea.fromY, config.healthArea.toY do
            for z = config.healthArea.fromZ, config.healthArea.toZ do
                local pos = {x=x, y=y, z=z, stackpos = 253}
                local thing = getThingfromPos(pos)
                doSendMagicEffect(pos, 1)
                    if thing.itemid > 0 then
                        if(isPlayer(thing.uid) == TRUE and (config.healSettings.healPlayers) then
                            doCreatureAddHealth(thing.uid, config.healSettings.healHP)
                            if(getBooleanFromString(getConfigValue('showHealingDamage'))) then
                                doSendAnimatedText(pos, "+"..config.healSettings.healHP.."", 18)
                            end
                        elseif isMonster(thing.uid) == TRUE and (config.healSettings.healMonsters) then
                            doCreatureAddHealth(thing.uid, config.healSettings.healHP)
                            if(getBooleanFromString(getConfigValue('showHealingDamageForMonsters'))) then
                                doSendAnimatedText(pos, "+"..config.healSettings.healHP.."", 18)
                            end
                        end
                    end
                end
            end
        end
        return true
    end
Solved brother , thanks anyway!
 
This script is mine, and I 'll leave this ...

Code:
--[[ Script by Pharos]]--
local area = {
   fromPos = {x= 794, y= 796, z= 7}, -- Esquina superior izquierda de la zona.
   toPos = {x= 815, y= 814, z= 7} -- Esquina inferior derecha de la zona.
}

function onThink (cid, interval, lastExecution, pos, frompos, topos)

   for x = area.fromPos.x, area.toPos.x do
       for y = area.fromPos.y, area.toPos.y do

         local pos = {x = x, y = y, z = area.fromPos.z}
         local player = getTopCreature(pos).uid

           if isPlayer(player) then
          doAreaCombatMana (COMBAT_MANADRIAN, pos, .0, 200, 300, CONST_ME_PURPLEENERGY);
          doAreaCombatHealth (COMBAT_LIFEDRIAN, pos, .0, 200, 300, CONST_ME_YELLOWENERGY)
                      end
       end
   end

return true
end

 
didn't test it
PHP:
local config = {

    healSettings = {

    healHP = 10000,
    healPlayers = true,
    healMonsters = true
   },

   healthArea = {

   fromX = 1002,
   fromY = 997,
   fromZ = 5,

   toX = 1004,
   toY = 999,
   toZ = 5
   }
}

function onThink(cid, interval, lastExecution)
    for x = config.healthArea.fromX, config.healthArea.toX do
        for y = config.healthArea.fromY, config.healthArea.toY do
            for z = config.healthArea.fromZ, config.healthArea.toZ do
                local pos = {x=x, y=y, z=z, stackpos = 253}
                local thing = getThingfromPos(pos)
                doSendMagicEffect(pos, 1)
                    if thing.itemid > 0 then
                        if(isPlayer(thing.uid) == TRUE and (config.healSettings.healPlayers) then
                            doCreatureAddHealth(thing.uid, config.healSettings.healHP)
                            if(getBooleanFromString(getConfigValue('showHealingDamage'))) then
                                doSendAnimatedText(pos, "+"..config.healSettings.healHP.."", 18)
                            end
                        elseif isMonster(thing.uid) == TRUE and (config.healSettings.healMonsters) then
                            doCreatureAddHealth(thing.uid, config.healSettings.healHP)
                            if(getBooleanFromString(getConfigValue('showHealingDamageForMonsters'))) then
                                doSendAnimatedText(pos, "+"..config.healSettings.healHP.."", 18)
                            end
                        end
                    end
                end
            end
        end
        return true
    end
2 much coderino
 
Cuz i didn't optimize it lel.
As you can see it's the same script than the original just with some changes.

Btw, next time try to not post such a useless comment :)
and I dont blame you cus u didnt optimize it, btw u can not do it cus ur knowledge is limited, not as your mouth
 
and I dont blame you cus u didnt optimize it, btw u can not do it cus ur knowledge is limited, not as your mouth

And that's exactly the only thing u do here, blame and make stupid comments.

Funny thing is how u r making speculations without even know me, seems like the one with a limitless mouth is you.
 
And that's exactly the only thing u do here, blame and make stupid comments.

Funny thing is how u r making speculations without even know me, seems like the one with a limitless mouth is you.
too stupid, didnt read
btw, who are you? 180 comments u must be new here, did you enjoy the free script we do here u leecher?
 
FFs, this is what i get for arguing with an idiot...

180 comments helping the community are worth more than 2200 stupid comments ;).
Shit is the only thing comes out from your mouth.


En pocas palabras no vales verga, basura.
 
FFs, this is what i get for arguing with an idiot...

180 comments helping the community are worth more than 2200 stupid comments ;).
Shit is the only thing comes out from your mouth.


En pocas palabras no vales verga, basura.
i dont know how you help but if u say so, keep doing what u dont do.
 
Back
Top