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

No limit to healing radius?

Seanr

New Member
Joined
Jul 11, 2011
Messages
167
Reaction score
3
Location
Mo Town
Try this:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
 
function onCastSpell(cid, var)
	if isInParty(cid) then
		local lid = getPartyLeader(cid)
		local pm = getPartyMembers(lid)
		local lvl = getPlayerLevel(cid)
		local mlvl = getPlayerMagLevel(cid)
		local min = 50 + lvl * 1.0 + mlvl * 1.0
		local max = 100 + lvl * 1.0 + mlvl * 1.0
		for i = 1,#pm do
			doCreatureAddHealth(pm[i],math.random(min,max))
                        doCombat(pm[i], combat, var)
		end
	else
		return false,doPlayerSendCancel(cid, "You need to be in a party to cast this spell!")
	end
	return doCombat(cid, combat, var)
end

This heals party members wherever they are at. Healer can be in Thais temple of Real Map and party members could be in PoI and they are still healed from healer. Can you not add a radius to it?
 
<instant name="Party Heal" words="exura gran mas sio" lvl="50" mana="230" allowfaruse="0" prem="0" aggressive="0" exhaustion="1000" needlearn="0" event="script" value="healing/party heal.lua">
<vocation id="1"/>
<vocation id="5"/>

like this?

This doesn't work
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
 
function onCastSpell(cid, var)
	if isInParty(cid) then
		local lid = getPartyLeader(cid)
		local pm = getPartyMembers(lid)
		local lvl = getPlayerLevel(cid)
		local mlvl = getPlayerMagLevel(cid)
		local min = 50 + lvl * 1.0 + mlvl * 1.0
		local max = 100 + lvl * 1.0 + mlvl * 1.0
                local pPos = getPlayerPosition(cid) 
                local fromPos = {x=pPos.x-radius, y=pPos.y-radius, z=pPos.z} 
                local toPos = {x=pPos.x+radius, y=pPos.y+radius, z=pPos.z} 
		for i = 1,#pm do
			doCreatureAddHealth(pm[i],math.random(min,max))
                        doCombat(pm[i], combat, var)
		end
	else
		return false,doPlayerSendCancel(cid, "You need to be in a party to cast this spell!")
	end
	return doCombat(cid, combat, var)
end
 
what happens if you try this?
XML:
<instant name="Party Heal" words="exura gran mas sio" lvl="50" mana="230" allowfaruse="1" prem="0" aggressive="0" needtarget="1" params="1" exhaustion="1000" needlearn="0" event="script" value="healing/party heal.lua">
<vocation id="1"/>
<vocation id="5"/>

and

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
 
 function check(cid, pos, player)
checkPosInSquare(cid, pos, player)
end

 
function onCastSpell(cid, var)
	if isInParty(cid) then
		local cid = getPartyLeader(cid, pos, player)
		local pm = getPartyMembers(cid, pos, player)
		local lvl = getPlayerLevel(cid)
		local mlvl = getPlayerMagLevel(cid)
		local min = 50 + lvl * 1.0 + mlvl * 1.0
		local max = 100 + lvl * 1.0 + mlvl * 1.0
		for i = 1,#pm do
			doCreatureAddHealth(pm[i],math.random(min,max))
                        doCombat(pm[i], combat, var)
		end
	else
		return false,doPlayerSendCancel(cid, "You need to be in a party to cast this spell!")
	end
	return doCombat(cid, combat, var)
end

Is it still all over the map, or doesn't it work if you uses my example, post a reply!

If the .lua function gives error, try to replace it with your old one, I'm not sure if (cid, pos, player), I know it works with creatures and npc's but I'm not 100% sure that it works with players.
 
Try checking the distance between the caster and the person currently being healed by using this:

Code:
getDistanceBetween(fromPosition, toPosition)

Something like this should work:


Lua:
for i = 1,#pm do
	if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(pm[i])) <= 5 then
		doCreatureAddHealth(pm[i],math.random(min,max))
		doCombat(pm[i], combat, var)
	end
end
 
what happens if you try this?
XML:
<instant name="Party Heal" words="exura gran mas sio" lvl="50" mana="230" allowfaruse="1" prem="0" aggressive="0" needtarget="1" params="1" exhaustion="1000" needlearn="0" event="script" value="healing/party heal.lua">
<vocation id="1"/>
<vocation id="5"/>

and

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
 
 function check(cid, pos, player)
checkPosInSquare(cid, pos, player)
end

 
function onCastSpell(cid, var)
	if isInParty(cid) then
		local cid = getPartyLeader(cid, pos, player)
		local pm = getPartyMembers(cid, pos, player)
		local lvl = getPlayerLevel(cid)
		local mlvl = getPlayerMagLevel(cid)
		local min = 50 + lvl * 1.0 + mlvl * 1.0
		local max = 100 + lvl * 1.0 + mlvl * 1.0
		for i = 1,#pm do
			doCreatureAddHealth(pm[i],math.random(min,max))
                        doCombat(pm[i], combat, var)
		end
	else
		return false,doPlayerSendCancel(cid, "You need to be in a party to cast this spell!")
	end
	return doCombat(cid, combat, var)
end

Is it still all over the map, or doesn't it work if you uses my example, post a reply!

If the .lua function gives error, try to replace it with your old one, I'm not sure if (cid, pos, player), I know it works with creatures and npc's but I'm not 100% sure that it works with players.


I will try soon and post reply with edit. Thank you :)

EDIT: When I use this, it says 'A Player with this name is not online.'

- - - Updated - - -

Try checking the distance between the caster and the person currently being healed by using this:

Code:
getDistanceBetween(fromPosition, toPosition)

Something like this should work:


Lua:
for i = 1,#pm do
	if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(pm[i])) <= 5 then
		doCreatureAddHealth(pm[i],math.random(min,max))
		doCombat(pm[i], combat, var)
	end
end

This is working for me, but the spell won't emote now. The spell just doesn't show up when I use it.
 
Last edited:
Back
Top