• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Lua [0.X] Anihilator summon monster like NPC error

potinho

Well-Known Member
Joined
Oct 11, 2009
Messages
1,192
Solutions
17
Reaction score
92
Location
Brazil
Good morning people, everything fine? Looking at my server logs, I noticed something strange: an error in the anihilator lever script, where it tries to summon the demon as an NPC. I've been using the script for over a year and it seems to have always worked fine. I don't have duplicate ActionID, has anyone experienced this or can help me?

2022-09-11 22:14:25 - [Error - Action Interface]
2022-09-11 22:14:25 - data/actions/scripts/annihilator.lua:eek:nUse
2022-09-11 22:14:25 - Description:
2022-09-11 22:14:25 - (luaDoCreateMonster) Cannot create monster: Demon
2022-09-11 22:14:25 - [Warning - Npc::createNpc] Cannot find npc with name: Demon.
2022-09-11 22:14:25 -
2022-09-11 22:14:25 - [Error - Action Interface]
2022-09-11 22:14:25 - data/actions/scripts/annihilator.lua:eek:nUse
2022-09-11 22:14:25 - Description:
2022-09-11 22:14:25 - (luaDoCreateNpc) Npc with name 'Demon' not found
2022-09-11 22:14:25 -
2022-09-11 22:14:25 - [Error - Action Interface]
2022-09-11 22:14:25 - data/actions/scripts/annihilator.lua:eek:nUse
2022-09-11 22:14:25 - Description:
2022-09-11 22:14:25 - (luaDoCreateMonster) Cannot create monster: Demon
2022-09-11 22:14:25 - [Warning - Npc::createNpc] Cannot find npc with name: Demon.
2022-09-11 22:14:25 -
2022-09-11 22:14:25 - [Error - Action Interface]
2022-09-11 22:14:25 - data/actions/scripts/annihilator.lua:eek:nUse
2022-09-11 22:14:25 - Description:
2022-09-11 22:14:25 - (luaDoCreateNpc) Npc with name 'Demon' not found
2022-09-11 22:14:25 -
2022-09-11 22:14:25 - [Error - Action Interface]
2022-09-11 22:14:25 - data/actions/scripts/annihilator.lua:eek:nUse
2022-09-11 22:14:25 - Description:
2022-09-11 22:14:25 - (luaDoCreateMonster) Cannot create monster: Demon
2022-09-11 22:14:25 - [Warning - Npc::createNpc] Cannot find npc with name: Demon.
2022-09-11 22:14:25 -
2022-09-11 22:14:25 - [Error - Action Interface]
2022-09-11 22:14:25 - data/actions/scripts/annihilator.lua:eek:nUse
2022-09-11 22:14:25 - Description:
2022-09-11 22:14:25 - (luaDoCreateNpc) Npc with name 'Demon' not found
2022-09-11 22:14:25 -
2022-09-11 22:14:25 - [Error - Action Interface]
2022-09-11 22:14:25 - data/actions/scripts/annihilator.lua:eek:nUse
2022-09-11 22:14:25 - Description:
2022-09-11 22:14:25 - (luaDoCreateMonster) Cannot create monster: Demon
2022-09-11 22:14:25 - [Warning - Npc::createNpc] Cannot find npc with name: Demon.
2022-09-11 22:14:25 -
2022-09-11 22:14:25 - [Error - Action Interface]
2022-09-11 22:14:25 - data/actions/scripts/annihilator.lua:eek:nUse
2022-09-11 22:14:25 - Description:
2022-09-11 22:14:25 - (luaDoCreateNpc) Npc with name 'Demon' not found
2022-09-11 22:14:25 -
2022-09-11 22:14:25 - [Error - Action Interface]
2022-09-11 22:14:25 - data/actions/scripts/annihilator.lua:eek:nUse
2022-09-11 22:14:25 - Description:
2022-09-11 22:14:25 - (luaDoCreateMonster) Cannot create monster: Demon
2022-09-11 22:14:25 - [Warning - Npc::createNpc] Cannot find npc with name: Demon.
2022-09-11 22:14:25 -
2022-09-11 22:14:25 - [Error - Action Interface]
2022-09-11 22:14:25 - data/actions/scripts/annihilator.lua:eek:nUse
2022-09-11 22:14:25 - Description:
2022-09-11 22:14:25 - (luaDoCreateNpc) Npc with name 'Demon' not found

Lua:
function onUse(cid, item, frompos, item2, topos)
    if item.uid == 9006 then
        local count = 0
        local config = {
            questLevel = 100,
            playerPositions = {
                {start = {x=191, y=118, z=9}, destination = {x=191, y=118, z=10}},
                {start = {x=192, y=118, z=9}, destination = {x=192, y=118, z=10}},
                {start = {x=193, y=118, z=9}, destination = {x=193, y=118, z=10}},
                {start = {x=194, y=118, z=9}, destination = {x=194, y=118, z=10}}
            },
            spawnMonsters = {
                {position = {x=195, y=118, z=10}, monster = "Demon"},
                {position = {x=196, y=118, z=10}, monster = "Demon"},
                {position = {x=194, y=120, z=10}, monster = "Demon"},
                {position = {x=192, y=120, z=10}, monster = "Demon"},
                {position = {x=189, y=118, z=10}, monster = "Demon"},
                {position = {x=191, y=116, z=10}, monster = "Demon"},
                {position = {x=193, y=116, z=10}, monster = "Demon"}
            }
        }
        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
    elseif item.uid == 9007 then
        queststatus = getPlayerStorageValue(cid,5000)
        if queststatus == -1 then
            doPlayerSendTextMessage(cid,22,"You have found a demon armor.")
            doPlayerAddItem(cid,2494,1)
            setPlayerStorageValue(cid,5000,1)
        else
            doPlayerSendTextMessage(cid,22,"It is empty.")
        end
    elseif item.uid == 9008 then
        queststatus = getPlayerStorageValue(cid,5000)
        if queststatus == -1 then
            doPlayerSendTextMessage(cid,22,"You have found a magic sword.")
            doPlayerAddItem(cid,2400,1)
            setPlayerStorageValue(cid,5000,1)
        else
            doPlayerSendTextMessage(cid,22,"It is empty.")
        end
    elseif item.uid == 9009 then
        queststatus = getPlayerStorageValue(cid,5000)
        if queststatus == -1 then
            doPlayerSendTextMessage(cid,22,"You have found a stonecutter axe.")
            doPlayerAddItem(cid,2431,1)
            setPlayerStorageValue(cid,5000,1)
        else
            doPlayerSendTextMessage(cid,22,"It is empty.")
        end
    elseif item.uid == 9010 then
        queststatus = getPlayerStorageValue(cid,5000)
        if queststatus == -1 then
            doPlayerSendTextMessage(cid,22,"You have found thunder hammer.")
            doPlayerAddItem(cid,2421,1)
            setPlayerStorageValue(cid,5000,1)
        else
            doPlayerSendTextMessage(cid,22,"It is empty.")
        end
    end
    local itemId = item.itemid
    if itemId == 1945 or itemId == 1946 then
        doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
    end
    return true
end
 
Solution
use doCreateMonster(name, pos[, extend = false[, force = false[, displayError = true]]])
instead of doSummonCreature(name, pos)

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,245
Solutions
545
Reaction score
4,487
use doCreateMonster(name, pos[, extend = false[, force = false[, displayError = true]]])
instead of doSummonCreature(name, pos)
 
Solution
Top