• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Anihilator problem

maguito123

New Member
Joined
Aug 17, 2012
Messages
17
Reaction score
0
Hello, I have problem, when players use Anihilator the monster don't appear.

In console get this error:

Code:
[Error - Action - Interface]
data/actions/scripts/anihilator.lua:onUse
Description:
<luaDoCrateNpc> Npc with name 'Demon' not found
I/O warning: failed to load external entity data/npc/demon.lua

Here is my anihilator.lua

Code:
local room = {  -- room with demons
                fromX = 1580,
                fromY = 1469,
                fromZ = 5,
                --------------
                toX = 1583,
                toY = 1473,
                toZ = 5
                }

                local monster_pos = {
                [1] = {pos = {1580, 1469, 5}, monster = "Demon"},
                [2] = {pos = {1582, 1469, 5}, monster = "Demon"},
                [3] = {pos = {1577, 1471, 5}, monster = "Demon"},
                [4] = {pos = {1584, 1471, 5}, monster = "Demon"},
                [5] = {pos = {1585, 1471, 5}, monster = "Demon"},
                [6] = {pos = {1581, 1473, 5}, monster = "Demon"},
                [7] = {pos = {1583, 1473, 5}, monster = "Demon"}
                }

                local players_pos = {
                {x = 1565, y =1471, z = 5, stackpos = 253},
                {x = 1564, y =1471, z = 5, stackpos = 253},
                {x = 1563, y =1471, z = 5, stackpos = 253},
                {x = 1562, y =1471, z = 5, stackpos = 253}
                }

                local new_player_pos = {
                {x = 1583, y = 1471, z = 5},
                {x = 1582, y = 1471, z = 5},
                {x = 1581, y = 1471, z = 5},
                {x = 1580, y = 1471, z = 5}
                }

                local playersOnly = "no"
                local questLevel = 5

                ------------------------------------------------------
                --- 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, MESSAGE_EVENT_ORANGE, "Only players can do this quest.")
                                                                end
                                                else
                                                                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "All Players have to be level "..questLevel.." to do this quest.")
                                                end
                                else
                                                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE," 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, MESSAGE_EVENT_ORANGE, "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

I'm using Tfs 0.3.6

I'm not using tfs 0.4 anymore because in my computer get error all time
 
Haha my old anihilator script, glad to see it again. I guess the function doSummonCreature try to summon a npc and not a creature, check how to summon a creature in 0.3.6 and replace the function.
 
Back
Top