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

Lua Ultimate Script I can't get it work :(!

Ray Rewind

Doctor
Joined
Jun 6, 2009
Messages
1,349
Reaction score
76
Location
Germany
Ok let me explain my script which is not working I get no errors aswell xD!

The script should remove the teleport which is outside so nobody can enter the boss fight room also the tp inside the boss side room should be dissappear when the statue in the middle of the fight room is used by X ITEM ( I dunno how to fix this). Well here is the script!

Only thing which is working is that the teleports dissappear when item is used :p

Code:
-- Config #1 --
local tpin = {{x=1166, y=1995, z=14}, {x=1166, y=1995, z=14}}
local tpout = {{x=1157, y=1993, z=15}, {x=1157, y=1993, z=15}}
local glo = {x=1165, y=1998, z=15}

ttime = {10, 30}
local isEvent = 45501;

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid == 12318 then
        doTransformItem(item.uid, item.itemid - 5)
        doCreatureSay(cid, "Snake God Essence has spawned", TALKTYPE_ORANGE_1)
        doCreateMonster("Snake God Essence", {x= 1165, y= 1999, z= 15})
    end
    end

    local function fixGlobe()
    doItemSetAttribute(getTileItemById(glo, 11753).uid, "aid", 45501)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid == 45500 then
        doItemSetAttribute(item.uid, "aid", 45500)
    else
        doCreatureSay(cid, "You have to wait some time before this item will charge.", TALKTYPE_ORANGE_1)
        return;
    end

    local tp = getTileItemById(tpin[1],1387).uid;
    if(tp > 0)then
        doRemoveItem(tp)
    end
    tp = getTileItemById(tpout[1],1387).uid;
    if(tp > 0)then
        doRemoveItem(tp)
    end

    return true
end
 
In the creaturescript you can just add more monsters like I showed in the example.
I edited the action script, now it's also possible to add more monsters there.
Actionid 12318 is now for Snake God Essence and actionid 12319 is now for Scorn of the Emperor. Like this you can add more monsters.
Code:
local config = {
     [12318] = {
       monsterPos = {x = 1165, y = 1999, z = 15},
       monsterName = "Snake God Essence",
       rewardroomTpPos = {x = 1165, y = 1998, z = 15},
       tpPositions = {
         {x = 1166, y = 1995, z = 15},
         {x = 1157, y = 1993, z = 15}
       }
     },
     [12319] = {
       monsterPos = {x = 1165, y = 1999, z = 15},
       monsterName = "Scorn of the Emperor",
       rewardroomTpPos = {x = 1167, y = 1998, z = 15},
       tpPositions = {
         {x = 1166, y = 1995, z = 14},
         {x = 1157, y = 1993, z = 15}
       }
     }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

     i = config[itemEx.actionid]
     if(itemEx.itemid == 11753 and i) then
         if(getTileItemById(i.rewardroomTpPos, 1387).uid > 0) then
             return doPlayerSendCancel(cid, "The "..i.monsterName.." is already killed, go in the teleport to go to the next room.")
         end
         for _, pos in pairs(i.tpPositions) do
             if(getTileItemById(pos, 1387).uid > 0) then
                 doRemoveItem(getTileItemById(pos, 1387).uid, 1)
             else
                 return doPlayerSendCancel(cid, "You need to kill the "..i.monsterName..".")
             end
         end
         doCreatureSay(cid, i.monsterName.." has spawned", TALKTYPE_ORANGE_1)
         doCreateMonster(i.monsterName, i.monsterPos)
     else
         return false
     end
     return true
end
 
Getting this error

Code:
[09/12/2013 13:07:09] [Warning - Event::loadScript] Event onKill not found (data/creaturescripts/scripts/wote/killmonster.lua)


killmonster.lua creature script
Code:
local config = {
    [12318] = {
      monsterPos = {x = 1165, y = 1999, z = 15},
      monsterName = "Scorn of the Emperor",
      rewardroomTpPos = {x = 1165, y = 1998, z = 15},
      tpPositions = {
        {x = 1166, y = 1995, z = 15},
        {x = 1157, y = 1993, z = 15}
      }
    },
    [12319] = {
      monsterPos = {x = 1211, y = 2000, z = 15},
      monsterName = "Spite of the Emperor",
      rewardroomTpPos = {x = 1214, y = 1999, z = 15},
      tpPositions = {
        {x = 1212, y = 1995, z = 14},
        {x = 1209, y = 1992, z = 15}
      }
    },
    [12320] = {
      monsterPos = {x = 1165, y = 2025, z = 15},
      monsterName = "Fury of the Emperor",
      rewardroomTpPos = {x = 1168, y = 2024, z = 15},
      tpPositions = {
        {x = 1173, y = 2034, z = 14},
        {x = 1152, y = 2028, z = 15}
      }
    },
    [12321] = {
      monsterPos = {x = 1212, y = 2024, z = 15},
      monsterName = "Wrath of the Emperor",
      rewardroomTpPos = {x = 1216, y = 2025, z = 15},
      tpPositions = {
        {x = 1215, y = 2030, z = 14},
        {x = 1211, y = 2033, z = 15}
      }
    }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

    i = config[itemEx.actionid]
    if(itemEx.itemid == 11753 and i) then
        if(getTileItemById(i.rewardroomTpPos, 1387).uid > 0) then
            return doPlayerSendCancel(cid, "The "..i.monsterName.." is already killed, go in the teleport to go to the next room.")
        end
        for _, pos in pairs(i.tpPositions) do
            if(getTileItemById(pos, 1387).uid > 0) then
                doRemoveItem(getTileItemById(pos, 1387).uid, 1)
            else
                return doPlayerSendCancel(cid, "You need to kill the "..i.monsterName..".")
            end
        end
        doCreatureSay(cid, i.monsterName.." has spawned", TALKTYPE_ORANGE_1)
        doCreateMonster(i.monsterName, i.monsterPos)
    else
        return false
    end
    return true
end
 
The script I edited is the action script, you can see this at the the main function: function onUse, which means it's an action script.

The other script, with main function onKill, is a creaturescripts and should be added with type kill in creaturescripts.xml
The reason for this error is because now you tried to add an action script as a creaturescript with type kill, so it looks for the main function onKill.
 
Do you get errors?
It shouldn't be able to crash after entering a teleport, so check if you did the positions correct and give more info about what you did.
 
Okay so I changed everything as you stated above and inside the whole Thread if you want I can post all my things which are requierd. The creature script made my players not dieable
 
@Limos
sorry for answering that late!

Okay first my Actions


The numbers inside [ ] these brackets are used for the pillars
Code:
local config = {
    [12318] = {
      monsterPos = {x = 1165, y = 1999, z = 15},
      monsterName = "Scorn of the Emperor",
      rewardroomTpPos = {x = 1165, y = 1998, z = 15},
      tpPositions = {
        {x = 1166, y = 1995, z = 15},
        {x = 1157, y = 1993, z = 15}
      }
    },
    [12319] = {
      monsterPos = {x = 1211, y = 2000, z = 15},
      monsterName = "Spite of the Emperor",
      rewardroomTpPos = {x = 1214, y = 1999, z = 15},
      tpPositions = {
        {x = 1212, y = 1995, z = 14},
        {x = 1209, y = 1992, z = 15}
      }
    },
    [12320] = {
      monsterPos = {x = 1165, y = 2025, z = 15},
      monsterName = "Fury of the Emperor",
      rewardroomTpPos = {x = 1168, y = 2024, z = 15},
      tpPositions = {
        {x = 1173, y = 2034, z = 14},
        {x = 1152, y = 2028, z = 15}
      }
    },
    [12321] = {
      monsterPos = {x = 1212, y = 2024, z = 15},
      monsterName = "Wrath of the Emperor",
      rewardroomTpPos = {x = 1216, y = 2025, z = 15},
      tpPositions = {
        {x = 1215, y = 2030, z = 14},
        {x = 1211, y = 2033, z = 15}
      }
    }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

    i = config[itemEx.actionid]
    if(itemEx.itemid == 11753 and i) then
        if(getTileItemById(i.rewardroomTpPos, 1387).uid > 0) then
            return doPlayerSendCancel(cid, "The "..i.monsterName.." is already killed, go in the teleport to go to the next room.")
        end
        for _, pos in pairs(i.tpPositions) do
            if(getTileItemById(pos, 1387).uid > 0) then
                doRemoveItem(getTileItemById(pos, 1387).uid, 1)
            else
                return doPlayerSendCancel(cid, "You need to kill the "..i.monsterName..".")
            end
        end
        doCreatureSay(cid, i.monsterName.." has spawned", TALKTYPE_ORANGE_1)
        doCreateMonster(i.monsterName, i.monsterPos)
    else
        return false
    end
    return true
end

Code:
    <action fromaid="12318" toaid="12321" event="script" value="quests/wote/spawnmonster.lua"/>


Now my creature script

Code:
local config = {
    [12318] = {
      monsterPos = {x = 1165, y = 1999, z = 15},
      monsterName = "Scorn of the Emperor",
      rewardroomTpPos = {x = 1165, y = 1998, z = 15},
      tpPositions = {
        {x = 1166, y = 1995, z = 15},
        {x = 1157, y = 1993, z = 15}
      }
    },
    [12319] = {
      monsterPos = {x = 1211, y = 2000, z = 15},
      monsterName = "Spite of the Emperor",
      rewardroomTpPos = {x = 1214, y = 1999, z = 15},
      tpPositions = {
        {x = 1212, y = 1995, z = 14},
        {x = 1209, y = 1992, z = 15}
      }
    },
    [12320] = {
      monsterPos = {x = 1165, y = 2025, z = 15},
      monsterName = "Fury of the Emperor",
      rewardroomTpPos = {x = 1168, y = 2024, z = 15},
      tpPositions = {
        {x = 1173, y = 2034, z = 14},
        {x = 1152, y = 2028, z = 15}
      }
    },
    [12321] = {
      monsterPos = {x = 1212, y = 2024, z = 15},
      monsterName = "Wrath of the Emperor",
      rewardroomTpPos = {x = 1216, y = 2025, z = 15},
      tpPositions = {
        {x = 1215, y = 2030, z = 14},
        {x = 1211, y = 2033, z = 15}
      }
    }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

    i = config[itemEx.actionid]
    if(itemEx.itemid == 11753 and i) then
        if(getTileItemById(i.rewardroomTpPos, 1387).uid > 0) then
            return doPlayerSendCancel(cid, "The "..i.monsterName.." is already killed, go in the teleport to go to the next room.")
        end
        for _, pos in pairs(i.tpPositions) do
            if(getTileItemById(pos, 1387).uid > 0) then
                doRemoveItem(getTileItemById(pos, 1387).uid, 1)
            else
                return doPlayerSendCancel(cid, "You need to kill the "..i.monsterName..".")
            end
        end
        doCreatureSay(cid, i.monsterName.." has spawned", TALKTYPE_ORANGE_1)
        doCreateMonster(i.monsterName, i.monsterPos)
    else
        return false
    end
    return true
end

inside login.lua

Code:
registerCreatureEvent(cid, "Killmonster")

and as in creature script

Code:
    <event type="kill" name="Killmonster" event="script" value="killmonster.lua"/>
 
Back
Top