• 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 to obtain storage that allows you to open two doors

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,470
Solutions
27
Reaction score
844
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
Hi, if its possible I want to request a script =) for Tfs 1.3 revscriptsys..
This picture should explain it:
quest explaination.png

The main idea is
1. A player that use the chest will obtain permanent access to 2 doors ubicated in different places.
2. If player doesnt have the storage, the script will send him a message saying him that is not allowed to pass.
3. (extra) If is possible, recieve a reward aswell for each chest opened.

Thanks in advance, hope someone can do this request =P
 
Solution
Lua:
function onUse(player, item, fromPosition, itemEx, toPosition)
    local doorPosition = toPosition
    local newPos = doorPosition
    newPos.y = doorPosition.y + 1
    if player:getPosition().y > doorPosition.y then
        newPos.y = newPos.y - 2
    end
    if isInArray(questDoors, item.itemid) then
        if player:getStorageValue(7357) ~= -1 then
            player:teleportTo(newPos)
            return true
        else
            player:sendMessage("You have not finished the first seal.")
        end
    end
    return false
end
try this
I believe this should work, I havent tested it. Place in your action script folder, name the files. Change storage ID's to prevent overlapping.



Code:
local storage = 2468  -- Set your chest storage ID here

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(storage) > 0 then
        player:sendCancelMessage("The chest is empty!")
        return true
    else
    player:addItem(2160,1) --Change to the Item reward, Crystal Coin x1
    player:setStorageValue(1234,1)   --change to the storage you want the DOOR to read
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You now have access to the Door.') --Change to whatever you want to say
    end
return true
end

Code:
local storage = 1234  -- Set your DOOR storage ID here (Should match the storage of the CHEST

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(storage) > 0 then
        
        return true
    else
    player:teleportTo(fromPosition, true)
    player:sendCancelMessage("You did not complete the first part of the quest!")
    end
return true
end
 
@athenso thanks a lot for making it!! i couldnt test it before, this are the results of tests:

-when i use the door my player get over it, and the message you did not complete the first part is send...
bug.png

- i can use the chest infinite times i want, but, is giving the reward and message..
chest.png

-after i used the chest, the door stop working when using.. it just dont send anything and also you can look at it with shift + click
no work.png

if you can help me fixing this script i'll be very gratefull, thanks in advance!
 
change the last return true to return false in doors.lua. In chests.lua line #9 change “1234” to storage
 
I guess I should have been a bit more descriptive. Don’t leave those storages as I set them. They are just basic numbers and probably used already. Set them to an unused storage
 
Lua:
local storage = 15670  -- Set your chest storage ID here

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(storage) == 1 then
        player:sendCancelMessage("The chest is empty!")
        return true
    else
        player:addItem(2160,1) --Change to the Item reward, Crystal Coin x1
        player:setStorageValue(storage, 1)   --change to the storage you want the DOOR to read
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You now have access to the Door.') --Change to whatever you want to say
    end
    return true
end
-----------door
-----------------------------------------------------------------------------------------------------------
local storage = 15670  -- Set your DOOR storage ID here (Should match the storage of the CHEST

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(storage) == 1 then  
        return true
    else
        player:teleportTo(fromPosition, true)
        player:sendCancelMessage("You did not complete the first part of the quest!")
    end
    return false
end
 
thanks again @Rombadr , after some searching i saw this post and its very close to what i need. i clarified more and i just added the chest storage to system.lua to make door recognize it, the chest part is solved...

Lua:
local quest = {x=1340,y=890,z=9}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local doorPosition = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
    local doorCreature = getThingfromPos(doorPosition)
    if isInArray(questDoors, item.itemid) == TRUE then
        if getPlayerStorageValue(cid, 7357) ~= -1 then
            doTransformItem(item.uid, item.itemid + 1)
            doTeleportThing(cid, quest, TRUE)
       
        else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You dont have finished the first seal yet.")
    end
return TRUE
end
return FALSE
end

but i only have one problem now....

2.png
- this is how it works now, the player uses the door and gets teleported by doTeleportThing(cid, quest, TRUE), the bad thing about this is that the door will stay opened unless you walk into it and that looks bad

- other problem is that the message "06:00 The door seems to be sealed against unwanted intruders." is sent onStepIn, i dont know how to make this door an exception considering that its item id is registered

3.png
- this is how i want it to work, i dont know what to use instead of doTeleportThing guess it should be something like
toPosition.y = toPosition.y - 1, toPosition.y = toPosition.y + 1 depending of which side of the door is the player (i dont know how to do that)... if is possible to use the door, and move the player like is described on the image, with the animation of the open/closed door, that would be great ^^

thanks again for all the help !!
 
Last edited:
Lua:
function onUse(player, item, fromPosition, itemEx, toPosition)
    local doorPosition = toPosition
    local newPos = doorPosition
    newPos.y = doorPosition.y + 1
    if player:getPosition().y > doorPosition.y then
        newPos.y = newPos.y - 2
    end
    if isInArray(questDoors, item.itemid) then
        if player:getStorageValue(7357) ~= -1 then
            player:teleportTo(newPos)
            return true
        else
            player:sendMessage("You have not finished the first seal.")
        end
    end
    return false
end
try this
 
Solution
Problem solved, at the end I will use this script.

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.actionid == 1385 and player:getStorageValue(7357) ~= -1 then   --- ~= significa no es igual a...
        local destination = Position(1784, 661, 9)
        player:teleportTo(destination)
        destination:sendMagicEffect(CONST_ME_YALAHARIGHOST)
        fromPosition:sendMagicEffect(CONST_ME_POFF)
        player:say("You absorbed a soul that allows you to pass through the door. If you want to go back, use the magic mirror.", TALKTYPE_MONSTER_SAY)
    else
        local destinat = Position(1784, 663, 9)
        local destina = Position(1783, 659, 9)
        player:teleportTo(destinat)
        player:say("If you have unlocked the first seal you will be allowed to pass through the door.", TALKTYPE_MONSTER_SAY)
        fromPosition:sendMagicEffect(CONST_ME_MIRRORVERTICAL)
        destinat:sendMagicEffect(CONST_ME_POFF)
        destina:sendMagicEffect(CONST_ME_TUTORIALARROW)
        destina:sendMagicEffect(CONST_ME_TUTORIALSQUARE)
    end
    return true
end

Marked Rombadr answer as best because he was very close to my request...
Added image of how the final script works...
 

Attachments

Just for future views, as reminder, here's much better script for this:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(22255) == 1 then
        if item.itemid == 10791 then
            player:teleportTo(toPosition, true)
            item:transform(item.itemid + 1)
        end
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Primero debes completar la mision 'Sacramento de la Serpiente' de 'La Ira Del Emperador'.")
    end
    return true
end
 
Back
Top