Shawak
Intermediate OT User
Hello, here a full working script, that heals monsters and/or players in a area of you choice.
Credits:
- Idea from Health Area by Pitufo (scripts was healing all online players, lol).
- Scriptet by me.
Version:
- Testet on TFS 0.3.5.
- Perhaps it works on TFS 0.3.4, too.
Script:
- data/globalevents.xml:
"interval="3"" are the seconds, how fast it heals.
- data/globalevents/scripts/heal.lua
Declaration:
- config
- healthArea
The script heals from tile 1, to tile 2 all players / monsters.
Screenshot:
I hope you like it .
If you like it, i don't worry about a rep++.
Regards,
Shawak
Credits:
- Idea from Health Area by Pitufo (scripts was healing all online players, lol).
- Scriptet by me.
Version:
- Testet on TFS 0.3.5.
- Perhaps it works on TFS 0.3.4, too.
Script:
- data/globalevents.xml:
HTML:
<globalevent name="heal" interval="3" event="script" value="heal.lua"/>
- data/globalevents/scripts/heal.lua
Lua:
--[[
Idea by Pitufo
Script by Shawak
]]--
local config = {
healHP = 20,
healPlayers = "yes",
healMonsters = "yes",
}
local healthArea = {
fromX = 1012,
fromY = 1026,
fromZ = 6,
toX = 1018,
toY = 1031,
toZ = 7,
}
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, 12)
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")) == "no" 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")) == "no" then
doSendAnimatedText(pos, "+"..config.healHP.."", 18)
end
end
end
end
end
end
return TRUE
end
Declaration:
- config
HTML:
healHP = 20, -- how much it heals
healPlayers = "yes", -- heal players? "yes" or "no"
healMonsters = "yes", -- heal monsters? "yes" or "no"
The script heals from tile 1, to tile 2 all players / monsters.
HTML:
|-- Tile 1 -------|
| fromX = 1012, --|
| fromY = 1026, --|
| fromZ = 6, --|
|-----------------|
|-- Tile 2 -------|
| toX = 1018, --|
| toY = 1031, --|
| toZ = 6, --|
|-----------------|
Screenshot:
I hope you like it .
If you like it, i don't worry about a rep++.
Regards,
Shawak