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

Anni Problem

Jordon123

New Member
Joined
Apr 16, 2009
Messages
19
Reaction score
0
Positions are right but when there's 4 characters on the tiles and when you click the lever it just says "Sorry not possible." and nothing happens. Here's what it says in the server console or what ever.

[04/02/2010 13:03:33] [Error - Action Interface]
[04/02/2010 13:03:33] data/actions/scripts/quests/annihilator.lua:eek:nUse
[04/02/2010 13:03:33] Description:
[04/02/2010 13:03:33] data/actions/scripts/quests/annihilator.lua:48: attempt to index field '?' (a number value)
[04/02/2010 13:03:33] stack traceback:
[04/02/2010 13:03:33] data/actions/scripts/quests/annihilator.lua:48: in function <data/actions/scripts/quests/annihilator.lua:28>

This is my action.xml, pretty sure thats right though.

<action actionid="30015" event="script" value="quests/annihilator.lua"/>

Here's my annihilator.lua.

local config = {
daily = "no",
level = 101,
storage = 30015
}

local playerPosition =
{
{x = 511, y = 500, z = 13},
{x = 510, y = 500, z = 13},
{x = 509, y = 500, z = 13},
{x = 508, y = 500, z = 13}
}

local newPosition =
{
{x = 511, y = 419, z = 13},
{x = 510, y = 419, z = 13},
{x = 509, y = 419, z = 13},
{x = 508, y = 419, z = 13}
}

-- Do not modify the declaration lines below.
local players = {}
local failed = true
config.daily = getBooleanFromString(config.daily)

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
if(config.daily) then
doPlayerSendCancel(cid, "Sorry, not possible.")
else
doTransformItem(item.uid, item.itemid - 1)
end

return true
end

if(item.itemid ~= 1945) then
return true
end

for i, pos in ipairs(playerPosition) do
pos.stackpos = STACKPOS_TOP_CREATURE
players = getThingFromPos(playerPosition).uid
if(players > 0 and
isPlayer(players) and
getPlayerStorageValue(players.uid, config.storage) == -1 and
getPlayerLevel(players.uid) >= config.level)
then
failed = false
end

if(failed) then
doPlayerSendCancel(cid, "Sorry, not possible.")
return true
end

failed = true
end

for i, pid in ipairs(players) do
doSendMagicEffect(playerPosition, CONST_ME_POFF)
doTeleportThing(pid, newPosition, false)
doSendMagicEffect(newPosition, CONST_ME_ENERGYAREA)
end

doTransformItem(item.uid, item.itemid + 1)
return true
end

If you know whats up please help me :p

Thanks,
Jordon.
 
fixed
Code:
local config = {
	daily = "no",
	level = 101,
	storage = 30015
}

local playerPosition = {
	{x = 511, y = 500, z = 13},
	{x = 510, y = 500, z = 13},
	{x = 509, y = 500, z = 13},
	{x = 508, y = 500, z = 13}
}

local newPosition = {
	{x = 511, y = 419, z = 13},
	{x = 510, y = 419, z = 13},
	{x = 509, y = 419, z = 13},
	{x = 508, y = 419, z = 13}
}

-- Do not modify the declaration lines below.
local players = {}
local failed = true
config.daily = getBooleanFromString(config.daily)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(config.daily) then
			doPlayerSendCancel(cid, "Sorry, not possible.")
		else
			doTransformItem(item.uid, item.itemid - 1)
		end

		return true
	end

	if(item.itemid ~= 1945) then
		return true
	end

	for i, pos in ipairs(playerPosition) do
		players[i] = getTopCreature(playerPosition[i]).uid
		if(players[i] > 0 and isPlayer(players[i]) and getPlayerStorageValue(players[i], config.storage) == -1 and getPlayerLevel(players[i]) >= config.level) then
			failed = false
		end

		if(failed) then
			doPlayerSendCancel(cid, "Sorry, not possible.")
			return true
		end

		failed = true
	end

	for i, pid in ipairs(players) do
		doSendMagicEffect(playerPosition[i], CONST_ME_POFF)
		doTeleportThing(pid, newPosition[i], false)
		doSendMagicEffect(newPosition[i], CONST_ME_ENERGYAREA)
	end

	doTransformItem(item.uid, item.itemid + 1)
	return true
end
 
Wow, thank you a lot... Do i need a different script for anni demons or should i just add the demons in the spots with mapeditor? Cause I'd prefer having a demon script as well so when a team is done the demons get teleported out to X position if you get what I'm saying :p
 
Anyway you can fix this script for me cutie? ;)

-- Annihilator by Shawak v2.1

-- CONFIG --

local room = { -- room with demons
fromX = 870,
fromY = 1035,
fromZ = 13,
--------------
toX = 875,
toY = 1039,
toZ = 13
}

local monster_pos = {
[1] = {pos = {870, 1035, 13}, monster = "Demon"},
[2] = {pos = {872, 1035, 13}, monster = "Demon"},
[3] = {pos = {871, 1039, 13}, monster = "Demon"},
[4] = {pos = {873, 1039, 13}, monster = "Demon"},
[5] = {pos = {874, 1037, 13}, monster = "Demon"},
[6] = {pos = {875, 1037, 13}, monster = "Demon"}
}

local players_pos = {
{x = 511, y = 500, z = 13, stackpos = 253},
{x = 510, y = 500, z = 13, stackpos = 253},
{x = 509, y = 500, z = 13, stackpos = 253},
{x = 508, y = 500, z = 13, stackpos = 253}
}

local new_player_pos = {
{x = 511, y = 419, z = 13},
{x = 510, y = 419, z = 13},
{x = 509, y = 419, z = 13},
{x = 508, y = 419, z = 13}
}

local playersOnly = "yes"
local questLevel = 45

------------------------------------------------------
--- CONFIG END ---------------------------------------
------------------------------------------------------

function onUse(cid, item, fromPosition, itemEx, toPosition)
local all_ready, monsters, player, level = 0, 0, {}, 0
if item.itemid == 1945 then
for i = 1, #players_pos do
table.insert(player, 0)
end
for i = 1, #players_pos do
player = getThingfromPos(players_pos)
if player.itemid > 0 then
if string.lower(playersOnly) == "yes" then
if isPlayer(player.uid) == TRUE then
all_ready = all_ready+1
else
monsters = monsters+1
end
else
all_ready = all_ready+1
end
end
end
if all_ready == #players_pos then
for i = 1, #players_pos do
player = getThingfromPos(players_pos)
if isPlayer(player.uid) == TRUE then
if getPlayerLevel(player.uid) >= questLevel then
level = level+1
end
else
level = level+1
end
end
if level == #players_pos then
if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then
for _, area in pairs(monster_pos) do
doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
end
for i = 1, #players_pos do
doSendMagicEffect(players_pos, CONST_ME_POFF)
doTeleportThing(player.uid, new_player_pos, FALSE)
doSendMagicEffect(new_player_pos, CONST_ME_ENERGYAREA)
doTransformItem(item.uid,1946)
end
else
doPlayerSendTextMessage(cid,19,"Only players can do this quest.")
end
else
doPlayerSendTextMessage(cid,19,"All Players have to be level "..questLevel.." to do this quest.")
end
else
doPlayerSendTextMessage(cid,19,"You need "..table.getn(players_pos).." players to do this quest.")
end
elseif item.itemid == 1946 then
local player_room = 0
for x = room.fromX, room.toX do
for y = room.fromY, room.toY do
for z = room.fromZ, room.toZ do
local pos = {x=x, y=y, z=z,stackpos = 253}
local thing = getThingfromPos(pos)
if thing.itemid > 0 then
if isPlayer(thing.uid) == TRUE then
player_room = player_room+1
end
end
end
end
end
if player_room >= 1 then
doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.")
elseif player_room == 0 then
for x = room.fromX, room.toX do
for y = room.fromY, room.toY do
for z = room.fromZ, room.toZ do
local pos = {x=x, y=y, z=z,stackpos = 253}
local thing = getThingfromPos(pos)
if thing.itemid > 0 then
doRemoveCreature(thing.uid)
end
end
end
end
doTransformItem(item.uid,1945)
end
end
return TRUE
end
 
Back
Top