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

Quest lever with check item and check monsters

konceptz

New Member
Joined
Apr 8, 2009
Messages
17
Reaction score
0
I was trying to make a script that checks if the player has an item on a certain coordinate and also check if all the monsters are dead in the area, if both checks are true then pulling the lever will cause the wall/stone to disappear. I have a script that does remove the stone if the player pays an item, I just dont' know how to incorporate the two checks =/

This is the script that I was able to find, however, giving me an error:

Code:
--- CONFIG START ---
local itemPos = {x=607, y=382, z=11} -- position of the "itemId"
local itemId = 6300 -- itemID required on "itemPos"
local monster = Minion of Oblivion -- only one monster name, the boss
local arenax = 569,607
local arenay = 378,386
local z = 11
local addItem = 5072 -- item being added couple of seconds after pulling the lever
local pos = {x=608, y=381, z=11, stackpos=1} -- position of the item being added and removed
---- CONFIG END ---

function m(cid)
        isnofence = getGlobalStorageValue(9888)
        if isnofence == 1 then      
        doCreateItem(addItem,1,pos)
        setGlobalStorageValue(9888, -1)
        end
end

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

    if item.uid == 9888 and item.itemid == 1945 then
                Apo = 0
                playersInArena = 0;
                for arenax = arenax do
                    for arenay = arenay do
                        arenapos = {x=arenax, y=arenay, z=z, stackpos=253}
                        arenacreature = getThingfromPos(arenapos)

                        if isPlayer(arenacreature.uid) == 1 then
                            playersInArena =  playersInArena + 1
                           
                        elseif isCreature(arenacreature.uid) == 1 then
                          if getCreatureName(arenacreature.uid) == "monster" then
                          Apo = 1
                          end
                        end
                    end
                end
                if Apo == 0 then
            local thing = getTileItemById(itemPos, itemId)
                if thing.uid > 0 then
                    isnofence = getGlobalStorageValue(9888)
                        get1 = getThingfromPos(pos)
                        if isnofence == -1 then
                        doRemoveItem(get1.uid,1)
                        setGlobalStorageValue(9888, 1)
                        addEvent(m,30000,cid)      
                        end
                else
                doPlayerSendCancel(cid, "Defeat your enemy first!")
                end
                doTransformItem(item.uid,1946)  
    elseif item.uid == 9888 and item.itemid == 1946 then
                 doTransformItem(item.uid,1945)
    else
        return 0
    end

    return 1
end

function getTileItemById(pos, itemid)
    pos.stackpos = 0
    local thing = getThingfromPos(pos)
    while thing.uid > 0 and thing.itemid ~= itemid do
        pos.stackpos = pos.stackpos + 1
        thing = getThingfromPos(pos)
    end
   
    return thing
end

The error giving in the console is:
Code:
data/actions/scripts/quests/oblivionminion.lua:4: '=' expected near 'Oblivion'
 
Last edited:
i didn't read your script, only console error...
try do this:


change this at line 4

Code:
local monster = "Minion of Oblivion" -- only one monster name, the boss

and change this at line 34

Code:
if getCreatureName(arenacreature.uid) == monster then

if you get any other error, post here...
 
Last edited:
still get the similar console error after I add the ""

Code:
data/actions/scripts/quests/oblivionminion.lua:25: ',' expected near 'do'
 
First, those variables:

local arenax = 569,607
local arenay = 378,386

What they are? :p And why is there comma (',')

Second:

how look 'for' statement:
for i = 0, 10 do (will be executed 10x)
 
First, those variables:

local arenax = 569,607
local arenay = 378,386

What they are? :p And why is there comma (',')

Second:

how look 'for' statement:
for i = 0, 10 do (will be executed 10x)

Uh the:

Code:
local arenax = 569,607

is so it checks from x cord 569 to x cord 607, correct me if i'm wrong but that's just the way I logical thought of it.

I'm not really sure how to fix this now =/
 
Here's the error i'm getting:

Code:
data/actions/scripts/quests/oblivionminion.lua:72: 'end' expected (to close 'function' at line 20) near '<eof>'

I just added an end tho, and it's not giving the console error. However, script doesn't work when i kill the monster and pull the lever.
 
Last edited:
Back
Top