Siegh
Thronar Developer
I'm using this script for a boss that constantly teleports everyone involved between arenas. Its supposed to be doing the following:
Get every creature inside the square area, check if their name is different from Custodis or Ignis (they are arena specific enemies that should be ignored by the teleport function), randomize a location with a x or y variation starting from square.exitpos coordinates, and teleport everyone at the same time. It does function properly most of the times, but sometimes it simply ignores some creatures that should be affected but teleport others.
What's wrong here that may cause this variaton?
Get every creature inside the square area, check if their name is different from Custodis or Ignis (they are arena specific enemies that should be ignored by the teleport function), randomize a location with a x or y variation starting from square.exitpos coordinates, and teleport everyone at the same time. It does function properly most of the times, but sometimes it simply ignores some creatures that should be affected but teleport others.
What's wrong here that may cause this variaton?
LUA:
function teleportAll()
local square = {
frompos = {x = 1230, y = 849, z = 14},
topos = {x = 1258, y = 872, z = 14},
exitpos = {x = 1144, y = 859, z = 14}
}
for a = square.frompos.x, square.topos.x do
for b = square.frompos.y, square.topos.y do
local pos = {x = a, y = b, z = 14, stackpos = 255}
local creature = getTopCreature(pos)
if creature and creature.uid > 0 then
if getCreatureName(creature.uid) ~= "Custodis" and getCreatureName(creature.uid) ~= "Ignis" then
variationX = math.random(-8,8)
variationY = math.random(-8,8)
square.exitpos.x = square.exitpos.x + variationX
square.exitpos.y = square.exitpos.y + variationY
doTeleportThing(creature.uid, square.exitpos)
doSendMagicEffect(square.exitpos, 41)
end
end
end
end
end
teleportAll()