• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Healing tiles

tsb0314

New Member
Joined
Oct 21, 2009
Messages
220
Reaction score
4
I have seen on other server how the tiles pop up like fireworks and they can heal both your health and you mana. can someone give me a script so then i can put it on my server

thanks
 
area_health.lua
Code:
local pos =
{
    {{x = 1097, y = 1456, z = 7}, {x = 1097, y = 1456, z = 7, stackpos = 253}},
    {{x = 1097, y = 1456, z = 7}, {x = 1097, y = 1456, z = 7, stackpos = 253}}
    }
function onThink(cid, interval, lastExecution)
    for _, positions in pairs(pos) do
        doSendMagicEffect(positions[1], 12)
        if getThingFromPos(positions[2]).itemid > 0 then
            for _, name in pairs(getOnlinePlayers()) do
                local player = getPlayerByName(name)
                    doCreatureAddHealth(player, 10)
            end
        end
    end
return TRUE
end
Code:
<globalevent name="areahealth" interval="1" event="script" value="area_health.lua"/>
 
area_health.lua
Code:
local pos =
{
    {{x = 1097, y = 1456, z = 7}, {x = 1097, y = 1456, z = 7, stackpos = 253}},
    {{x = 1097, y = 1456, z = 7}, {x = 1097, y = 1456, z = 7, stackpos = 253}}
    }
function onThink(cid, interval, lastExecution)
    for _, positions in pairs(pos) do
        doSendMagicEffect(positions[1], 12)
        if getThingFromPos(positions[2]).itemid > 0 then
            for _, name in pairs(getOnlinePlayers()) do
                local player = getPlayerByName(name)
                    doCreatureAddHealth(player, 10)
            end
        end
    end
return TRUE
end
Code:
<globalevent name="areahealth" interval="1" event="script" value="area_health.lua"/>

Shouldn't it be onStepIn?
 
This script will keep healing the tiles.
If the function is onStepIn, it will heal when the player step in the tile.
 
This script will keep healing the tiles.
If the function is onStepIn, it will heal when the player step on the tile.

That is what they use on ForgottenL and that would cause less lag i believe. Since it doesn't have to keep executing it draining unneccessary memory when someones not standing on it.
 
wow i tried it and they dont heal they just have the effect.

LUA:
local pos =
{
    {{x = 1097, y = 1456, z = 7}, {x = 1097, y = 1456, z = 7, stackpos = 253}},
    {{x = 1097, y = 1456, z = 7}, {x = 1097, y = 1456, z = 7, stackpos = 253}}
    }
function onThink(cid, interval, lastExecution)
    for _, positions in pairs(pos) do
        doSendMagicEffect(positions[1], 12)
        if getThingFromPos(positions[2]).itemid > 0 then
            for _, name in pairs(getOnlinePlayers()) do
                    doCreatureAddHealth(cid, 10)
            end
        end
    end
return TRUE
end

Try now, i didn't bother changing it to onStepIn-
 
If you want use a function onStepIn, you should use this code (not tested!):
PHP:
function onStepHealing(cid, pos)
    if (getThingPosition(cid) == pos) then
        doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
        doCreatureAddHealth(cid, math.random(0.005, 0.02) * getCreatureMaxHealth(cid))
        addEvent(onStepHealing, 1000, cid, pos)
    end
    return true
end

function onStepIn(cid, item, pos)
    return addEvent(onStepHealing, 1000, cid, pos)
end
Of course, work for players and monsters =).
 
Back
Top