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

Lua Script Error :/

Ray Rewind

Doctor
Joined
Jun 6, 2009
Messages
1,348
Reaction score
75
Location
Germany
I get this error

Code:
[12/11/2013 13:58:08] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/wote/addmonster.lua:39: 'end' expected (to close 'function' at line 9) near '<eof>'
[12/11/2013 13:58:08] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/wote/addmonster.lua)
[12/11/2013 13:58:08] data/actions/scripts/quests/wote/addmonster.lua:39: 'end' expected (to close 'function' at line 9) near '<eof>'
[12/11/2013 13:58:08] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/wote/addmonster.lua:39: 'end' expected (to close 'function' at line 9) near '<eof>'
[12/11/2013 13:58:08] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/wote/addmonster.lua)
[12/11/2013 13:58:08] data/actions/scripts/quests/wote/addmonster.lua:39: 'end' expected (to close 'function' at line 9) near '<eof>'

PHP:
-- Config #1 --
local tpin = {{x=1233, y=1233, z=11}, {x=1233, y=1233, z=11}}
local tpout = {{x=1255, y=1255, z=9}, {x=1255, y=1255, z=9}}
local glo = {x=123, y=123, z=11}

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid == 45500 then
        doTransformItem(item.uid, item.itemid - 5)
        doCreatureSay(cid, "Snake God Essence has spawned", TALKTYPE_ORANGE_1)
        doCreateMonster("Snake God Essence", {x= 1303, y= 1468, z= 7})

local function fixGlobe()
    doItemSetAttribute(getTileItemById(glo, 9767).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  
   
   
    end
    return TRUE
end

The Script should do like this.


IF player use ITEM with UID 45500 --- Boss Snake God Essence will spawn and TP outside will remove so nobody can enter the room where people fight the boss.

and nobody can use the item before the snake god died !
 
I think I solved it. Try it:

Code:
-- Config #1 --
local tpin = {{x=1233, y=1233, z=11}, {x=1233, y=1233, z=11}}
local tpout = {{x=1255, y=1255, z=9}, {x=1255, y=1255, z=9}}
local glo = {x=123, y=123, z=11}

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.actionid == 45500 then
        doTransformItem(item.uid, item.itemid - 5)
        doCreatureSay(cid, "Snake God Essence has spawned", TALKTYPE_ORANGE_1)
        doCreateMonster("Snake God Essence", {x= 1303, y= 1468, z= 7})
    end
   
    local function fixGlobe()
    doItemSetAttribute(getTileItemById(glo, 9767).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
 
[16/11/2013 17:12:07] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/wote/addmonster.lua:38: 'end' expected (to close 'function' at line 9) near '<eof>'
[16/11/2013 17:12:07] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/wote/addmonster.lua)
[16/11/2013 17:12:07] data/actions/scripts/quests/wote/addmonster.lua:38: 'end' expected (to close 'function' at line 9) near '<eof>'
[16/11/2013 17:12:07] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/wote/addmonster.lua:38: 'end' expected (to close 'function' at line 9) near '<eof>'
[16/11/2013 17:12:07] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/wote/addmonster.lua)
[16/11/2013 17:12:07] data/actions/scripts/quests/wote/addmonster.lua:38: 'end' expected (to close 'function' at line 9) near '<eof>'
 
Can you explain better what it should do?
1. Player use item with uid 45500.
- You mean like a lever? So it doesn't need to be in the script because it's already in actions.xml?

2. Tp outside will be removed so no one can enter.
- The tp people use to get in the room? How does removing the tp prevents people from entering when people first have to click use on an item to remove the tp, or do you mean other people shouldn't be able to enter when people are fighting the monster, but they can all enter before the monsters is spawned?
- Should the tp be created again after a certain time? or when the monster dies?
- Should there be a teleport that will be created when the monster dies for people to go out?
 
I will explain it for you @Limos

There is a room with a teleporter which leads to another room inside this room will be an item. If the item is used the teleport outside will dissappear so nobody can enter the fight (Like yalahar quest ) . When the boss died the teleport from outside will appear again after the teleport which is created by the dead boss disappears. PS ITEM in fight room can't be used again to spawn another boss while the boss is in the room
 
Well im trying to do it since it dont sounds complicated, im not really good so i dont know if it will work :p,

Creaturescripts (Monster make a teleport when die, remember to add the event to the Monster)

Code:
function onDeath(cid, corpse, killer)
    registerCreatureEvent(cid, "Hiportal")
    local creaturename = getCreatureName(cid)

    local NewTp    = {x = 1662, y = 961, z = 9, stackpos=1} --- Position of the Created Portal
    local TpTo    = {x = 1656, y = 1004, z = 9, stackpos=1} --- Destination of the Portal
    local sto = 20380 --- Storage when boss is spawned
    local tpID      = 1387
    local doEffect  = CONST_ME_TELEPORT --- Effect New Portal
    local message    = "I'm Done.."

    if creaturename == 'Boss' then              --- Monster Name
            teleport = doCreateTeleport(tpID, TpTo, NewTp)
            doSendMagicEffect(NewTp, doEffect)
            doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
             setPlayerStorageValue(cid, sto, -1)

    end
end

Actions --- (item summon monster...)

Code:
function onUse(cid, item, topos, item2, frompos)

local NewTp = {x = 1662, y = 961, z = 9, stackpos=1} --- Position of the Created Portal
local BossPos = {x=4459, y=4828, z=6} --- Boss Position
local sto = 20180 --- storage when boss spawn
local tpID = 1387
local Puf = CONST_ME_POFF
local removeItem = 0 --- 1 = remove item, 0 = no

    if getPlayerStorageValue(cid, sto) == 1 then
        doPlayerSendCancel(cid, "You already fighting the boss.")
    return true
    end


    if getThingfromPos(NewTp).itemid == tpID then
        doRemoveItem(getThingfromPos(NewTp).uid,1)
          doCreateMonster('BossName', BossPos)  --- Boss Name
        doSendMagicEffect(FerIn, Puf)
                setPlayerStorageValue(cid, sto, 1)
                if removeItem >= 1 then
                    doRemoveItem(item.uid,1)
                end
return true
end
 
Back
Top