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

Windows NPC Error

Zatyrax

Photoshop-er!
Joined
May 14, 2010
Messages
54
Reaction score
0
Hello! I am getting an error, dont know what it is, or if i just should ignore it. Using TFS 0.3.6.

Here is the error:

[01/06/2010 18:17:25] [Error - Npc interface]
[01/06/2010 18:17:25] (Unknown script file)
[01/06/2010 18:17:25] Description:
[01/06/2010 18:17:25] data/npc/lib/npcsystem/modules.lua:1156: bad argument #2 to 'error' (number expected, got string)
[01/06/2010 18:17:25] stack traceback:
[01/06/2010 18:17:25] [C]: in function 'error'
[01/06/2010 18:17:25] data/npc/lib/npcsystem/modules.lua:1156: in function 'callbackOnBuy'
[01/06/2010 18:17:25] data/npc/lib/npcsystem/npchandler.lua:263: in function 'processModuleCallback'
[01/06/2010 18:17:25] data/npc/lib/npcsystem/npchandler.lua:440: in function 'onBuy'
[01/06/2010 18:17:25] data/npc/lib/npcsystem/modules.lua:1292: in function <data/npc/lib/npcsystem/modules.lua:1291>

Dont know when its happening, but i guess its when a player tries to do something with a NPC. :)

EDIT: Also my anni quest dont work, here is the error:

[01/06/2010 16:15:18] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/annihilator.lua:5: '}' expected (to close '{' at line 1) near 'entry'
[01/06/2010 16:15:18] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/annihilator.lua)
[01/06/2010 16:15:18] data/actions/scripts/quests/annihilator.lua:5: '}' expected (to close '{' at line 1) near 'entry'

And here is my annihilator.lua:
Code:
local config = {
	daily = "no", -- allow only one enter per day? (like in global Tibia)
	level = 100,
	storage = 30015
	entry =
	{
		{x = 1028, y = 1152, z = 15},
		{x = 1027, y = 1152, z = 15},
		{x = 1026, y = 1152, z = 15},
		{x = 1025, y = 1152, z = 15}
	},
	destination =
	{
		{x = 1042, y = 1152, z = 15},
		{x = 1043, y = 1152, z = 15},
		{x = 1044, y = 1152, z = 15},
		{x = 1045, y = 1152, z = 15}
	}
}

config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(config.daily) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		else
			doTransformItem(item.uid, item.itemid - 1)
		end

		return true
	end

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

	local players = {}
	for _, position in ipairs(config.entry) do
		local pid = getTopCreature(position).uid
		if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			return true
		end

		table.insert(players, pid)
	end

	for i, pid in ipairs(players) do
		doSendMagicEffect(config.entry[i], CONST_ME_POFF)
		doTeleportThing(pid, config.destination[i], false)
		doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
	end

	doTransformItem(item.uid, item.itemid + 1)
	return true
end
 
annihilator.lua
Lua:
        local room = {     -- room with demons
        fromX = 960,
        fromY = 946,
        fromZ = 12,
        --------------
        toX = 967,
        toY = 954,
        toZ = 12
        }

        local monster_pos = {
        [1] = {pos = {960, 946, 12}, monster = "Demon"},
        [2] = {pos = {960, 949, 12}, monster = "Demon"},
        [3] = {pos = {960, 952, 12}, monster = "Demon"},
        [4] = {pos = {967, 946, 12}, monster = "Demon"},
        [5] = {pos = {967, 949, 12}, monster = "Demon"},
        [6] = {pos = {967, 952, 12}, monster = "Demon"}
        }

        local players_pos = {
        {x = 1028, y = 1152, z = 15, stackpos = 253},
        {x = 1027, y = 1152, z = 15, stackpos = 253},
        {x = 1026, y = 1152, z = 15, stackpos = 253},
        {x = 1025, y = 1152, z = 15, stackpos = 253}
        }

        local new_player_pos = {
        {x = 1042, y = 1152, z = 15},
        {x = 1043, y = 1152, z = 15},
        {x = 1044, y = 1152, z = 15},
        {x = 1045, y = 1152, z = 15}
        }

        local playersOnly = "yes"
        local questLevel = 100

        ------------------------------------------------------
        --- 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[i] = getThingfromPos(players_pos[i])
                        if player[i].itemid > 0 then
                                if string.lower(playersOnly) == "yes" then
                                        if isPlayer(player[i].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[i] = getThingfromPos(players_pos[i])
                                if isPlayer(player[i].uid) == TRUE then
                                        if getPlayerLevel(player[i].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[i], CONST_ME_POFF)
                                                doTeleportThing(player[i].uid, new_player_pos[i], FALSE)
                                                doSendMagicEffect(new_player_pos[i], 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

Use this, and edit the rom with demons just, and remember to use the singel reward :p
 
Last edited:
annihilator.lua
Lua:
        local room = {     -- room with demons
        fromX = 960,
        fromY = 946,
        fromZ = 12,
        --------------
        toX = 967,
        toY = 954,
        toZ = 12
        }

        local monster_pos = {
        [1] = {pos = {960, 946, 12}, monster = "Demon"},
        [2] = {pos = {960, 949, 12}, monster = "Demon"},
        [3] = {pos = {960, 952, 12}, monster = "Demon"},
        [4] = {pos = {967, 946, 12}, monster = "Demon"},
        [5] = {pos = {967, 949, 12}, monster = "Demon"},
        [6] = {pos = {967, 952, 12}, monster = "Demon"}
        }

        local players_pos = {
        {x = 1028, y = 1152, z = 15, stackpos = 253},
        {x = 1027, y = 1152, z = 15, stackpos = 253},
        {x = 1026, y = 1152, z = 15, stackpos = 253},
        {x = 1025, y = 1152, z = 15, stackpos = 253}
        }

        local new_player_pos = {
        {x = 1042, y = 1152, z = 15},
        {x = 1043, y = 1152, z = 15},
        {x = 1044, y = 1152, z = 15},
        {x = 1045, y = 1152, z = 15}
        }

        local playersOnly = "yes"
        local questLevel = 100

        ------------------------------------------------------
        --- 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[i] = getThingfromPos(players_pos[i])
                        if player[i].itemid > 0 then
                                if string.lower(playersOnly) == "yes" then
                                        if isPlayer(player[i].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[i] = getThingfromPos(players_pos[i])
                                if isPlayer(player[i].uid) == TRUE then
                                        if getPlayerLevel(player[i].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[i], CONST_ME_POFF)
                                                doTeleportThing(player[i].uid, new_player_pos[i], FALSE)
                                                doSendMagicEffect(new_player_pos[i], 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

Use this, and edit the rom with demons just, and remember to use the singel reward :p

I dont understand how to use this script, what to change and so on to make it work for me :/ I am having 2 anni quests on my server, 1 with demon adn 1 with orshabaals. Can you help me over Teamview again? Would be great :)
 
Back
Top