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

Chain Heal

Xagul

deathzot.net
Joined
Jun 30, 2008
Messages
1,295
Solutions
3
Reaction score
1,043
Hello, I am trying to make a spell sorta like "chain heal" from WoW. From what Ive been trying, it seems like getSpectators and doSendDistanceShoot are going to be the functions that will be most useful to do this however all I can come up with is a spell that shoots a chain heal to everyone around you at the same time but really what needs to happen is it needs to shoot it at the first person on the list then send from that person to the second person on the list and so on. If anyone could supply some info on how I can go about doing this it would be great! Thanks in advance :)
 
Code:
local list = getSpectators(getCreaturePosition(cid), 5, 7, false)
for i = 1, #list do
	doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(list[i]), CONST_ANI_ENERGY)
	healingFunction(cid, list[i]) -- doCombat? ;d
end
 
Yea that is what I have right now, but when its done like that it shoots from the player using it to every person around them instantly, I am trying to make it shoot from the player using it to the first person on the list, then from that player it jumps to the second player on the list and so on. >.<
 
Code:
local list = getSpectators(getCreaturePosition(cid), 7, 5, false)
for i = 1, #list do
	if(i == 1) then
		doSendDistanceShoot(getCreaturePosition(cid), getCreaturePosition(list[i]), CONST_ANI_ENERGY)
		healingFunction(cid, list[i]) -- doCombat? ;d
	else
		doSendDistanceShoot(getCreaturePosition(list[i-1]), getCreaturePosition(list[i]), CONST_ANI_ENERGY)
		healingFunction(cid, list[i]) -- doCombat? ;d
	end
end

@Edit:
Or shortened:
Code:
local list = getSpectators(getCreaturePosition(cid), 7, 5, false)
for i = 1, #list do
	doSendDistanceShoot(getCreaturePosition(list[i == 1 and i or i-1]), getCreaturePosition(list[i]), CONST_ANI_ENERGY)
	healingFunction(cid, list[i]) -- doCombat? ;d
end
 
Last edited:
Yea looks good, the shortened version is backwards as far as animation but both get the job done :D Ive sorta added a monster check so it don't heal monsters but it still sends a distance effect to them, the problem with it is the script goes in the list order so if it was to completely ignore monsters it would look weird because it would skip a complete jump instead of just skipping to the next player in the list (I think)... it would be nice if elf added support for 2 different functions for example:
getPlayerSpectators()
getCreatureSpectators()
If your bored and can figure out a way around this that would be cool, but either way I cannot express my gratitude enough :D thanks so much!
 
Code:
local list = getSpectators(getCreaturePosition(cid), 7, 5, false)
local players = {}

if(#list > 0) then
	for i = 1, #list do
		if(isPlayer(list[i])) then
			table.insert(players, list[i])
		end
	end
end

if(#players > 0) then
	for i = 1, #players do
		doSendDistanceShoot(getCreaturePosition(players[i == 1 and i or i-1]), getCreaturePosition(players[i]), CONST_ANI_ENERGY)
		healingFunction(cid, players[i]) -- doCombat? ;d
	end
end
 
Last edited:
Back
Top