mRefaat
Marketing and Coding
Hello,
When I try to modify position in the script I get this error
this is the script without any errors
When I try to change this part
to be like this
i get this error
can someone tell me what is the problem? i want to add range from z to z also
also i want to ask with this part mean ?
using tfs 0.3.7 rev 5969
When I try to modify position in the script I get this error
this is the script without any errors
Lua:
local t = {
arena = {
{x = 1532, y = 2618, z = 7}, -- North west Corner of Arena
{x = 1552, y = 2638, z = 7}, -- South East corner of Arena
{x = 1542, y = 2627, z = 7} -- Center of Arena
},
minPlayers = 1, -- min players required to start the battle
noPlayers = 1, -- Leave it as it is
prize = {6527} -- Reward that player recives
}
local kick = 0
function onThink()
local arenaPlayers = {}
for x = t.arena[1].x, t.arena[2].x do
for y = t.arena[1].y, t.arena[2].y do
for z = t.arena[1].z, t.arena[2].z do
local pos = {x = x, y = y, z = z}
local n = getTileInfo(pos).creatures
if n ~= 0 then
pos.stackpos = 1
local c = getThingfromPos(pos)
while c.uid ~= 0 do
if c.itemid == 1 and c.type == 1 then
table.insert(arenaPlayers, c.uid)
if #arenaPlayers == n then
break
end
end
pos.stackpos = pos.stackpos + 1
c = getThingfromPos(pos)
end
end
end
end
end
if #arenaPlayers == 1 then
local p = getPlayerMasterPos(arenaPlayers[1])
doTeleportThing(arenaPlayers[1], p)
doSendMagicEffect(p, CONST_ME_TELEPORT)
doPlayerSendTextMessage(arenaPlayers[1], MESSAGE_STATUS_CONSOLE_BLUE, "You have won the event and received your reward.")
doBroadcastMessage(getCreatureName(arenaPlayers[1]) .." won a Last Man Standing Event.")
doPlayerAddItem(arenaPlayers[1], t.prize[math.random(#t.prize)], 10)
kick = 0
elseif #arenaPlayers > 1 then
if kick == 0 then
kick = os.time()
else
if os.time() - kick >= 840 then
kick = 0
for i = 1, #arenaPlayers do
doTeleportThing(arenaPlayers[i], {x=2001, y=2030, z=7})
doPlayerSendTextMessage(arenaPlayers[i], MESSAGE_STATUS_WARNING, "Too even, try harder next time.")
end
end
end
elseif #arenaPlayers == 0 then
kick = 0
end
return true
end
When I try to change this part
Lua:
arena = {
{x = 1532, y = 2618, z = 7}, -- North west Corner of Arena
{x = 1552, y = 2638, z = 7}, -- South East corner of Arena
{x = 1542, y = 2627, z = 7} -- Center of Arena
},
to be like this
Code:
arena = {
{x = 1532, y = 2618, z = 6}, -- North west Corner of Arena
{x = 1552, y = 2638, z = 8}, -- South East corner of Arena
{x = 1542, y = 2627, z = 7} -- Center of Arena
},
i get this error
Code:
[15:57:03.539] [Error - GlobalEvent Interface]
[15:57:03.544] data/globalevents/scripts/arena.lua:onThink
[15:57:03.550] Description:
[15:57:03.551] data/globalevents/scripts/arena.lua:21: attempt to index a boolean value
[15:57:03.559] stack traceback:
[15:57:03.561] data/globalevents/scripts/arena.lua:21: in function <data/globalevents/scripts/arena.lua:14>
[15:57:03.571] [Error - GlobalEvents::think] Couldn't execute event: arena
can someone tell me what is the problem? i want to add range from z to z also
also i want to ask with this part mean ?
Code:
if kick == 0 then
kick = os.time()
else
using tfs 0.3.7 rev 5969