potinho
Intermediate OT User
Hello how are you?
I have this script that I copied from anihilator and I'm using it as a boss room, it works great for 4 players. However, I would like to increase the number of tiles, but it would still be possible to enter the room with any amount of players (4 or more), could you help me to fix the code for this?
My actual boss room:

I pretend to use like this, but still goes with 4, 5, 6, 7 or 8 players.

This my actual script
I have this script that I copied from anihilator and I'm using it as a boss room, it works great for 4 players. However, I would like to increase the number of tiles, but it would still be possible to enter the room with any amount of players (4 or more), could you help me to fix the code for this?
My actual boss room:

I pretend to use like this, but still goes with 4, 5, 6, 7 or 8 players.

This my actual script
Lua:
function onUse(cid, item, frompos, item2, topos)
if item.uid == 9102 then
local count = 0
local config = {
questLevel = 100,
playerPositions = {
{start = {x=1893, y=447, z=11}, destination = {x=1801, y=472, z=9}},
{start = {x=1894, y=447, z=11}, destination = {x=1802, y=472, z=9}},
{start = {x=1895, y=447, z=11}, destination = {x=1803, y=472, z=9}},
{start = {x=1896, y=447, z=11}, destination = {x=1804, y=472, z=9}}
},
spawnMonsters = {
{position = {x=1812, y=452, z=9}, monster = "Ulquiorra"}
}
}
local players = {}
for i = 1, #config.playerPositions do
local pid = getTopCreature(config.playerPositions[i].start)
if pid.uid > 0 then
if isPlayer(pid.uid) then
if getPlayerLevel(pid.uid) >= config.questLevel then
table.insert(players, pid.uid)
end
end
end
end
if #players == #config.playerPositions then
for i = 1, #players do
doTeleportThing(players[i], config.playerPositions[i].destination)
doSendMagicEffect(config.playerPositions[i].destination, CONST_ME_TELEPORT)
end
for v = 1, #config.spawnMonsters do
doSummonCreature(config.spawnMonsters[v].monster, config.spawnMonsters[v].position)
doSendMagicEffect(config.spawnMonsters[v].position, CONST_ME_TELEPORT)
end
else
doPlayerSendCancel(cid, "Sorry, not possible.")
end
return true
end
end