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

Help with these anni chests please!

D_Evans89

Member
Joined
Dec 3, 2014
Messages
175
Reaction score
12
I'm using TFS 0.2.13
I can't find a script so you can only open one chest though..
I'm using this script for the lever and monsters:

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

        -- Annihaltor by Maxi (Shawak) v1.0

        local room = {     -- room with demons
        fromX = 33219,
        fromY = 31659,
        fromZ = 13,
        toX = 33224,
        toY = 31659,
        toZ = 13
        }

        local monster_pos = {        
        [1] = {pos = {33219,31657,13}},
        [2] = {pos = {33221,31657,13}},
        [3] = {pos = {33220,31661,13}},
        [4] = {pos = {33222,31661,13}},
        [5] = {pos = {33223,31659,13}},
        [6] = {pos = {33224,31659,13}}
        }

        local players_pos = {
        {x = 33225,y = 31671,z = 13,stackpos = 253},
        {x = 33224,y = 31671,z = 13,stackpos = 253},
        {x = 33223,y = 31671,z = 13,stackpos = 253},
        {x = 33222,y = 31671,z = 13,stackpos = 253}
        }

        local new_player_pos = {
        {x = 33222, y = 31659, z = 13},
        {x = 33221, y = 31659, z = 13},
        {x = 33220, y = 31659, z = 13},
        {x = 33219, y = 31659, z = 13}
        }

        local monster = "Demon"
        local questLevel = 100


        -- don't touch ------------
        local player = {0, 0, 0, 0}
        local all_ready = 0
        ---------------------------

        local player1 = getThingfromPos(players_pos[1])
        local player2 = getThingfromPos(players_pos[2])
        local player3 = getThingfromPos(players_pos[3])
        local player4 = getThingfromPos(players_pos[4])

        if item.itemid == 1945 then
                if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then
                        for i = 1, 4 do
                                player[i] = getThingfromPos(players_pos[i])
                                if player[i].itemid > 0 then
                                        all_ready = 1
                                end
                        end
                else    
                doPlayerSendTextMessage(cid,19,"You need 4 players to do this quest.")
                end
                if all_ready == 1 then
                        for _, area in pairs(monster_pos) do
                                doSummonCreature(monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]}) 
                        end
                        for i = 1, 4 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)
                                all_ready = 0
                        end
                        doTransformItem(item.uid,1946)
                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,19,"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
                        player_room = 0
                        doTransformItem(item.uid,1945)
                end
        end
        return TRUE
end
 
So basically you need a script that does this..
Code:
local queststatus = getPlayerStorageValue(cid,6076)
function onUse(cid, item, fromPosition, itemEx, toPosition)
     if item.uid == 2000 then
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a demon armor.")
         doPlayerAddItem(cid,2494,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
       end
     elseif item.uid == 2001 then
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a  magic sword.")
         doPlayerAddItem(cid,2400,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
       end
     elseif item.uid == 2002 then
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a stonecutter axe.")
         doPlayerAddItem(cid,2431,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
     end
     elseif item.uid == 2003 then
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a present.")
         doPlayerAddItem(cid,1990,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
       end
   end
     return 1
end
 
Add it with uniqueid 2000, 2001, 2002 and 2003 in actions.xml and add those uniqueids in the chests, don't add actionids.
This needs to be under function onUse btw, because of the cid parameter.
Code:
local queststatus = getPlayerStorageValue(cid,6076)
 
Add it with uniqueid 2000, 2001, 2002 and 2003 in actions.xml and add those uniqueids in the chests, don't add actionids.
This needs to be under function onUse btw, because of the cid parameter.
Code:
local queststatus = getPlayerStorageValue(cid,6076)
Like this?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
     if item.uid == 2000 then
     queststatus = getPlayerStorageValue(cid,6076)
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a demon armor.")
         doPlayerAddItem(cid,2494,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
       end
     elseif item.uid == 2001 then
     queststatus = getPlayerStorageValue(cid,6076)
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a  magic sword.")
         doPlayerAddItem(cid,2400,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
       end
     elseif item.uid == 2002 then
     queststatus = getPlayerStorageValue(cid,6076)
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a stonecutter axe.")
         doPlayerAddItem(cid,2431,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
     end
     elseif item.uid == 2003 then
     queststatus = getPlayerStorageValue(cid,6076)
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a present.")
         doPlayerAddItem(cid,1990,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
       end
   end
     return 1
end

--edit derp. I should've seen that last night. :P
 
No, right under function onUse, not under the if statement.
Derp Derp Derp. Both ways would work though, right? :p
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
   local queststatus = getPlayerStorageValue(cid,6076)
     if item.uid == 2000 then
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a demon armor.")
         doPlayerAddItem(cid,2494,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
       end
     elseif item.uid == 2001 then
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a  magic sword.")
         doPlayerAddItem(cid,2400,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
       end
     elseif item.uid == 2002 then
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a stonecutter axe.")
         doPlayerAddItem(cid,2431,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
     end
     elseif item.uid == 2003 then
       if queststatus == -1 then
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a present.")
         doPlayerAddItem(cid,1990,1)
         setPlayerStorageValue(cid,6076,1)
       else
         doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty.")
       end
   end
     return 1
end
 
Write this code into Notepad++, creating a .lua file. It will help you learn:

qye4oz.jpg
 
Last edited:
Only if there is a specific uniqueid used in the script and there isn't, so you can use any uniqueid.
Just the Lua script name and uniqueid in actions.xml and the uniqueid in the lever will be enough.
 
Back
Top