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

TFS 1.X+ Lion's Rock Quest - Script Issues+Improvements

Elvarion

Member
Joined
Apr 14, 2010
Messages
99
Reaction score
13
[TFS 1.3] Using this Distro but with an updated map for 10.98
This script came with the Distro I downloaded and I am trying to make it work like Retail since it was a bit choppy and missing parts originally.
Im been out of the OT Game for quite some time so alot of the coding is new to me but ive been chipping away at this script for some time now trying to fix it.
Some parts of the script are giving me a bit of trouble and would like some insight on how to fix my issues.

This became quite the long post. But I wanted to make sure it was as detailed and explained as possible. Sorry for the long read.
If anything is unclear (hopefully not) just ask and I will try and do a better job explaining.

Lion's Rock Quest on Retail

Quick Rundown of Quest
  • Pickup Flower - Works
  • Pickup Water - Works
  • Loot Dead Explorer for "Old Parchment (Brown)" - Script triggers, But does not contain text inside the scroll. (Is this named "Lion's Rock Three Tests (Book)" on Retail?)
  • Use Flower>Basin - Works. Missing part to change Pyramid into Lit up Pyramid > change back after some time?
  • Use Water>Pedestal - Works. ^
  • Use Cobra>Statue - Works. ^
(You can do these 3 in any order and the last one will display the text "You have now passed the last test to enter the inner sanctum." Instead of the last part with "The light in the small pyramid nearby begins to shine.") So to make this just like real it would need to check if you have done the other 2 before and change messages according to progression.
  • Enter Inner Sanctum after all 3 Tasks completed - Works
  • Exit Inner Sanctum - Missing, not gotten to that yet. I could just use a simple teleport script for this, since you need to do quest steps to even get in.
  • Break Amphora - Works. Missing part to change Amphora into broken version > Should respawn after some time also?
  • Translate Scroll 4 different steps - Works
  • Place Gems to Spawn Fountain and Use for Reward - Works. Fountain should transform back into Rubble after you have gotten reward. Also missing spawning of Fires when placing Gems, Fires should also decay after a bit.
  • You then get 1 random piece of treasure from a list of 6 items. If you have the Noble Lion mount you are unable to get the Lion's Heart.
  • Possible to do the reward once every 24h - Untested at the moment if this works.

There is alot of comments in the script ive added for myself and also for how the script is supposed to be when working as intended.

Here are the Action+Movement.xml lines
XML:
    <!-- Lions Rock Quest -->
    <action itemid="23760" script="quests/lions rock/lionRock.lua" /> <!--Flower-->
    <action itemid="23835" script="quests/lions rock/lionRock.lua" /> <!--Water-->
    <action itemid="10551" script="quests/lions rock/lionRock.lua" /> <!--Cobra-->
    <action fromaid="41354" toaid="41357" script="quests/lions rock/lionRock.lua" /> <!--UsingItems-->

    <!-- Lions Rock Quest -->
    <movevent event="StepIn" fromaid="41344" toaid="41349" script="others/quests/lionRock.lua" />

Action part of the script
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local itemEx = target

    -- Flower
    if item.actionid == 41354 then
        if player:getStorageValue(lionrock.storages.getFlower) < 1 then
            player:addItem(lionrock.items.flower)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You picked a beautiful lion's mane.")
            player:setStorageValue(lionrock.storages.getFlower, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
        return true
    end

    -- Holy Water
    if item.actionid == 41355 then
        if player:getStorageValue(lionrock.storages.getHolyWater) < 1 then -- Getting Holy Water
            player:addItem(lionrock.items.holywater, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took some holy water from the sacred well.")
            player:setStorageValue(lionrock.storages.getHolyWater, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    -- Loot Dead Explorer
    if item.actionid == 41356 then
        if player:getStorageValue(lionrock.storages.skeleton) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found an old parchment.")
            local book = player:addItem(lionrock.items.parchment)
            book:setAttribute(ITEM_ATTRIBUTE_TEXT, "Still it is hard to believe that I finally found the mystical rock formations near Darashia, known as Lion's Rock. According to ancient records there is a temple for an unknown, probably long forgotten deity, built in the tunnels deep below the rock centuries ago. This holy site was once guarded by mystical lions and they may still be down there. But yet I haven't succeeded in entering the inner sanctum. The entrance to the lower temple areas is protected by an old and powerful enchantment. I studied the inscriptions on the temple walls and thus learned that the key to the inner sanctum is the passing of three tests. The first test is the Lion's Strength. In order to honour the site's mystical cats of prey one has to hunt and slay a cobra. The cobra's tongue must be laid down at a stone statue as a sacrifice. The second test is the Lion's Beauty. One has to burn the petals of a lion's mane flower on a coal basin. In the sand at the rock's foot I saw some dried lion's mane petals. Maybe these flowers grow somewhere upwards. The third test is called the Lion's Tears. It seems one has to purify an ornamented stone pedestal with ... At this point the records end because the parchment is destroyed. It seems that is was torn by a big paw...")
            player:setStorageValue(lionrock.storages.skeleton, 1)
            end
    end

    -- Using Flower with Basin
    if item:getId() == lionrock.items.flower and itemEx.actionid == 41340 then
        if player:getStorageValue(lionrock.storages.usedFlower) < 1 then
            player:removeItem(lionrock.items.flower, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You burnt a lion's mane flower. The light in the small pyramid nearby begins to shine.")
            player:setStorageValue(lionrock.storages.usedFlower, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            --Change Pyramid into Light version 33136, 32369, 8 -3709>3710
        end
        return true
    end
 
    -- Using Holy Water with Pedestal
    if item:getId() == lionrock.items.holywater and itemEx.actionid == 41343 then
        if player:getStorageValue(lionrock.storages.usedHolyWater) < 1 then
            player:removeItem(lionrock.items.holywater, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have purified a sacred pedestal with holy water. You have now passed the last test to enter the inner sanctum.")
            player:setStorageValue(lionrock.storages.usedHolyWater, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            --Change Pyramid into Light version 33156, 32279, 8 -3709>3710
        end
        return true
    end

    -- Using Tongue with Statue
    if item:getId() == lionrock.items.tongue and itemEx.actionid == 41341 then
        if player:getStorageValue(lionrock.storages.usedTongue) < 1 then
            player:removeItem(lionrock.items.tongue, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have sacrificed a cobra tongue at an ancient statue. The light in the small pyramid nearby begins to shine.")
            player:setStorageValue(lionrock.storages.usedTongue, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            --Change Pyramid into Light version 33135, 32289, 8 -3709>3710
        end
        return true
    end

    -- Reward script
   if item.actionid == 41357 then

        if player:getStorageValue(lionrock.storages.playerCanDoTasks) - os.time() > 0 then
           player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Come back after the server save.")
            return false
        end

        if player:getStorageValue(lionrock.storages.translation1) < 1 or player:getStorageValue(lionrock.storages.translation2) < 1 or player:getStorageValue(lionrock.storages.translation3) < 1 or player:getStorageValue(lionrock.storages.translation4) < 1 then
           player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "At the moment there is neither a treasure nor anything else in the fountain. Perhaps you might return later.")
            return false
        end

        -- Player reward
        player:setStorageValue(lionrock.storages.playerCanDoTasks, os.time() + 1 * 24 * 60 * 60 )
        local reward = lionrock.rewards[math.random(#lionrock.rewards)]
        player:addItem(reward.id, 1)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Something sparkles in the fountain's water. You draw out a beautiful and certainly precious amulet.")
        --player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Something sparkles in the fountain's water. You draw out a  '.. ItemType(rewards[random].item):getName() ..'.') --Added to make the script say what item you have obtained. If its the Lions Heart it should say 'You draw out a beautiful and certainly precious amulet.' if not it should just say "You draw out a ITEM"


        -- Reseting tasks
        lionrock.taskactive.ruby = false
        lionrock.taskactive.sapphire = false
        lionrock.taskactive.amethyst = false
        lionrock.taskactive.topaz = false

    -- Ruby
    local redflamePosition = Position(33069, 32298, 9)
    local redItem = Tile(redflamePosition):getItemById(1488) --Does this create a field?
    if redItem then
        redItem:remove()
        --Game.createItem(1488, 1, redflamePosition) Create fields like this?
     
    end

    -- Amethyst
    local yellowflamePosition = Position(33077, 32302, 9)
    local yellowItem = Tile(yellowflamePosition):getItemById(1500)
    if yellowItem then
        yellowItem:remove()
    end

    -- Topaz
    local purpleflamePosition = Position(33077, 32298, 9)
    local purpleItem = Tile(purpleflamePosition):getItemById(7473)
    if purpleItem then
        purpleItem:remove()
    end

    -- Sapphire
    local violetflamePosition = Position(33069, 32302, 9)
    local violetflamePosition = Tile(violetflamePosition):getItemById(8058)
    if violetflamePosition then
        violetflamePosition:remove()
    end
 
        -- Removing Fountain
        local Item = Tile(position(33073, 32300, 9)):getItemById(6390)
        if Item then
        Item:remove()
        -- Stone back;
        Game.createItem(3608, 1, { x=33073, y=32300, z=9})
        end
    end
end

Movement Part
Lua:
function onStepIn(creature, item, position, fromPosition)

    local player = creature:getPlayer()
    if player == nil then
        return true
    end

    if not lionrock.checkPlayerCanEnterMysticFlame(player) then
        if item.actionid == 41344 then
            player:teleportTo(fromPosition, true)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "CANT PASS YET MESSAGE (If there is any).")
        end
        return false
    end
 
    -- Mystic Flame
    if item.actionid == 41344 then
        if player:getStorageValue(lionrock.storages.firstMysticEnter) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have passed the Lion's Tests and are now worthy to enter the inner sanctum!")
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            player:setStorageValue(lionrock.storages.firstMysticEnter, 1)
        end
     
        -- Teleport to Inner Sanctum
        player:teleportTo({x = 33122, y = 32308, z = 8})
        return true
    end

    -- Large Amphora
    if item.actionid == 41345 then
        if player:getStorageValue(lionrock.storages.getScroll) < 1 and player:getStorageValue(lionrock.storages.skeleton) > 1 then
            player:addItem(lionrock.items.scroll)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "As you pass incautiously, the ancient amphora crumbles to shards and dust. Amidst the debris you discover an old scroll.")
            player:setStorageValue(lionrock.storages.getScroll, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            -- Destroy amphora and remake after couple of minutes script
        end
    end

    -- Translations
    if item.actionid == 41346 then -- 1
        if player:getStorageValue(lionrock.storages.translation1) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the golden statue: And the mighty lion defeated the greedy hyaena." ..
                "As a sign of victory he took its blood, red as voracity and lust, and created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation1, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    if item.actionid == 41347 then -- 2
        if player:getStorageValue(lionrock.storages.translation2) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the floor: And the mighty lion defeated the lazy lizard." ..
                "As a sign of victory he took its egg, blue as sloth and conceit, and out of a foul creature he created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation2, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    if item.actionid == 41348 then -- 3
        if player:getStorageValue(lionrock.storages.translation3) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the floor: And the mighty lion defeated the jealous snake." ..
                "As a sign of victory he took its eye, yellow as envy and malevolence, and out of a foul creature he created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation3, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    if item.actionid == 41349 then -- 4
        if player:getStorageValue(lionrock.storages.translation4) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the golden altar: And the mighty lion defeated the treacherous." ..
                "scorpion. As a sign of victory he took its poison, violet as deceit and betrayal, and created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation4, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    return true
end

Lib part
Code:
lionrock = {
    items = {
        nflower = 23759,
        flower = 23760,
        holywater = 23835,

        tongue = 10551,

        parchment = 23784,
        scroll = 25521,

        ruby = 2147,
        sapphire = 2146,
        amethyst = 2150,
        topaz = 9970,

        rewardfountain = 6390,

        redflame = 1488,
        yellowflame = 1500,
        blueflame = 8058,
        violetflame = 7473
    },

    -- For information only..
    actionIds = {
        getFlower = 41354,
        getWater = 41355,
        getScroll = 41356
    },

    storages = {
        skeleton = 50880,
        getFlower = 50881,
        usedFlower = 50882,

        getHolyWater = 50883,
        usedHolyWater = 50884,

        usedTongue = 50885,

        getScroll = 50886,

        firstMysticEnter = 50887,

        translation1 = 50888,
        translation2 = 50889,
        translation3 = 50890,
        translation4 = 50891,

        playerCanDoTasks = 50892

    },

    positions = {
        ruby = { x = 33069, y = 32298, z = 9 },
        sapphire = { x = 33069, y = 32302, z = 9 },
        amethyst = { x = 33077, y = 32302, z = 9 },
        topaz = { x = 33077, y = 32298, z = 9 }
    },

    -- Global Variaables used in all situations;
    taskactive = {
        ruby = false,
        sapphire = false,
        amethyst = false,
        topaz = false
    },

    rewards = {
        { id = 23810}, -- Lion's heart
        { id = 9971}, -- Gold ingot
        { id = 2154}, -- Yellow gem
        { id = 2156}, -- Red gem
        { id = 2127}, -- Emerlad bangle
        { id = 7633} -- Giant shimmering pearl
    },

    checkPlayerCanEnterMysticFlame = function(player)
        if player:getStorageValue(lionrock.storages.usedFlower) < 1
            or player:getStorageValue(lionrock.storages.usedHolyWater) < 1
            or player:getStorageValue(lionrock.storages.usedTongue) < 1 then

            return false
        end

        return true
    end,

    checkPlayerDoneQuest = function(player)
        if lionrock.checkPlayerCanEnterMysticFlame(player) ~= true then
            return false
        end

        if player:getStorageValue(lionrock.storages.translation1) < 1
            or player:getStorageValue(lionrock.storages.translation2) < 1
            or player:getStorageValue(lionrock.storages.translation3) < 1
            or player:getStorageValue(lionrock.storages.translation4) < 1 then

            return false
        end

        return true
    end
}
 
Last edited:
Solution
Contacted @Elvarion over discord, and we fixed everything, I beleive.

lib
Lua:
lionrock = {
    items = {
        nflower = 23759,
        flower = 23760,
        holywater = 23835,
   
        tongue = 10551,
       
        pyramid_unlit = 3709,
        pyramid_lit = 3710,
   
        amphora = 24314,
        amphora_trash = 3608,
        parchment = 23784,
        scroll = 25521,
   
        ruby = 2147,
        topaz = 9970,
        sapphire = 2146,
        amethyst = 2150,
   
        fountainstone = 3608,
        rewardfountain = 6390,
   
        redflame = 1488,
        yellowflame = 1501,
        blueflame = 8058,
        violetflame = 7473
    },
   
    -- For information only..
    actionIds = {
        getFlower =...
[TFS 1.3] Using this Distro but with an updated map for 10.98
This script came with the Distro I downloaded and I am trying to make it work like Retail since it was a bit choppy and missing parts originally.
Im been out of the OT Game for quite some time so alot of the coding is new to me but ive been chipping away at this script for some time now trying to fix it.
Some parts of the script are giving me a bit of trouble and would like some insight on how to fix my issues.

This became quite the long post. But I wanted to make sure it was as detailed and explained as possible. Sorry for the long read.
If anything is unclear (hopefully not) just ask and I will try and do a better job explaining.

Lion's Rock Quest on Retail

Quick Rundown of Quest
Pickup Flower - Works
Pickup Water - Works
Loot Dead Explorer for "Old Parchment (Brown)" - Script triggers, But does not contain text inside the scroll. (Is this named "Lion's Rock Three Tests (Book)" on Retail?)
Use Flower>Basin - Works. Missing part to change Pyramid into Lit up Pyramid > change back after some time?
Use Water>Pedestal - Works. ^
Use Cobra>Statue - Works. ^
(You can do these 3 in any order and the last one will display the text "You have now passed the last test to enter the inner sanctum." Instead of the last part with "The light in the small pyramid nearby begins to shine.") So to make this just like real it would need to check if you have done the other 2 before and change messages according to progression.
Enter Inner Sanctum after all 3 Tasks completed - Works
Exit Inner Sanctum - Missing, not gotten to that yet. I could just use a simple teleport script for this, since you need to do quest steps to even get in.
Break Amphora - Works. Missing part to change Amphora into broken version > Should respawn after some time also?
Translate Scroll 4 different steps - Works
Place Gems to Spawn Fountain and Use for Reward - Works. Fountain should transform back into Rubble after you have gotten reward. Also missing spawning of Fires when placing Gems, Fires should also decay after a bit.
You then get 1 random piece of treasure from a list of 6 items. If you have the Noble Lion mount you are unable to get the Lion's Heart.
Possible to do this once every 24h - Untested at the moment if this works.

There is alot of comments in the script ive added for myself and also for how the script is supposed to be when working as intended.

Here are the Action+Movement.xml lines
XML:
    <!-- Lions Rock Quest -->
    <action itemid="23760" script="quests/lions rock/lionRock.lua" /> <!--Flower-->
    <action itemid="23835" script="quests/lions rock/lionRock.lua" /> <!--Water-->
    <action itemid="10551" script="quests/lions rock/lionRock.lua" /> <!--Cobra-->
    <action fromaid="41354" toaid="41357" script="quests/lions rock/lionRock.lua" /> <!--UsingItems-->

    <!-- Lions Rock Quest -->
    <movevent event="StepIn" fromaid="41344" toaid="41349" script="others/quests/lionRock.lua" />

Action part of the script
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local itemEx = target

    -- Flower
    if item.actionid == 41354 then
        if player:getStorageValue(lionrock.storages.getFlower) < 1 then
            player:addItem(lionrock.items.flower)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You picked a beautiful lion's mane.")
            player:setStorageValue(lionrock.storages.getFlower, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
        return true
    end

    -- Holy Water
    if item.actionid == 41355 then
        if player:getStorageValue(lionrock.storages.getHolyWater) < 1 then -- Getting Holy Water
            player:addItem(lionrock.items.holywater, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took some holy water from the sacred well.")
            player:setStorageValue(lionrock.storages.getHolyWater, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    -- Loot Dead Explorer
    if item.actionid == 41356 then
        --if player:getStorageValue(lionrock.storages.skeleton) < 1 then --Commented for Debug reasons
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found an old parchment.")
            player:addItem(lionrock.items.parchment)
            doSetItemText(lionrock.items.parchment,"Still it is hard to believe that I finally found the mystical rock formations near Darashia, known as Lion's Rock. According to ancient records there is a temple for an unknown, probably long forgotten deity, built in the tunnels deep below the rock centuries ago. This holy site was once guarded by mystical lions and they may still be down there. But yet I haven't succeeded in entering the inner sanctum. The entrance to the lower temple areas is protected by an old and powerful enchantment. I studied the inscriptions on the temple walls and thus learned that the key to the inner sanctum is the passing of three tests. The first test is the Lion's Strength. In order to honour the site's mystical cats of prey one has to hunt and slay a cobra. The cobra's tongue must be laid down at a stone statue as a sacrifice. The second test is the Lion's Beauty. One has to burn the petals of a lion's mane flower on a coal basin. In the sand at the rock's foot I saw some dried lion's mane petals. Maybe these flowers grow somewhere upwards. The third test is called the Lion's Tears. It seems one has to purify an ornamented stone pedestal with ... At this point the records end because the parchment is destroyed. It seems that is was torn by a big paw …")
            player:setStorageValue(lionrock.storages.skeleton, 1)
    end

    -- Using Flower with Basin
    if item:getId() == lionrock.items.flower and itemEx.actionid == 41340 then
        if player:getStorageValue(lionrock.storages.usedFlower) < 1 then
            player:removeItem(lionrock.items.flower, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You burnt a lion's mane flower. The light in the small pyramid nearby begins to shine.")
            player:setStorageValue(lionrock.storages.usedFlower, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            --Change Pyramid into Light version 33136, 32369, 8 -3709>3710
        end
        return true
    end
  
    -- Using Holy Water with Pedestal
    if item:getId() == lionrock.items.holywater and itemEx.actionid == 41343 then
        if player:getStorageValue(lionrock.storages.usedHolyWater) < 1 then
            player:removeItem(lionrock.items.holywater, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have purified a sacred pedestal with holy water. You have now passed the last test to enter the inner sanctum.")
            player:setStorageValue(lionrock.storages.usedHolyWater, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            --Change Pyramid into Light version 33156, 32279, 8 -3709>3710
        end
        return true
    end

    -- Using Tongue with Statue
    if item:getId() == lionrock.items.tongue and itemEx.actionid == 41341 then
        if player:getStorageValue(lionrock.storages.usedTongue) < 1 then
            player:removeItem(lionrock.items.tongue, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have sacrificed a cobra tongue at an ancient statue. The light in the small pyramid nearby begins to shine.")
            player:setStorageValue(lionrock.storages.usedTongue, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            --Change Pyramid into Light version 33135, 32289, 8 -3709>3710
        end
        return true
    end

    -- Reward script 
   if item.actionid == 41357 then

        if player:getStorageValue(lionrock.storages.playerCanDoTasks) - os.time() > 0 then
           player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Come back after the server save.")
            return false
        end

        if player:getStorageValue(lionrock.storages.translation1) < 1 or player:getStorageValue(lionrock.storages.translation2) < 1 or player:getStorageValue(lionrock.storages.translation3) < 1 or player:getStorageValue(lionrock.storages.translation4) < 1 then
           player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "At the moment there is neither a treasure nor anything else in the fountain. Perhaps you might return later.")
            return false
        end

        -- Player reward
        player:setStorageValue(lionrock.storages.playerCanDoTasks, os.time() + 1 * 24 * 60 * 60 )
        local reward = lionrock.rewards[math.random(#lionrock.rewards)]
        player:addItem(reward.id, 1)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Something sparkles in the fountain's water. You draw out a beautiful and certainly precious amulet.")
        --player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Something sparkles in the fountain's water. You draw out a  '.. ItemType(rewards[random].item):getName() ..'.') --Added to make the script say what item you have obtained. If its the Lions Heart it should say 'You draw out a beautiful and certainly precious amulet.' if not it should just say "You draw out a ITEM"


        -- Reseting tasks
        lionrock.taskactive.ruby = false
        lionrock.taskactive.sapphire = false
        lionrock.taskactive.amethyst = false
        lionrock.taskactive.topaz = false

    -- Ruby
    local redflamePosition = Position(33069, 32298, 9)
    local redItem = Tile(redflamePosition):getItemById(1488) --Does this create a field?
    if redItem then
        redItem:remove()
        --Game.createItem(1488, 1, redflamePosition) Create fields like this?
      
    end

    -- Amethyst
    local yellowflamePosition = Position(33077, 32302, 9)
    local yellowItem = Tile(yellowflamePosition):getItemById(1500)
    if yellowItem then
        yellowItem:remove()
    end

    -- Topaz
    local purpleflamePosition = Position(33077, 32298, 9)
    local purpleItem = Tile(purpleflamePosition):getItemById(7473)
    if purpleItem then
        purpleItem:remove()
    end

    -- Sapphire
    local violetflamePosition = Position(33069, 32302, 9)
    local violetflamePosition = Tile(violetflamePosition):getItemById(8058)
    if violetflamePosition then
        violetflamePosition:remove()
    end
  
        -- Removing Fountain
        local Item = Tile(position(33073, 32300, 9)):getItemById(6390)
        if Item then
        Item:remove()
        -- Stone back;
        Game.createItem(3608, 1, { x=33073, y=32300, z=9})
        end
    end
end

Movement Part
Lua:
function onStepIn(creature, item, position, fromPosition)

    local player = creature:getPlayer()
    if player == nil then
        return true
    end

    if not lionrock.checkPlayerCanEnterMysticFlame(player) then
        if item.actionid == 41344 then
            player:teleportTo(fromPosition, true)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "CANT PASS YET MESSAGE (If there is any).")
        end
        return false
    end
  
    -- Mystic Flame
    if item.actionid == 41344 then
        if player:getStorageValue(lionrock.storages.firstMysticEnter) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have passed the Lion's Tests and are now worthy to enter the inner sanctum!")
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            player:setStorageValue(lionrock.storages.firstMysticEnter, 1)
        end
      
        -- Teleport to Inner Sanctum
        player:teleportTo({x = 33122, y = 32308, z = 8})
        return true
    end

    -- Large Amphora
    if item.actionid == 41345 then
        if player:getStorageValue(lionrock.storages.getScroll) < 1 and player:getStorageValue(lionrock.storages.skeleton) > 1 then
            player:addItem(lionrock.items.scroll)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "As you pass incautiously, the ancient amphora crumbles to shards and dust. Amidst the debris you discover an old scroll.")
            player:setStorageValue(lionrock.storages.getScroll, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            -- Destroy amphora and remake after couple of minutes script
        end
    end

    -- Translations
    if item.actionid == 41346 then -- 1
        if player:getStorageValue(lionrock.storages.translation1) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the golden statue: And the mighty lion defeated the greedy hyaena." ..
                "As a sign of victory he took its blood, red as voracity and lust, and created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation1, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    if item.actionid == 41347 then -- 2
        if player:getStorageValue(lionrock.storages.translation2) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the floor: And the mighty lion defeated the lazy lizard." ..
                "As a sign of victory he took its egg, blue as sloth and conceit, and out of a foul creature he created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation2, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    if item.actionid == 41348 then -- 3
        if player:getStorageValue(lionrock.storages.translation3) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the floor: And the mighty lion defeated the jealous snake." ..
                "As a sign of victory he took its eye, yellow as envy and malevolence, and out of a foul creature he created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation3, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    if item.actionid == 41349 then -- 4
        if player:getStorageValue(lionrock.storages.translation4) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the golden altar: And the mighty lion defeated the treacherous." ..
                "scorpion. As a sign of victory he took its poison, violet as deceit and betrayal, and created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation4, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    return true
end

Lib part
Code:
lionrock = {
    items = {
        nflower = 23759,
        flower = 23760,
        holywater = 23835,

        tongue = 10551,

        parchment = 23784,
        scroll = 25521,

        ruby = 2147,
        sapphire = 2146,
        amethyst = 2150,
        topaz = 9970,

        rewardfountain = 6390,

        redflame = 1488,
        yellowflame = 1500,
        blueflame = 8058,
        violetflame = 7473
    },

    -- For information only..
    actionIds = {
        getFlower = 41354,
        getWater = 41355,
        getScroll = 41356
    },

    storages = {
        skeleton = 50880,
        getFlower = 50881,
        usedFlower = 50882,

        getHolyWater = 50883,
        usedHolyWater = 50884,

        usedTongue = 50885,

        getScroll = 50886,

        firstMysticEnter = 50887,

        translation1 = 50888,
        translation2 = 50889,
        translation3 = 50890,
        translation4 = 50891,

        playerCanDoTasks = 50892

    },

    positions = {
        ruby = { x = 33069, y = 32298, z = 9 },
        sapphire = { x = 33069, y = 32302, z = 9 },
        amethyst = { x = 33077, y = 32302, z = 9 },
        topaz = { x = 33077, y = 32298, z = 9 }
    },

    -- Global Variaables used in all situations;
    taskactive = {
        ruby = false,
        sapphire = false,
        amethyst = false,
        topaz = false
    },

    rewards = {
        { id = 23810}, -- Lion's heart
        { id = 9971}, -- Gold ingot
        { id = 2154}, -- Yellow gem
        { id = 2156}, -- Red gem
        { id = 2127}, -- Emerlad bangle
        { id = 7633} -- Giant shimmering pearl
    },

    checkPlayerCanEnterMysticFlame = function(player)
        if player:getStorageValue(lionrock.storages.usedFlower) < 1
            or player:getStorageValue(lionrock.storages.usedHolyWater) < 1
            or player:getStorageValue(lionrock.storages.usedTongue) < 1 then

            return false
        end

        return true
    end,

    checkPlayerDoneQuest = function(player)
        if lionrock.checkPlayerCanEnterMysticFlame(player) ~= true then
            return false
        end

        if player:getStorageValue(lionrock.storages.translation1) < 1
            or player:getStorageValue(lionrock.storages.translation2) < 1
            or player:getStorageValue(lionrock.storages.translation3) < 1
            or player:getStorageValue(lionrock.storages.translation4) < 1 then

            return false
        end

        return true
    end
}
I'll probably keep editing my post here, as I fix each issue.

Issue: Loot Dead Explorer for "Old Parchment (Brown)" - Script triggers, But does not contain text inside the scroll. (Is this named "Lion's Rock Three Tests (Book)" on Retail?)

Solution: change this
Lua:
player:addItem(lionrock.items.parchment)
doSetItemText(lionrock.items.parchment,"Still it is hard to believe that I finally found the mystical rock formations near Darashia, known as Lion's Rock. According to ancient records there is a temple for an unknown, probably long forgotten deity, built in the tunnels deep below the rock centuries ago. This holy site was once guarded by mystical lions and they may still be down there. But yet I haven't succeeded in entering the inner sanctum. The entrance to the lower temple areas is protected by an old and powerful enchantment. I studied the inscriptions on the temple walls and thus learned that the key to the inner sanctum is the passing of three tests. The first test is the Lion's Strength. In order to honour the site's mystical cats of prey one has to hunt and slay a cobra. The cobra's tongue must be laid down at a stone statue as a sacrifice. The second test is the Lion's Beauty. One has to burn the petals of a lion's mane flower on a coal basin. In the sand at the rock's foot I saw some dried lion's mane petals. Maybe these flowers grow somewhere upwards. The third test is called the Lion's Tears. It seems one has to purify an ornamented stone pedestal with ... At this point the records end because the parchment is destroyed. It seems that is was torn by a big paw …")
to this
Lua:
local book = player:addItem(lionrock.items.parchment)
book:setAttribute(ITEM_ATTRIBUTE_TEXT, "Still it is hard to believe that I finally found the mystical rock formations near Darashia, known as Lion's Rock. According to ancient records there is a temple for an unknown, probably long forgotten deity, built in the tunnels deep below the rock centuries ago. This holy site was once guarded by mystical lions and they may still be down there. But yet I haven't succeeded in entering the inner sanctum. The entrance to the lower temple areas is protected by an old and powerful enchantment. I studied the inscriptions on the temple walls and thus learned that the key to the inner sanctum is the passing of three tests. The first test is the Lion's Strength. In order to honour the site's mystical cats of prey one has to hunt and slay a cobra. The cobra's tongue must be laid down at a stone statue as a sacrifice. The second test is the Lion's Beauty. One has to burn the petals of a lion's mane flower on a coal basin. In the sand at the rock's foot I saw some dried lion's mane petals. Maybe these flowers grow somewhere upwards. The third test is called the Lion's Tears. It seems one has to purify an ornamented stone pedestal with ... At this point the records end because the parchment is destroyed. It seems that is was torn by a big paw …")
 
Ah, So thats how text works now. Thanks for showing me. That fixes the parchment part just perfectly :)
I will update the main post with any fixes and also check off whats completed.
 
Last edited:
I fixed as much as I could see in the code. Also added the pyramid light on and off. Kind of lost in what else is needed so try to clean main post up a bit please.

Action code
Lua:
local pyramidFlower_pos = Position(33136, 32369, 8)
local pyramidHolyWater_pos = Position(33156, 32279, 8)
local pyramidTongue_pos = Position(33135, 32289, 8)
local pyramid_reset = 5 -- Turn pyramid off after 5 seconds

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    -- Flower
    if item.actionid == 41354 then
        if player:getStorageValue(lionrock.storages.getFlower) < 1 then
            player:addItem(lionrock.items.flower)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You picked a beautiful lion's mane.")
            player:setStorageValue(lionrock.storages.getFlower, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
        return true
    end

    -- Holy Water
    if item.actionid == 41355 then
        if player:getStorageValue(lionrock.storages.getHolyWater) < 1 then -- Getting Holy Water
            player:addItem(lionrock.items.holywater, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took some holy water from the sacred well.")
            player:setStorageValue(lionrock.storages.getHolyWater, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    -- Loot Dead Explorer
    if item.actionid == 41356 then
        if player:getStorageValue(lionrock.storages.skeleton) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found an old parchment.")
            local book = player:addItem(lionrock.items.parchment)
            book:setAttribute(ITEM_ATTRIBUTE_TEXT, "Still it is hard to believe that I finally found the mystical rock formations near Darashia, known as Lion's Rock. According to ancient records there is a temple for an unknown, probably long forgotten deity, built in the tunnels deep below the rock centuries ago. This holy site was once guarded by mystical lions and they may still be down there. But yet I haven't succeeded in entering the inner sanctum. The entrance to the lower temple areas is protected by an old and powerful enchantment. I studied the inscriptions on the temple walls and thus learned that the key to the inner sanctum is the passing of three tests. The first test is the Lion's Strength. In order to honour the site's mystical cats of prey one has to hunt and slay a cobra. The cobra's tongue must be laid down at a stone statue as a sacrifice. The second test is the Lion's Beauty. One has to burn the petals of a lion's mane flower on a coal basin. In the sand at the rock's foot I saw some dried lion's mane petals. Maybe these flowers grow somewhere upwards. The third test is called the Lion's Tears. It seems one has to purify an ornamented stone pedestal with ... At this point the records end because the parchment is destroyed. It seems that is was torn by a big paw...")
            player:setStorageValue(lionrock.storages.skeleton, 1)
            end
    end

    -- Using Flower with Basin
    if item:getId() == lionrock.items.flower and itemEx.actionid == 41340 then
        if player:getStorageValue(lionrock.storages.usedFlower) < 1 then
            player:removeItem(lionrock.items.flower, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You burnt a lion's mane flower. The light in the small pyramid nearby begins to shine.")
            player:setStorageValue(lionrock.storages.usedFlower, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            local pyramid = Tile(pyramidFlower_pos):getItemById(3709)
            if pyramid then
                pyramid:transform(3710)
                addEvent(resetPyramid, pyramid_reset * 1000, pyramidFlower_pos)
            end
        end
        return true
    end

    -- Using Holy Water with Pedestal
    if item:getId() == lionrock.items.holywater and itemEx.actionid == 41343 then
        if player:getStorageValue(lionrock.storages.usedHolyWater) < 1 then
            player:removeItem(lionrock.items.holywater, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have purified a sacred pedestal with holy water. You have now passed the last test to enter the inner sanctum.")
            player:setStorageValue(lionrock.storages.usedHolyWater, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            local pyramid = Tile(pyramidHolyWater_pos):getItemById(3709)
            if pyramid then
                pyramid:transform(3710)
                addEvent(resetPyramid, pyramid_reset * 1000, pyramidHolyWater_pos)
            end
        end
        return true
    end

    -- Using Tongue with Statue
    if item:getId() == lionrock.items.tongue and itemEx.actionid == 41341 then
        if player:getStorageValue(lionrock.storages.usedTongue) < 1 then
            player:removeItem(lionrock.items.tongue, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have sacrificed a cobra tongue at an ancient statue. The light in the small pyramid nearby begins to shine.")
            player:setStorageValue(lionrock.storages.usedTongue, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            local pyramid = Tile(pyramidTongue_pos):getItemById(3709)
            if pyramid then
                pyramid:transform(3710)
                addEvent(resetPyramid, pyramid_reset * 1000, pyramidTongue_pos)
            end
        end
        return true
    end

    -- Reward script
   if item.actionid == 41357 then

        if player:getStorageValue(lionrock.storages.playerCanDoTasks) - os.time() > 0 then
           player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Come back after the server save.")
            return false
        end

        if player:getStorageValue(lionrock.storages.translation1) < 1 or player:getStorageValue(lionrock.storages.translation2) < 1 or player:getStorageValue(lionrock.storages.translation3) < 1 or player:getStorageValue(lionrock.storages.translation4) < 1 then
           player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "At the moment there is neither a treasure nor anything else in the fountain. Perhaps you might return later.")
            return false
        end

        -- Player reward
        player:setStorageValue(lionrock.storages.playerCanDoTasks, os.time() + 1 * 24 * 60 * 60 )
        local reward = lionrock.rewards[math.random(#lionrock.rewards)]
        player:addItem(reward.id, 1)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Something sparkles in the fountain's water. You draw out a "..ItemType(reward.id):getName()..".")

        -- Reseting tasks
        lionrock.taskactive.ruby = false
        lionrock.taskactive.sapphire = false
        lionrock.taskactive.amethyst = false
        lionrock.taskactive.topaz = false

    -- Ruby
    local redflamePosition = Position(33069, 32298, 9)
    local redItem = Tile(redflamePosition):getItemById(1488) -- Checks if field exists already
    if redItem then -- If it exists already
        redItem:remove() -- Remove it
        local field = Game.createItem(1488, 1, redflamePosition) -- Add new field there (we have to give it a local so we can set decay to it)
        field:decay() -- Give it the normal decay time in items.xml
    end

    -- Amethyst
    local yellowflamePosition = Position(33077, 32302, 9)
    local yellowItem = Tile(yellowflamePosition):getItemById(1500)
    if yellowItem then
        yellowItem:remove()
    end

    -- Topaz
    local purpleflamePosition = Position(33077, 32298, 9)
    local purpleItem = Tile(purpleflamePosition):getItemById(7473)
    if purpleItem then
        purpleItem:remove()
    end

    -- Sapphire
    local violetflamePosition = Position(33069, 32302, 9)
    local violetflamePosition = Tile(violetflamePosition):getItemById(8058)
    if violetflamePosition then
        violetflamePosition:remove()
    end

        -- Removing Fountain
        local fountain = Tile(Position(33073, 32300, 9)):getItemById(6390)
        if fountain then
        fountain:remove()
        -- Stone back;
        Game.createItem(3608, 1, Position(33073, 32300, 9))
        end
    end
end

function resetPyramid(pos)
    local pyramid = Tile(pos):getItemById(3710)
    if pyramid then
        pyramid:transform(3709)
    end
end

The moveevent with the amphora removal/creation and some code modifications.
Lua:
local amphoraCreateTime = 2 -- Time in minutes

function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)
   
    if not player then return true end

    if not lionrock.checkPlayerCanEnterMysticFlame(player) then
        if item.actionid == 41344 then
            player:teleportTo(fromPosition, true)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "CANT PASS YET MESSAGE (If there is any).")
        end
        return false
    end
 
    -- Mystic Flame
    if item.actionid == 41344 then
        if player:getStorageValue(lionrock.storages.firstMysticEnter) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have passed the Lion's Tests and are now worthy to enter the inner sanctum!")
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            player:setStorageValue(lionrock.storages.firstMysticEnter, 1)
        end
     
        -- Teleport to Inner Sanctum
        player:teleportTo(Position(33122, 32308, 8))
        return true
    end

    -- Large Amphora
    if item.actionid == 41345 then
        if player:getStorageValue(lionrock.storages.getScroll) < 1 and player:getStorageValue(lionrock.storages.skeleton) > 1 then
            player:addItem(lionrock.items.scroll)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "As you pass incautiously, the ancient amphora crumbles to shards and dust. Amidst the debris you discover an old scroll.")
            player:setStorageValue(lionrock.storages.getScroll, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            local amphoraId = item.itemid
            item:remove()
            addEvent(createAmphora, amphoraCreateTime * 60 * 1000, amphoraId, position)
        end
    end

    -- Translations
    if item.actionid == 41346 then -- 1
        if player:getStorageValue(lionrock.storages.translation1) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the golden statue: And the mighty lion defeated the greedy hyaena." ..
                "As a sign of victory he took its blood, red as voracity and lust, and created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation1, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    if item.actionid == 41347 then -- 2
        if player:getStorageValue(lionrock.storages.translation2) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the floor: And the mighty lion defeated the lazy lizard." ..
                "As a sign of victory he took its egg, blue as sloth and conceit, and out of a foul creature he created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation2, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    if item.actionid == 41348 then -- 3
        if player:getStorageValue(lionrock.storages.translation3) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the floor: And the mighty lion defeated the jealous snake." ..
                "As a sign of victory he took its eye, yellow as envy and malevolence, and out of a foul creature he created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation3, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end

    if item.actionid == 41349 then -- 4
        if player:getStorageValue(lionrock.storages.translation4) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                "With the aid of the old scroll you translate the inscriptions on the golden altar: And the mighty lion defeated the treacherous." ..
                "scorpion. As a sign of victory he took its poison, violet as deceit and betrayal, and created a precious treasure.")
            player:setStorageValue(lionrock.storages.translation4, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end
    return true
end

function createAmphora(itemid, pos)
    local ITEM = Tile(pos):getItemById(itemid)
    if ITEM then return true end
    local amphora = Game.createItem(itemid, 1, pos)
    amphora:setAttribute('aid', 41345)
end
 
Last edited:
I fixed as much as I could see in the code. Also added the pyramid light on and off. Kind of lost in what else is needed so try to clean main post up a bit please.
Currently not home so not able to try out the script. But thanks alot for the work done!
I tried cleaning up the post a bit also. Will see if I can further make it easier to read.

The new action script is throwing this error when trying to use the items on respective places. Same issue with line 55 & 71
C++:
Lua Script Error: [Action Interface]
data/actions/scripts/quests/lions rock/lionRock.lua:onUse
data/actions/scripts/quests/lions rock/lionRock.lua:39: attempt to index global 'itemEx' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/actions/scripts/quests/lions rock/lionRock.lua:39: in function <data/actions/scripts/quests/lions rock/lionRock.lua:6>
 
Last edited:
I fixed as much as I could see in the code. Also added the pyramid light on and off. Kind of lost in what else is needed so try to clean main post up a bit please.
Sorry for quoting you again. But I edited my previous post so you might not have gotten a notification about that.
I was getting an error with your script. But I ended up solving it by adding the line
Lua:
local itemEx = target
near the top of the Action Script. Hopefully this was the correct way of doing it :)

Got issues with the teleport after completing the 3 pyramids. Its not teleporting and Im struggling to understand why its not.

Ive never really used code in this kind of way. But by just reading it I am pretty sure the teleport script is looking to see if any of the 3 pyramids havent been done. And if you are missing 1 it will return false and if you do have done all 3 it should return true and then do the teleport.
I feel like the script should work the way its written, but somehow it isnt.

Everything is completed with the help of Xikini, Big thanks!
 
Last edited:
Contacted @Elvarion over discord, and we fixed everything, I beleive.

lib
Lua:
lionrock = {
    items = {
        nflower = 23759,
        flower = 23760,
        holywater = 23835,
   
        tongue = 10551,
       
        pyramid_unlit = 3709,
        pyramid_lit = 3710,
   
        amphora = 24314,
        amphora_trash = 3608,
        parchment = 23784,
        scroll = 25521,
   
        ruby = 2147,
        topaz = 9970,
        sapphire = 2146,
        amethyst = 2150,
   
        fountainstone = 3608,
        rewardfountain = 6390,
   
        redflame = 1488,
        yellowflame = 1501,
        blueflame = 8058,
        violetflame = 7473
    },
   
    -- For information only..
    actionIds = {
        getFlower = 41354,
        flowerBasin = 41340,
       
        getWater = 41355,
        holywaterpedestal = 41343,
       
        getSkeleton = 41356,
        fountain = 41357,
       
        tonguestatue = 41341,
       
        mystic_flame = 41344,
       
        amphora = 41345,
       
        translation1 = 41346,
        translation2 = 41347,
        translation3 = 41348,
        translation4 = 41349
    },
   
    storages = {
        skeleton = 50880,
        getFlower = 50881,
        usedFlower = 50882,
   
        getHolyWater = 50883,
        usedHolyWater = 50884,
   
        usedTongue = 50885,
   
        getScroll = 50886,
   
        firstMysticEnter = 50887,
   
        translation1 = 50888,
        translation2 = 50889,
        translation3 = 50890,
        translation4 = 50891,
   
        playerCanDoTasks = 50892
    },
   
    positions = {
        ruby = { x = 33069, y = 32298, z = 9 },
        topaz = { x = 33077, y = 32298, z = 9 },
        sapphire = { x = 33069, y = 32302, z = 9 },
        amethyst = { x = 33077, y = 32302, z = 9 },
        fountain = { x = 33073, y = 32300, z =9 },
       
        pyramidFlower_pos = { x = 33136, y = 32369, z = 8},
        pyramidHolyWater_pos = { x = 33156, y = 32279, z = 8},
        pyramidTongue_pos = { x = 33134, y = 32289, z = 8},
       
        amphora = { x = 33119, y = 32247, z = 9},
       
        mystic_flame_inner_sanctum_teleport = { x = 33122, y = 32308, z = 8 }
    },
   
    -- Global Variables used in all situations;
   
    resetTimers = {
        amphoraCreateTime = 2, -- in seconds
        pyramid_reset = 5, -- in seconds
        reward_reset = 1 * 24 * 60 * 60
    }
   
    taskactive = {
        ruby = false,
        sapphire = false,
        amethyst = false,
        topaz = false
    },
   
    rewards = {
        { id = 9971}, -- Gold ingot
        { id = 2154}, -- Yellow gem
        { id = 2156}, -- Red gem
        { id = 2127}, -- Emerlad bangle
        { id = 7633}, -- Giant shimmering pearl
        { id = 23810} -- Lion's heart (NEEDS TO BE LAST)
    },
   
    checkPlayerCanEnterMysticFlame = function(player)
        if player:getStorageValue(lionrock.storages.usedFlower) < 1 or player:getStorageValue(lionrock.storages.usedHolyWater) < 1 or player:getStorageValue(lionrock.storages.usedTongue) < 1 then
            return false
        end
        return true
    end,
   
    checkPlayerDoneQuest = function(player)
        if lionrock.checkPlayerCanEnterMysticFlame(player) ~= true then
            return false
        end
   
        if player:getStorageValue(lionrock.storages.translation1) < 1
            or player:getStorageValue(lionrock.storages.translation2) < 1
            or player:getStorageValue(lionrock.storages.translation3) < 1
            or player:getStorageValue(lionrock.storages.translation4) < 1 then
   
            return false
        end
   
        return true
    end
}
actionscript
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    
    -- Flower
    if item.actionid == lionrock.actionIds.getFlower then
        if player:getStorageValue(lionrock.storages.getFlower) < 1 then
            player:addItem(lionrock.items.flower)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You picked a beautiful lion's mane.")
            player:setStorageValue(lionrock.storages.getFlower, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
        return true
    end
    
    -- Holy Water
    if item.actionid == lionrock.actionIds.getWater then
        if player:getStorageValue(lionrock.storages.getHolyWater) < 1 then -- Getting Holy Water
            player:addItem(lionrock.items.holywater, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took some holy water from the sacred well.")
            player:setStorageValue(lionrock.storages.getHolyWater, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
        end
    end
    
    -- Loot Dead Explorer
    if item.actionid == lionrock.actionIds.getSkeleton then
        if player:getStorageValue(lionrock.storages.skeleton) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found an old parchment.")
            local book = player:addItem(lionrock.items.parchment)
            book:setAttribute(ITEM_ATTRIBUTE_TEXT, "Still it is hard to believe that I finally found the mystical rock formations near Darashia, known as Lion's Rock. According to ancient records there is a temple for an unknown, probably long forgotten deity, built in the tunnels deep below the rock centuries ago. This holy site was once guarded by mystical lions and they may still be down there. But yet I haven't succeeded in entering the inner sanctum. The entrance to the lower temple areas is protected by an old and powerful enchantment. I studied the inscriptions on the temple walls and thus learned that the key to the inner sanctum is the passing of three tests. The first test is the Lion's Strength. In order to honour the site's mystical cats of prey one has to hunt and slay a cobra. The cobra's tongue must be laid down at a stone statue as a sacrifice. The second test is the Lion's Beauty. One has to burn the petals of a lion's mane flower on a coal basin. In the sand at the rock's foot I saw some dried lion's mane petals. Maybe these flowers grow somewhere upwards. The third test is called the Lion's Tears. It seems one has to purify an ornamented stone pedestal with ... At this point the records end because the parchment is destroyed. It seems that is was torn by a big paw...")
            player:setStorageValue(lionrock.storages.skeleton, 1)
            end
    end
    
    -- Using Flower with Basin
    if item:getId() == lionrock.items.flower and target.actionid == lionrock.actionIds.flowerBasin then
        if player:getStorageValue(lionrock.storages.usedFlower) < 1 then
            item:remove(1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You burnt a lion's mane flower. The light in the small pyramid nearby begins to shine.")
            player:setStorageValue(lionrock.storages.usedFlower, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            local pyramid = Tile(lionrock.positions.pyramidFlower_pos):getItemById(lionrock.items.pyramid_unlit)
            if pyramid then
                pyramid:transform(lionrock.items.pyramid_lit)
                addEvent(resetPyramid, lionrock.resetTimers.pyramid_reset * 1000, lionrock.positions.pyramidFlower_pos)
            end
        end
        return true
    end
    
    -- Using Holy Water with Pedestal
    if item:getId() == lionrock.items.holywater and target.actionid == lionrock.actionIds.holywaterpedestal then
        if player:getStorageValue(lionrock.storages.usedHolyWater) < 1 then
            item:remove(1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have purified a sacred pedestal with holy water. You have now passed the last test to enter the inner sanctum.")
            player:setStorageValue(lionrock.storages.usedHolyWater, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            local pyramid = Tile(lionrock.positions.pyramidHolyWater_pos):getItemById(lionrock.items.pyramid_unlit)
            if pyramid then
                pyramid:transform(lionrock.items.pyramid_lit)
                addEvent(resetPyramid, lionrock.resetTimers.pyramid_reset * 1000, lionrock.positions.pyramidHolyWater_pos)
            end
        end
        return true
    end
    
    -- Using Tongue with Statue
    if item:getId() == lionrock.items.tongue and target.actionid == lionrock.actionIds.tonguestatue then
        if player:getStorageValue(lionrock.storages.usedTongue) < 1 then
            item:remove(1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have sacrificed a cobra tongue at an ancient statue. The light in the small pyramid nearby begins to shine.")
            player:setStorageValue(lionrock.storages.usedTongue, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            local pyramid = Tile(lionrock.positions.pyramidTongue_pos):getItemById(lionrock.items.pyramid_unlit)
            if pyramid then
                pyramid:transform(lionrock.items.pyramid_lit)
                addEvent(resetPyramid, lionrock.resetTimers.pyramid_reset * 1000, lionrock.positions.pyramidTongue_pos)
            end
        end
        return true
    end
    
    -- Reward script
    if item.actionid == lionrock.actionIds.fountain then
    
        -- Player reward
        if lionrock.checkPlayerDoneQuest(player) and player:getStorageValue(lionrock.storages.playerCanDoTasks) - os.time() < 0 then -- if they haven't gotten a reward before, or if 24 hours has passed since they last got the reward
            player:setStorageValue(lionrock.storages.playerCanDoTasks, os.time() + lionrock.resetTimers.reward_reset)
            local reward_index_count = #lionrock.rewards
            if player:hasMount(40) then
                reward_index_count = reward_index_count - 1
            end
            local reward = lionrock.rewards[math.random(reward_index_count)]
            player:addItem(reward.id, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Something sparkles in the fountain's water. You draw out a "..ItemType(reward.id):getName()..".")
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "At the moment there is neither a treasure nor anything else in the fountain. Perhaps you might return later.")
        end
    
        -- Reseting tasks
        lionrock.taskactive.ruby = false
        lionrock.taskactive.sapphire = false
        lionrock.taskactive.amethyst = false
        lionrock.taskactive.topaz = false        
    
        -- Ruby
        local redflamePosition = Tile(lionrock.positions.ruby):getItemById(lionrock.items.redflame)
        if redflamePosition then
            redflamePosition:remove()
        end
    
        -- Topaz
        local yellowflamePosition = Tile(lionrock.positions.topaz):getItemById(lionrock.items.yellowflame)
        if yellowflamePosition then
            yellowflamePosition:remove()
        end
    
        -- Amethyst
        local purpleflamePosition = Tile(lionrock.positions.amethyst):getItemById(lionrock.items.violetflame)
        if purpleflamePosition then
            purpleflamePosition:remove()
        end
    
        -- Sapphire
        local violetflamePosition = Tile(lionrock.positions.sapphire):getItemById(lionrock.items.blueflame)
        if violetflamePosition then
            violetflamePosition:remove()
        end
    
        -- Removing Fountain
        local fountain = Tile(lionrock.positions.fountain):getItemById(lionrock.items.rewardfountain)
        if fountain then
            fountain:remove()
            -- Stone back;
            Game.createItem(lionrock.items.fountainstone, 1, lionrock.positions.fountain)
        end
    end
end

function resetPyramid(pos)
    local pyramid = Tile(pos):getItemById(lionrock.items.pyramid_lit)
    if pyramid then
        pyramid:transform(lionrock.items.pyramid_unlit)
    end
end
movements
Lua:
function onStepIn(creature, item, position, fromPosition)
    local player = Player(creature)

    if not player then return true end

    -- Mystic Flame
    if item.actionid == lionrock.actionIds.mystic_flame then
        if not lionrock.checkPlayerCanEnterMysticFlame(player) then
            player:teleportTo(fromPosition, true)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "CANT PASS YET MESSAGE (If there is any).")
            return true
        end
    
        if player:getStorageValue(lionrock.storages.firstMysticEnter) < 1 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have passed the Lion's Tests and are now worthy to enter the inner sanctum!")
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            player:setStorageValue(lionrock.storages.firstMysticEnter, 1)
        end
 
        -- Teleport to Inner Sanctum
        player:teleportTo(lionrock.positions.mystic_flame_inner_sanctum_teleport)
        return true
    end

    -- Large Amphora
    if item.actionid == lionrock.actionIds.amphora then
        if player:getStorageValue(lionrock.storages.getScroll) < 1 then
            player:addItem(lionrock.items.scroll)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "As you pass incautiously, the ancient amphora crumbles to shards and dust. Amidst the debris you discover an old scroll.")
            player:setStorageValue(lionrock.storages.getScroll, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            local amphoraItem = Tile(lionrock.positions.amphora):getItemById(lionrock.items.amphora)
            if amphoraItem then
                amphoraItem:transform(lionrock.items.amphora_trash)
                addEvent(recreateAmphora, lionrock.resetTimers.amphoraCreateTime * 1000, lionrock.items.amphora_trash, lionrock.items.amphora, lionrock.positions.amphora)
            end
        end
    end

    -- Translations
    if player:getStorageValue(lionrock.storages.getScroll) == 1 then
        if item.actionid == lionrock.actionIds.translation1 then -- 1
            if player:getStorageValue(lionrock.storages.translation1) < 1 then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                    "With the aid of the old scroll you translate the inscriptions on the golden statue: And the mighty lion defeated the greedy hyaena." ..
                    "As a sign of victory he took its blood, red as voracity and lust, and created a precious treasure.")
                player:setStorageValue(lionrock.storages.translation1, 1)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            end
        end

        if item.actionid == lionrock.actionIds.translation2 then -- 2
            if player:getStorageValue(lionrock.storages.translation2) < 1 then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                    "With the aid of the old scroll you translate the inscriptions on the floor: And the mighty lion defeated the lazy lizard." ..
                    "As a sign of victory he took its egg, blue as sloth and conceit, and out of a foul creature he created a precious treasure.")
                player:setStorageValue(lionrock.storages.translation2, 1)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            end
        end

        if item.actionid == lionrock.actionIds.translation3 then -- 3
            if player:getStorageValue(lionrock.storages.translation3) < 1 then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                    "With the aid of the old scroll you translate the inscriptions on the floor: And the mighty lion defeated the jealous snake." ..
                    "As a sign of victory he took its eye, yellow as envy and malevolence, and out of a foul creature he created a precious treasure.")
                player:setStorageValue(lionrock.storages.translation3, 1)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            end
        end

        if item.actionid == lionrock.actionIds.translation4 then -- 4
            if player:getStorageValue(lionrock.storages.translation4) < 1 then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                    "With the aid of the old scroll you translate the inscriptions on the golden altar: And the mighty lion defeated the treacherous." ..
                    "scorpion. As a sign of victory he took its poison, violet as deceit and betrayal, and created a precious treasure.")
                player:setStorageValue(lionrock.storages.translation4, 1)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            end
        end
    end
    return true
end

function recreateAmphora(trashID, amphoraID, pos)
    local ITEM = Tile(pos):getItemById(trashID)
    if ITEM then
        ITEM:transform(amphoraID)
    end
    return true
end
events/scripts/player.lua --> inside Player:OnMoveItem function
Lua:
    --- LIONS ROCK START

    local lion_pos, lion_item = lionrock.positions, lionrock.items
    if item:getId() == lion_item.ruby and toPosition.x == lion_pos.ruby.x and toPosition.y == lion_pos.ruby.y  and toPosition.z == lion_pos.ruby.z then
        -- Ruby
        if self:getStorageValue(lionrock.storages.translation1) == 1 then
            if lionrock.taskactive.ruby ~= true then
                addEvent(function()
                    local ruby = Tile(lion_pos.ruby):getItemById(lion_item.ruby)
                    if ruby ~= nil then
                        ruby:remove(1)
                    end
                end, 0)
                Game.createItem(lion_item.redflame, 1, lion_pos.ruby)
                self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You place the ruby on the small socket. A red flame begins to burn.")
                lionrock.taskactive.ruby = true
            end
        end
    end

    if item:getId() == lion_item.topaz and toPosition.x == lion_pos.topaz.x and toPosition.y == lion_pos.topaz.y  and toPosition.z == lion_pos.topaz.z then
        -- Topaz
        if self:getStorageValue(lionrock.storages.translation3) == 1 then
            if lionrock.taskactive.topaz ~= true then
                addEvent(function()
                    local topaz = Tile(lion_pos.topaz):getItemById(lion_item.topaz)
                    if topaz ~= nil then
                        topaz:remove(1)
                    end
                end, 0)
                Game.createItem(lion_item.yellowflame, 1, lion_pos.topaz)
                self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You place the topaz on the small socket. A yellow flame begins to burn.")
                lionrock.taskactive.topaz = true
            end
        end
    end

    if item:getId() == lion_item.sapphire and toPosition.x == lion_pos.sapphire.x and toPosition.y == lion_pos.sapphire.y  and toPosition.z == lion_pos.sapphire.z then
        -- Sapphire
        if self:getStorageValue(lionrock.storages.translation2) == 1 then
            if lionrock.taskactive.sapphire ~= true then
                addEvent(function()
                    local sapphire = Tile(lion_pos.sapphire):getItemById(lion_item.sapphire)
                    if sapphire ~= nil then
                        sapphire:remove(1)
                    end
                end, 0)
                Game.createItem(lion_item.blueflame, 1, lion_pos.sapphire)
                self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You place the sapphire on the small socket. A blue flame begins to burn.")
                lionrock.taskactive.sapphire = true
            end
        end
    end

    if item:getId() == lion_item.amethyst and toPosition.x == lion_pos.amethyst.x and toPosition.y == lion_pos.amethyst.y  and toPosition.z == lion_pos.amethyst.z then
        -- Amethyst
        if self:getStorageValue(lionrock.storages.translation4) == 1 then
            if lionrock.taskactive.amethyst ~= true then
                addEvent(function()
                    local amethyst = Tile(lion_pos.amethyst):getItemById(lion_item.amethyst)
                    if amethyst ~= nil then
                        amethyst:remove(1)
                    end
                end, 0)
                Game.createItem(lion_item.violetflame, 1, lion_pos.amethyst)
                self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You place the amethyst on the small socket. A violet flame begins to burn.")
                lionrock.taskactive.amethyst = true
            end
        end
    end

    -- Adding the Fountain which gives present
    if lionrock.taskactive.ruby == true and lionrock.taskactive.sapphire == true and lionrock.taskactive.amethyst == true and lionrock.taskactive.topaz == true then
        local stone = Tile(lion_pos.fountain):getItemById(lion_item.fountainstone)
        if stone ~= nil then
            stone:remove()
            local fountain = Game.createItem(lion_item.rewardfountain, 1, lion_pos.fountain)
            fountain:setActionId(lionrock.actionIds.fountain)
            self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Something happens at the centre of the room ...");
        end
    end
    ---- LIONS ROCK END
 
Last edited:
Solution
Back
Top