pop up like fireworks
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
<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 endCode:<globalevent name="areahealth" interval="1" event="script" value="area_health.lua"/>
This script will keep healing the tiles.
If the function is onStepIn, it will heal when the player step on the tile.
wow i tried it and they dont heal they just have the effect.
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
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