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

GlobalEvent [Release] HealthArea

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,984
Solutions
2
Reaction score
119
Location
Germany
GitHub
Shawak
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:
HTML:
	<globalevent name="heal" interval="3" event="script" value="heal.lua"/>
"interval="3"" are the seconds, how fast it heals.

- 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"
- healthArea
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:
2zgust5.png


I hope you like it :).
If you like it, i don't worry about a rep++.

Regards,
Shawak
 
doAreaCombatHealth()

kkthxbb

#edit:
Code:
dofile(getDataDir() .. "spells/lib/spells.lua")

function onThink(cid, interval, lastExecution)
	local config = {
		area = createCombatArea(AREA_CIRCLE3X3),
		centerpos = {x=,y=,z=},
		min = 100,
		max = 500,
		effect = CONST_ME_MAGIC_BLUE,
	}
	doAreaCombatHealth(0, COMBAT_HEALING, config.centerpos, config.area, config.min, config.max, config.effect)
	return true
end
 
dude, this was already released before, not with many config but already was.
 
okay okay okay, :).
I think both scripts schould be in this theard so i don't go to change it :thumbup:.

And stop pwning me in each script :), :mad:.
 
Lot's of people flaming on your thread Shawak. :huh:
I think it's a good script :thumbup:
 
I'm not flaming you Shawak, but i'm showing you other way to do the same using less memory.
 
Back
Top