• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Spell which can bounce between monsters

kermaxpl

Pora na Nonsens Scripter
Joined
Aug 21, 2012
Messages
121
Reaction score
7
Location
Poland
Hi, guys i need spell which can bounce betwen monsters in area 3x3 near target 5 times.
Can u help me?

- - - Updated - - -

Bump
 
Last edited:
I was trying to do some remake of Gesior's function but it wasn't work
Here is part of this script which makes error
LUA:
function getpos()
local target = getCreatureTarget(cid)
local pPos = getCreaturePosition(target)
local playernumber = 0
local playersInRange = {}
local pozycje = {
		{x=pPos.x-3,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
		{x=pPos.x-3,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
		{x=pPos.x-3,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
		{x=pPos.x-3,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
		{x=pPos.x-3,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
		{x=pPos.x-3,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
		{x=pPos.x-3,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE}
		}
	for i = 1, #pozycje do
	local creatureToHit = getThingfromPos(positionsToCheck[i])
		if getTilePzInfo(pozycje[i]) == FALSE then
			if isCreature(creatureToHit.uid) == TRUE and creatureToHit.uid ~= cid and isPlayer(creatureToHit.uid) ~= TRUE then
				table.insert(playersInRange, creatureToHit.uid)
				playernumber = playernumber + 1
			end
		end
	end
	return {list = playersInRange, number = playernumber}
end
And error:
Code:
[1:43:35.060] [Error - Spell Interface]
[1:43:35.060] In a timer event called from:
[1:43:35.060] data/spells/scripts/atak/bounce.lua:onCastSpell
[1:43:35.060] Description:
[1:43:35.060] data/spells/scripts/atak/bounce.lua:28: attempt to index local 'pPos' (a boolean value)
[1:43:35.060] stack traceback:
[1:43:35.060]   data/spells/scripts/atak/bounce.lua:28: in function 'getpos'
[1:43:35.060]   data/spells/scripts/atak/bounce.lua:56: in function <data/spells/scripts/atak/bounce.lua:48>
 
Last edited:
Loop through creatures in the area of the caster and just send distance effects between them?

You can use: getSpectators(getCreaturePosition(cid), 5, 5)
 
Now i have:
LUA:
function getpos(cid)
local target = getCreatureTarget(cid)
local playernumber = 0
local playersInRange = {}
local multitarget = getSpectators(getCreaturePosition(target), 5, 5, FALSE)
for i = 1, #multitarget do
	local creatureToHit = multitarget[i]
	if getTilePzInfo(getCreaturePosition(creatureToHit.uid)) == FALSE then
		if isCreature(creatureToHit.uid) == TRUE and creatureToHit.uid ~= cid and isPlayer(creatureToHit.uid) ~= TRUE and isNpc(creatureToHit.uid) ~= TRUE then
		table.insert(playersInRange, creatureToHit.uid)
		playernumber = playernumber + 1
		end
	end
end
	return {list = playersInRange, number = playernumber}
end

And error:
Code:
[19:31:52.913] [Error - Spell Interface]
[19:31:52.913] In a timer event called from:
[19:31:52.913] data/spells/scripts/atak/bounce.lua:onCastSpell
[19:31:52.913] Description:
[19:31:52.913] (luaGetCreatureTarget) Creature not found

[19:31:52.913] [Error - Spell Interface]
[19:31:52.913] In a timer event called from:
[19:31:52.913] data/spells/scripts/atak/bounce.lua:onCastSpell
[19:31:52.913] Description:
[19:31:52.913] (luaGetThingPosition) Thing not found

[19:31:52.913] [Error - Spell Interface]
[19:31:52.913] In a timer event called from:
[19:31:52.913] data/spells/scripts/atak/bounce.lua:onCastSpell
[19:31:52.913] Description:
[19:31:52.913] data/spells/scripts/atak/bounce.lua:24: attempt to get length of local 'multitarget' (a nil value)
[19:31:52.913] stack traceback:
[19:31:52.913]  data/spells/scripts/atak/bounce.lua:24: in function 'getpos'
[19:31:52.913]  data/spells/scripts/atak/bounce.lua:43: in function <data/spells/scripts/atak/bounce.lua:36>

Line 27 is:
LUA:
for i = 1, #multitarget do
 
Last edited:
You need to check if there are any creatures before you try to find the position of them.

You need to add
LUA:
if (multitarget ) then
before you begin looping through them
 
this is error 'can't get player's target' and u want to check multitarget, pls read error before u post


-- Edit

I added your "if" and changed 'getCreaturePosition(target)' to 'getCreaturePosition(cid)', but I still have
Code:
[19:31:52.913] [Error - Spell Interface]
[19:31:52.913] In a timer event called from:
[19:31:52.913] data/spells/scripts/atak/bounce.lua:onCastSpell
[19:31:52.913] Description:
[19:31:52.913] (luaGetThingPosition) Thing not found

On the other way if it will work, it isn't a good solution becouse i need to check area around monster not around player.

--Edit


SOLVED
It have some bugs, because hits only randomly 2-4 enemies, but should 2-8 and chain end when first target die, and animation sometimes starts from wrong minion, if i will repair this maybe i will publish whole spell.

Ty for help.
 
Last edited:
Back
Top