• 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 System for 7.4 Realots

ScorpionOT

uber n00b
Joined
Mar 28, 2015
Messages
417
Solutions
6
Reaction score
137
Lua:
-- Author:        Rodrigo (Nottinghster) - (OTLand, OTFans, XTibia, OTServBR)
-- Country:       Brazil
-- From:        Tibia World RPG OldSchool
-- Email:        [email protected]
-- Compiler:   Tibia World Script Maker (Action)
-- ScorpionOT
-- 4360 4368 4363 quest
-- 4329 pick
-- 4328 stepin
-- 4369 dead tree
-- check id for pick @ mintwallin
-- dmg formulas check
-- rest of ids check
local q_vars = {
                               --//////////////////////////////// Rookgaard --
   [1004] = {{2530},{2480}}, -- copper shield, legion helmet
   
   [1005] = {{2088,1,4603}}, -- silver key
   [1006] = {{2412}}, -- katana
   [1007] = {{2473}}, -- viking helmet
   
   [1008] = {{itemid=2545,type=4},{itemid=2544,type=10}}, -- 4 arrows, 10 poison
   [1009] = {{itemid=2395}}, -- carlin sword
   [1010] = {{itemid=2580}}, -- fishing rod
   
   [1022] = {{2050}}, -- torch
   [1023] = {{itemid=2384}}, -- rapier quest
   
   [1024] = {{2597,1}}, --letter
   [1025] = {{2668,6}}, --salmon
   
   [9910] = {{2676}}, -- banana facc
   [9911] = {{2676}}, -- banana pacc
   
   ---   goblin temple quest
   [9912] = {{itemid=2642, type=1}, {itemid=1294, type=5}, {itemid=2148, type=100}}, -- sandal, 5 stones, 100 gp
   [9913] = {{itemid=2563, type=1}, {itemid=2111, type=4}, {itemid=2006, type=6}}, -- pan, 4 snowball, milk
   --- end ---
   
   [9914] = {{2404}}, -- combat knife
   [9915] = {{2559}}, -- small axe inside rots from KatanaQuest
   
   [10022] = {{1950,text="Hardek *\nBozo *\nSam ****\nOswald\nPartos ***\nQuentin *\nTark ***\nHarsky ***\nStutch *\nFerumbras *\nFrodo **\nNoodles ****"}},
   [10023] = {{2089,1,4601}}, -- Carlin graveyard key
   [10024] = {{itemid=2464}}, -- chain armor
   [10025] = {{itemid=2460}}, -- brass helmet
   [10026] = {{itemid=2544,type=12},{itemid=2148,type=40}}, -- 12 arrows and 40 gp
   [10027] = {{2485}}, -- doublet
   [10028] = {{2103}}, -- honey flower
   
                               --//////////////////////////////// Venore --
   [3500] = {{2322},{2162}}, -- Voodoo doll + magic lightwand
   
   [3501] = {{2143},{2320},{2129},{2213}}, -- white pearl + skull of ratha + wolf tooth chain + dwarven ring
   [3502] = {{2144,2},{2125},{2148,100}}, -- 2 black pearl + 100 gp + crystal necklace,
   
   [3503] = {{2134},{2147,2},{2145,3}}, -- Silver brooch Quest + 2 small rubies + 3 small diamonds
   [3504] = {{2162},{2208},{2260}}, -- Orc Shaman Quest -- magic lightwand, axe ring, blank rune
   
   [10032] = {{2798}}, -- blood herb quest
   
   --Dragon tower
   [3505] = {{2146,2},{2546,30},{2545,60},{2148,100}}, -- 2 small sapphires, 30 burst, 60 poison, 100 gp
   [3506] = {{2456},{2006,7},{2006,10}}, -- bow, lifefluid, manafluid
   
   [10039] = {{2169}}, -- time ring
   [10040] = {{2198,50}}, -- elven amulet
   [10041] = {{2192}}, -- crystal ball
   
                               --//////////////////////////////// Carlin --
   [3520] = {{2092,1,3520}}, -- Carlin graveyard key
   [4506] = {{2318,1}}, -- carlin Family Brooch Quest
   [4507] = {{2076,1}}, -- Carlin Fanfare
   
   [4501] = {{2089,1,4501}}, -- Alawar key 2 minoroom
   [4502] = {{2490},{2410,4},{2260,1},{2160,33},{2089,1,4502}}, -- Alawar key 2 Alawar treasure room
   [4503] = {{2088,1,4503}}, -- Alawar key 2 pick firefield
   [4504] = {{2143,3}}, -- Alawar Chest - 3 white pearl
   [4505] = {{2413,1}}, -- Alawar Chest - 1 broad sword
   
   [4511] = {{2203,1}}, -- Femor hills - power ring
   [4512] = {{2172,200}}, -- Femor hills - bronze ammy
   
   -- Next to Demona
   [10062] = {{2533}}, -- griffin shield
   [10063] = {{2435}}, -- dwarven axe
   [10064] = {{2425}}, -- obsidian lance
   
   [10079] = {{4847}}, -- spectral dress
   
                               --//////////////////////////////// Ab'Dendriel --
                               
   -- Orc Fortress
   [10029] = {{2392}}, -- fire sword
   [10030] = {{2430}}, -- knight axe
   [10031] = {{2476}}, -- knight armor
   
   -- Elvenbane
   [10053] = {{2175,1},{2145,2},{2148,100}}, -- spellbook, diamond, gps
   [10054] = {{2006,7},{2260,1}}, -- manafluid, blank
   [10055] = {{2394}}, -- morning star
   [10056] = {{2525}}, -- dwarven shield
   
                               --////////////////////////////////Thais --
   [1658] = {{2378,1}}, -- battle axe -- Sewers
   [1659] = {{2417,1}}, -- battle hammer -- Light Tower
   [1660] = {{2521,1}}, -- dark shield -- Light Tower
   
   [1662] = {{2456},{2545,5},{2006,7},{2006,10}}, -- dead archer quest (bow, 5poison, mf, lf)
   
   [10014] = {{2091,1,3980}}, -- Fibula golden key
   [10015] = {{2528,1}}, -- tower shield -- Fibula
   [10016] = {{2475,1}}, -- warrior helmet -- Fibula
   [10017] = {{2430,1}}, -- knight axe -- Fibula
   [10018] = {{2213,1}}, -- dwarven ring -- Fibula
   [10019] = {{2198,50}}, -- elven amulet 50 -- Fibula
   
   [10042] = {{2491,1}}, -- crown helmet -- Noble Armor Mintwallin
   [10043] = {{2486,1}}, -- noble armor -- Noble Armor Mintwallin
   [10059] = {{2197,5}}, -- stone skin amulet -- Mad Mage Room Mintwallin
   [10058] = {{2662,1}}, -- magician hat -- Mad Mage Room Mintwallin
   [10060] = {{2131,1}}, -- star amulet -- Mad Mage Room Mintwallin
   
   [3601] = {{2088,1,3600}}, -- Ghoul Room key -- skeleton body
   [3602] = {{2199,150},{2209,1}}, -- garlic necklace, club ring -- Mintwallin Ghoul Room Quest
   
   [3610] = {{2088,1,3610}}, -- key to secret lab -- Mintwallin Cycs Quest aka Moving Wall lever
   [3611] = {{2145,1}}, -- Diamond Next To key -- Mintwallin Cyclops Treasure
   [3613] = {{2462},{2381},{2146,4}}, -- devil helmet, halberd, sapphires -- Mintwallin Lab Treasure  
   [3667] = {{2088,1,3667}}, -- Mintwallin Cyclops Quest key to diamond -- after Mad Mage room
   
   [3614] = {{2147,2}}, -- 2 small rubies -- Ancient Temple south drags  
   [3616] = {{2168},{2201,200}}, -- Ancient Temple Life ring Quest
   
   [3617] = {{2146},{2145},{2213}}, -- sapphire, diamond, dwarven ring -- Geomancer Quest
   [3618] = {{2465},{2460},{2388},{2399,4}}, -- brass armor, brass helmet, hatchet, throwing stars -- Old Mintwallin Quest
   [3619] = {{2399,10}}, -- throwing stars Mintwallin Quest
   [3620] = {{2383,1}}, -- Spike sword Quest
   
   [10061] = {{2483,1}}, -- scale armor -- near AT
   [10065] = {{2426,1}}, -- naginata -- Deep Ancient Temple North
                               --////////////////////////////////Jakundaf --
   [4510] = {{2146,2},{2213},{2199,150}}, -- Triangle tower -- garlic necklace, dwarven ring, 2 small sapphires
   [3621] = {{2088,1,4055}}, -- Silver Key 4055 for Panpipe quest
   [3622] = {{2074},{2150,2},{2166}}, -- Panpipe quest, panpipes, 2 amethyst, power ring
   
   
                               --////////////////////////////////Plains of Havoc --
   [3301] = {{2089,1,3301}},
   [3302] = {{2088,1,3302}},
   [3303] = {{2089,1,3303}},
   [3304] = {{2091,1,3304}},
                               
   [4513] = {{2377}}, -- two handed sword
   [4514] = {{2547,5},{2546,12}}, -- power bolt, burst arrow -- add brown bag as item id
   [4515] = {{1955,text="... the dream master retreated to the world behind the curtains of awareness, I can't reach him, now that the last hall of dreams is lost to the forces of evil. I sealed Goshnar's grave so no one can enter the pits without knowing our secret. I will try to retreat to Knightwatch Tower and wait for a dreamer in possession of the key. So we can travel on one of the dream paths to a saver place to regroup and to plan a counter-attack. I fear we have to recruit new members and we have only little time left to train them. I hope Taciror will not waste our last forces in a futile attack on the Ruthless Seven. Our order has never truly recovered from the losses in our war against Goshnar and his undead hordes. Now that our leaders and best warriors have died in the attack on the demonic forces, we don't stand a chance against our enemies. Our only hope is to gather new forces and to recapture the chamber of dreams. Of course I know the right method to distract Hugo long enough to get past him. The dream master is important to teach our recruits in the old ways and in the art of dreamwalking. We need a leader for our cause and we need him badly. Headless we will fail and fall. It is already uncertain who took the Nightmare Chronicles out of the pits and I have no idea where they are hidden. They are fighting about power and influence but unity is the key to success. Our whole order is centred about unity. All our rituals and procedures rooted on unity and sharing, they can't neglect that."}},
   [4516] = {{2169},{2152,5},{2199,150},{2175},{2071}}, -- time ring, 5plat, garlick, spellbook, lyre- add red bag as item id
   [4518] = {{2397},{2459},{2268,1}}, -- iron helmet, sd -- pendin questfix
   
   [4520] = {{2151},{2321},{2148,100}}, -- giant smithshammer, talon, 100 gp
   [10080] = {{2237, 2238, 2236}},
   
                               --////////////////////////////////Kazordoon --
   [3800] = {{2148,56}},
   [3801] = {{2148,47}},
   [3802] = {{2457,1}},
   [3803] = {{1949,text="Looks like the fox is out!\nMore luck next time!\nSigned:\nthe horned fox"}},
   
   [3804] = {{2397},{2560}}, -- long sword, mirror
   [3805] = {{2260,3},{2108}}, -- blank rune,3 - wooden doll (need to unstack runes or add cpp)
   [3806] = {{2121},{2148,76}}, -- wedding ring - gold coin 76
   
   [3807] = {{2422}}, -- iron hammer
   
   [3808] = {{2089,1,3800}}, -- copper key
   [3809] = {{2089,1,3801}}, -- copper key
   [3810] = {{2687,7},{2687,20},{2089,1,3802}}, -- 27 cookies + prison key
   
   -- circle room
   [3812] = {{2435}}, -- dwarven axe
   [3813] = {{2391}}, -- war hammer
   
   [10034] = {{2947}}, -- crusader helmet
   
   [10089] = {{2503}}, -- dwarven armor
   
                               --//////////////////////////////// Darashia --
   
   --northeast mino tower
   [3900] = {{2165,1}}, -- stealth ring
   [3901] = {{2200,250}}, -- protection amulet
   [10066] = {{2463}}, -- plate armor
   [10033] = {{2536},{2436},{2656}}, -- medusa shield, skull staff, blue robe
   
                               --//////////////////////////////// Port Hope --
                               
   [1035] = {{4850}}, -- hydra egg
   [1036] = {{3956,2}}, -- elephant tusks
                               
                               --//////////////////////////////// Ankrahmun --
   
   [3700] = {{2143,1}}, -- white pearl -- sepertine tower
   
                               --//////////////////////////////// Edron --
   [1015] = {{2006,7},{2006,7},{2006,7},{2006,7},{2006,7},{2273,3}}, -- triple uh
   
   [1018] = {{2432}}, -- fire axe
   [1019] = {{2214,1},{2201,200},{2145,7}}, -- extra box = roh, dragoneck+7 diamonds
   
   [1030] = {{2429},{2419}},
   [1031] = {{2143,3},{2148,100},{2148,75}},
   
   -- 2x hero quest
   [4522] = {{2209}}, -- club ring
   [4523] = {{2156}}, -- red gem
   
   [1033] = {{2260},{2260},{2260}}, -- 3 blank runes - Orc Cave
   [1034] = {{2411},{2411},{2545,30}}, -- 2 poison dagger, 30 poison arrows (in backpack)
   [4521] = {{2489}}, -- dark armor - Orc Cave
   
   -- hero cave
   [1016] = {{2534}}, -- Vampire shield
   [1017] = {{2414}}, -- Dragon Lance
   [1032] = {{2174},{2144},{2194}}, -- strange symbol, black pearl, mysterious fetish
   
    -- Troll cave
   [1026] = {{2478}}, -- brass legs
   [1027] = {{2199}}, -- garlic necklace
   
   -- goblin cave
   [1028] = {{2509}}, -- steel shield
   [1029] = {{2170}}, -- silver ammy
   
   -- key 6010 for dq
   [10057] = {{2091,1,6010},{2230},{2165},{2151},{2229}} -- goldenkey 6010 + bone,stealth ring,2talons,skull brown bag at Parchment Room Treasure -- pending 10084 for movement parchment
}
local q_msg_vars = {
   [1004] = {empty="The dragon corpse is empty",find="You have found a bag."},
   [1005] = {empty="The slain skeleton is empty"},
   [1006] = {empty="The dead human body is empty",find="You have found a katana sword."},
   
   [9910] = {empty="The palm is empty"},
   [9911] = {empty="The palm is empty"},
   
   [10028] = {empty="The heaven blossom is empty"},
   [4518] = {text={2598,"Dear Muriel!\nMy apprentice behaves strangely lately.\nI fear he has something evil in mind.\nHe must have stolen the books about\nnecromancy you were missing after\nour last visit but I have no proof yet.\nThank the gods he does not know about\nthe fountain of life and the caves of\ninferno yet. I will send Laira to town in\nsome days. I think she's in danger\nif I'm right about Porgol.\n \nYour friend,\nArcian"}},
   [10080] = {text={2325,"<the text seems to be a mostly ruined diary of some sort, found on the body of a dead monk. Most passages make no sense at all to you>\n... abbot still clueless abour my ...\n...\nAfter all those perils and puzzels I have located the throne of darkness at last. I will lead ...\n...\n... crypts and monsters ... found one of the caged demons that seem to be leached as a powersupply of some sort ...\n...\n... switches on the end of the scorpion path and the lair of the wicked web ... \n... died but I could make it to the throne. My wards are holding the howling ghosts and spectres at bay for now and I prepare to unleash the powers of the throne ... \n...\n... still impossible! My wards are fading and the ancient spirits feel that they will soon claim another victory. I failed the brotherhood and will soon join the howling hords in their eternal torment and madness. ...\n...\nhas stoped. I KNOW they are coming after me now. I can see the flickering of the shadows as they aproach. THEY ARE COMING"}}, --
   -- Thais
   [1658] = {empty="The dead skeleton is empty"},
   [1659] = {empty="The chest is empty"},
   [1660] = {empty="The chest is empty"}
}
function copyItem(item)
   if(item.uid and isContainer(item.uid) == TRUE) then
       uid = copyContainer(item.uid, item.itemid)
       if item.actionid > 0 then
           doSetItemActionId(uid, item.actionid)
       end
       return uid
   else
       i_id = 100
       if(item.itemid) then
           i_id = item.itemid
       elseif(item[1]) then
           i_id = item[1]
       end
       
       i_type = 1
       if(item.type) then
           i_type = item.type
       elseif(item[2]) then
           i_type = item[2]
       end
       return doCreateItemEx(i_id, i_type)
   end
end
function copyContainer(uid, itemid)
    local container = doCreateItemEx(itemid, 1)
    local iterator = getContainerSize(uid)
    while iterator > 0  do
        iterator = iterator - 1
        doAddContainerItemEx(container, copyItem(getContainerItem(uid, iterator)))
    end
    return container
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
--   return FALSE
    if item.uid < 65535 and item.uid ~= 0 then
       local q_items = q_vars[item.uid]
       local q_texts = q_msg_vars[item.uid]
       local items = {}
       local item_in = {}
       local item_slot = 1
       local item_to_give = 0
       local item_desc = ''
       local boxcheck = false
       if(not q_items) then
           doPlayerSendCancel(cid, "404: QUEST NOT FOUND. Contact admin please.")
           return TRUE
       end
               
       if(#q_items > 0) then
           while(true) do
               if(#q_items >= item_slot) then
                   table.insert(items, q_items[item_slot])
               else
                   break
               end
               item_slot = item_slot+1
           end
       else
           while(true) do
               item_in = getContainerItem(item.uid, item_slot)
               in_id = 100
               if(item_in.itemid)then
                   in_id = item_in.itemid
               elseif(item_in[0]) then
                   in_id = item_in[1]
               end
               if in_id > 0 then
                   table.insert(items, item_in)
               else
                   break
               end
               item_slot = item_slot+1
           end
       end
       msg_empty = "It is empty."
       if(q_texts and q_texts.empty ~= nil) then
           msg_empty = q_texts.empty
       end
       
       if(#items == 0 or getPlayerStorageValue(cid, item.uid) ~= -1)then
           if(getPlayerAccess(cid) >= 3) then
               setPlayerStorageValue(cid, item.uid, -1)
           end
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg_empty)
           --setPlayerStorageValue(cid, item.uid, -1)
           return TRUE
       end
        if getPlayerStorageValue(cid, item.uid) ~= 1 then
            if #items == 0 then
                item_to_give = doCreateItemEx(item.uid)
                item_desc = getItemNameById(item.uid)
            elseif #items == 1 then
                item_to_give = copyItem(items[1])
               
               in_id = 100
               if(items[1].itemid)then
                   in_id = items[1].itemid
               elseif(items[1][1]) then
                   in_id = items[1][1]
               end
               
               r_desc = getItemDescriptions(in_id)
               r_type = 1
               if(items[1].type) then
                   r_type = items[1].type
               elseif(items[1][2]) then
                   r_type = items[1][2]
               end
               r_actionid = 0
               if(items[1].actionid and items[1].actionid > 0) then
                   r_actionid = items[1].actionid
               elseif(items[1][3]) then
                   r_actionid = items[1][3]
               end
               if(r_actionid > 0) then
                   doSetItemActionId(item_to_give, r_actionid)
               end
                   
               if(items[1].text and items[1].text ~= "") then
                   if(isInArray({1950,1955,2598,1949},in_id)) then
                       doSetItemText(item_to_give,items[1].text)
                   end
               end
               
               item_desc = getItemNameById(in_id)
               if(r_desc.plural ~= r_desc.name and r_type > 1
                   and in_id ~= 2006) then
                   item_desc = r_desc.plural
               end
               if(in_id == 2006 or r_type == 1 and r_desc.article ~= nil) then
                   item_desc = r_desc.article .. " " .. item_desc
               end
            else
                if #items <= 8 then
                    item_to_give = doCreateItemEx(1987, 1)
                else
                    item_to_give = doCreateItemEx(1988, 1)
                end
                local n = 0
                local uid = 0
                for i=1, #items do
                    n = #items - i + 1
                    uid = copyItem(items[n])
                       
                   in_id = 100
                   if(items[n].itemid)then
                       in_id = items[n].itemid
                   elseif(items[n][1]) then
                       in_id = items[n][1]
                   end
               
                   r_desc = getItemDescriptions(in_id)
                   r_type = 1
                   if(items[n].type) then
                       r_type = items[n].type
                   elseif(items[n][2]) then
                       r_type = items[n][2]
                   end
                   
                   r_actionid = 0
                   if(items[n].actionid and items[n].actionid > 0) then
                       r_actionid = items[n].actionid
                   elseif(items[n][3]) then
                       r_actionid = items[n][3]
                   end
                    if(r_actionid > 0) then
                        doSetItemActionId(uid, r_actionid)
                    end
                   
                   if(items[n].text and items[n].text ~= "") then
                       if(isInArray({1950,1955,2598,1949},in_id)) then
                           doSetItemText(uid,text)
                       end
                   end
                   
--                   print()
                   item_name = getItemNameById(in_id)
                   item_article = ""
                   if(r_desc.plural ~= r_desc.name and r_type > 1
                       and in_id ~= 2006 and r_type ~= 100) then
                       item_name = r_desc.plural
                   end               
                   if(in_id == 2006 or r_type == 1 and r_desc.article ~= nil) then
                       item_article = r_desc.article .. " "
                   elseif(r_type > 1) then
                       local a_articles = {"a few", "some", "many", "a bunch of"}
                       an_article = "a few"
                       if(r_type >= 9 and r_type < 41) then
                           an_article = "some"
                       end
                       if(r_type >= 41 and r_type < 71) then
                           an_article = "many"
                       end
                       if(r_type >= 100) then
                           an_article = "a pile of "
                       elseif(r_type >= 71) then
                           an_article = "a bunch of"
                       end
                       item_article = an_article .. " "
                   end
                   item_name = item_article .. item_name
                   item_desc = item_name .. item_desc                       
                    if i ~= #items then
                        item_desc = ", " .. item_desc
                    end
                   doAddContainerItemEx(item_to_give, uid)
                end
            end
            if doPlayerAddItemEx(cid, item_to_give, 0) == RETURNVALUE_NOERROR then
               msg_find = 'You have found ' .. item_desc .. '.'
               if(q_texts) then
                   if(q_texts.find ~= nil) then
                       msg_find = q_texts.find
                   end
                   
                   if(q_texts.text ~= nil) then
                       myitem = q_texts.text
                       if(myitem and myitem[2] ~= "") then
                           item_to_give = copyItem(myitem)
                           
                           in_id = myitem[1]
                           r_type = 1                       
                           doSetItemText(item_to_give,myitem[2])
                           doPlayerAddItemEx(cid, item_to_give, 0)
                       end
                   end
               end
               doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, msg_find)
                setPlayerStorageValue(cid, item.uid, 1)
                --[[if item.uid < 2000 then
                   setPlayerStorageValue(cid, 1000, getPlayerStorageValue(cid,1000)+1)
                end--]]
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'The ' .. item_desc .. ' is too heavy or you have not enough space.')
            end
        end
    end
    return TRUE
end

Don't know why I credited Rodrigo for the script, as I did it myself. Guess I used a base of one of his codes, so I decided to leave it on top. Will explain how to use it later, when I have a little bit more free time. Just wanted to publish this code meanwhile, for everybody to use. Feel free to flame/support/give suggestions.
 
I don't get it, why not use the usual quest script that is based on the content of the containers?
 
Easier management, less prone to faults I'd say. Also because I couldn't find Colandus' chest system, it didn't work, or just didn't bother to use it. This also contains 100% 7.4 and 7.72 chestboxes, except some in Tiquanda and Jakundaf Epic Quest.
 
Well thanks for the release I guess, but I don't agree on easier management, I mean what is there to manage once quests are implemented?
 
Having to load the map, look for the quest boxes, whereas here it's all nicely documented and fitted into a lua text document.
 
Back
Top