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

monster (heal player) rep++

Jikoe II

Member
Joined
Feb 7, 2009
Messages
174
Reaction score
9
hello ,

could somebody make a monster that heals only the the player that summoned it?

thanks!

__/jikoe
 
more info, does it heal player in constant interval of time? , does it heals him a fixed number , does it heal him all the time as it is summoned?
 
I was asking that because i would have done it ina spell way and that spell when used summon monster, keep heling you 100 evey sec untill your monster is dead with some animations etc..
 
This should work
LUA:
local amount = 100    -- amount of hp
local times = 1   -- in sec
local name = "Fire elemental"   -- monster name , make sure that the monster is convinced

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, TRUE)

local 	function heal(cid)
			local p = getThingPos(cid)
			local healing = false
			if(#getCreatureSummons(cid) >= 1) then
				for _,pid in ipairs(getCreatureSummons(cid)) do
					if string.lower(getCreatureName(pid)) == string.lower(name) then
						healing = true 
						break
					end
				end
			end
			if healing == true then
				doCreatureAddHealth(cid,amount)
				doSendMagicEffect(getThingPos(cid),CONST_ME_MAGIC_BLUE)
				addEvent(heal,times*1000,cid)
					for _,pid in ipairs(getCreatureSummons(cid)) do
						if string.lower(getCreatureName(pid)) == string.lower(name) then
							doSendMagicEffect(getThingPos(pid),CONST_ME_MAGIC_BLUE)
							doSendAnimatedText(getThingPos(pid),"Healing",math.random(1,255))
							break
						end
					end
			end
			return true
		end
function onCastSpell(cid, var)
	local search = false
	if(#getCreatureSummons(cid) >= 1) then
		for _,pid in ipairs(getCreatureSummons(cid)) do
			if string.lower(getCreatureName(pid)) == string.lower(name) then
				search = true 
				break
			end
		end
	end
	if search == true then
		doPlayerSendCancel(cid,"You already have a "..string.lower(name).." summoned.")
		doSendMagicEffect(getThingPos(cid),2)
		return false
	else
		doConvinceCreature(cid, doSummonCreature(string.lower(name), getThingPos(cid)))
		heal(cid) 
		doCombat(cid,combat,var)
		return true
	end
	
	return true
end
 
thanks for the script doggy!

but it will summon another fire elemental and heal that fire elemental

[23/10/2010 18:21:29] [Error - Spell Interface]
[23/10/2010 18:21:29] data/spells/scripts/healmonsterspel.lua:onCastSpell
[23/10/2010 18:21:29] Description:
[23/10/2010 18:21:29] (luaDoConvinceCreature) Creature not found


thanks!

__/jikoe
 
Last edited:
Maybe i have done it in a long wayy , but i dont have time to look for another way.
Now it summons in a range of 2 sqm like normal summon spell, if all tiles in range sqm cant have a summon creature it will send cancel.
LUA:
local amount = 100 -- amount of hp
local times = 1 -- in sec
local name = "Fire elemental" -- monster name , make sure that the monster is convinced
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, TRUE)
 
local function heal(cid)
			local p = getThingPos(cid)
			local healing = false
			if(#getCreatureSummons(cid) >= 1) then
				for _,pid in ipairs(getCreatureSummons(cid)) do
					if string.lower(getCreatureName(pid)) == string.lower(name) then
						healing = true 
						break
					end
				end
			end
			if healing == true then
				doCreatureAddHealth(cid,amount)
				doSendMagicEffect(getThingPos(cid),CONST_ME_MAGIC_BLUE)
				addEvent(heal,times*1000,cid)
					for _,pid in ipairs(getCreatureSummons(cid)) do
						if string.lower(getCreatureName(pid)) == string.lower(name) then
							doSendMagicEffect(getThingPos(pid),CONST_ME_MAGIC_BLUE)
							doSendAnimatedText(getThingPos(pid),"Healing",math.random(1,255))
							break
						end
					end
			end
			return true
		end
	local 	function check(cid)
				local checked = 0
				local place = { x=0,y=0,z=0}
				local h = getThingPos(cid)
				local frompos = {x=h.x-2,y=h.y-2,z=h.z}
				local topos = {x=h.x+2,y=h.y+2,z=h.z}
				for g = frompos.x,topos.x do
					for d = frompos.y,topos.y do
						local poss = {x=g,y=d,z=h.z}
						local tid = getTopCreature(poss).uid
						if isMonster(tid) or isPlayer(tid) or getTilePzInfo(poss) == TRUE or doTileQueryAdd(cid, poss) ~= 1 then
							checked = checked + 1
						else
							place.x = poss.x
							place.y = poss.y
							place.z = poss.z
							break
						end
					end
				end
				if checked >= 25 then
					return checked
				elseif checked < 25 then
					return place
				end
				return true
			end
function onCastSpell(cid, var)
	local search = false
	if(#getCreatureSummons(cid) >= 1) then
		for _,pid in ipairs(getCreatureSummons(cid)) do
			if string.lower(getCreatureName(pid)) == string.lower(name) then
				search = true 
				break
			end
		end
	end
	if search == true then
		doPlayerSendCancel(cid,"You already have a "..string.lower(name).." summoned.")
		doSendMagicEffect(getThingPos(cid),2)
		return false
	else
		local f = getThingPos(cid)
		local pos = {x=f.x+1,y=f.y,z=f.z}
		if not tonumber(check(cid)) then
			doConvinceCreature(cid,doSummonCreature(string.lower(name), check(cid)))
			heal(cid) 
			doCombat(cid,combat,var)
			
		else
			doPlayerSendCancel(cid,"You cant summon here.")
			doSendMagicEffect(getThingPos(cid),2)
		return false
		end
		return true
	end
 
	return true
end
 
Last edited:
i get it now like this when i summon black sheep with utevo res "black sheep

2iruees.png



btw using tfs 0.3.6
 
I dont get it, You having this spell as utevo res or what? or it is another spell but when you summon the same monster with utevo res it makes so?
 
Back
Top