• 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+ storages in name 1.5 7.72

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
882
Solutions
7
Reaction score
123
Location
Brazil
YouTube
caruniawikibr
Hi guys, I have a doubt, I'm setting up the rashid mission and I'm using the evil punker base, to set up the quest, I realized that in mission 2 the npc delivers a storage to have permission to open the door and get the package, but my doubt is which storage I put in the door and in the chest.

Willard - acess snake eye.

Lua:
local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if msgcontains(msg, "package for rashid") then
        if player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) >= 1 and player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) < 3 then
            npcHandler:say({
                "Oooh, damn, I completely forgot about that. I was supposed to pick it up from the Outlaw Camp. ...",
                "I can't leave my shop here right now, please go and talk to Snake Eye about that package... I promise he won't make any trouble. ...",
                "Don't tell Rashid! I really don't want him to know that I forgot his order. Okay?"
            }, cid)
            npcHandler.topic[cid] = 1
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say("Thank you, I appreciate it. Don't forget to mention the package to Snake.", cid)
            player:setStorageValue(PlayerStorageKeys.TravellingTrader.Mission02, player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) + 1)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end




snake Eye - acess package
Lua:
local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if msgcontains(msg, 'package for rashid') then
        if player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) >= 1 and player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) < 3 then
            npcHandler:say('So you\'re the delivery boy? Go ahead, but I warn you, it\'s quite heavy. You can take it from the box over there.', cid)
            player:setStorageValue(PlayerStorageKeys.TravellingTrader.Mission02, player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) + 1)
            npcHandler.topic[cid] = 0
        end

send package to rashid.
Lua:
elseif(npcHandler.topic[cid] == 5) then
            npcHandler:say("Fine. Then off you go, just ask Willard about the 'package for Rashid'.", cid)
            player:setStorageValue(PlayerStorageKeys.TravellingTrader.Mission02, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 6) then
            if player:removeItem(7503, 1) then
                npcHandler:say("Great. Just place it over there - yes, thanks, that's it. Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(PlayerStorageKeys.TravellingTrader.Mission02, 5)
                npcHandler.topic[cid] = 0
            end


quests.xml
XML:
<mission name="Mission 2: Delivery" storageid="990098" endvalue="5">
            <missionstate id="1" description="Your mission is to get the package from Willard the weapon dealer at Edron." />
            <missionstate id="2" description="Willard forgot to pick it up from Snake Eye at Outlaw Camp. So he wants you to go and pick it up from Snake Eye." />
            <missionstate id="3" description="Take the package just next door." />
            <missionstate id="4" description="Now bring back the package to Rashid." />
            <missionstate id="5" description="You have completed this mission. Talk with Rashid to continue." />
        </mission>


1655392293530.png
 
Solution
in that case it would be better for the npc to give the player the package
Less work, but not same as global!

just go data/scripts/actions, create a file and put that code inside in the same file, no need to create 2 files, change the values. do /reload scripts and done

heres the code to door and package:

Lua:
--- Package
local package = Action()
function package.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local itemID = ITEMID -- change here for the item id
    local itemType = ItemType(itemID)
    if player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) == 3 then
        if player:getFreeCapacity() >= itemType:getWeight() then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You...
Hi guys, I have a doubt, I'm setting up the rashid mission and I'm using the evil punker base, to set up the quest, I realized that in mission 2 the npc delivers a storage to have permission to open the door and get the package, but my doubt is which storage I put in the door and in the chest.

Willard - acess snake eye.

Lua:
local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if msgcontains(msg, "package for rashid") then
        if player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) >= 1 and player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) < 3 then
            npcHandler:say({
                "Oooh, damn, I completely forgot about that. I was supposed to pick it up from the Outlaw Camp. ...",
                "I can't leave my shop here right now, please go and talk to Snake Eye about that package... I promise he won't make any trouble. ...",
                "Don't tell Rashid! I really don't want him to know that I forgot his order. Okay?"
            }, cid)
            npcHandler.topic[cid] = 1
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say("Thank you, I appreciate it. Don't forget to mention the package to Snake.", cid)
            player:setStorageValue(PlayerStorageKeys.TravellingTrader.Mission02, player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) + 1)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end




snake Eye - acess package
Lua:
local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if msgcontains(msg, 'package for rashid') then
        if player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) >= 1 and player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) < 3 then
            npcHandler:say('So you\'re the delivery boy? Go ahead, but I warn you, it\'s quite heavy. You can take it from the box over there.', cid)
            player:setStorageValue(PlayerStorageKeys.TravellingTrader.Mission02, player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) + 1)
            npcHandler.topic[cid] = 0
        end

send package to rashid.
Lua:
elseif(npcHandler.topic[cid] == 5) then
            npcHandler:say("Fine. Then off you go, just ask Willard about the 'package for Rashid'.", cid)
            player:setStorageValue(PlayerStorageKeys.TravellingTrader.Mission02, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 6) then
            if player:removeItem(7503, 1) then
                npcHandler:say("Great. Just place it over there - yes, thanks, that's it. Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(PlayerStorageKeys.TravellingTrader.Mission02, 5)
                npcHandler.topic[cid] = 0
            end


quests.xml
XML:
<mission name="Mission 2: Delivery" storageid="990098" endvalue="5">
            <missionstate id="1" description="Your mission is to get the package from Willard the weapon dealer at Edron." />
            <missionstate id="2" description="Willard forgot to pick it up from Snake Eye at Outlaw Camp. So he wants you to go and pick it up from Snake Eye." />
            <missionstate id="3" description="Take the package just next door." />
            <missionstate id="4" description="Now bring back the package to Rashid." />
            <missionstate id="5" description="You have completed this mission. Talk with Rashid to continue." />
        </mission>


View attachment 68602
it looks like value 3 to open the door and also value 3 to pick up the package, and when picking up the package, it becomes value 4, preventing you from opening the door again and taking another package.

you will probably need to make 2 scripts, 1 for the door and 1 for the chest, to both check if the player has the quest value 3 and then deliver the value 4 when using the chest.

if you don't want to create scripts, you can put a specific storage for the door(like 9999 and put in the door too), but still you will need to make a script for the chest, because you need the value 4 when delivering the package.
 
in that case it would be better for the npc to give the player the package
Less work, but not same as global!

just go data/scripts/actions, create a file and put that code inside in the same file, no need to create 2 files, change the values. do /reload scripts and done

heres the code to door and package:

Lua:
--- Package
local package = Action()
function package.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local itemID = ITEMID -- change here for the item id
    local itemType = ItemType(itemID)
    if player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) == 3 then
        if player:getFreeCapacity() >= itemType:getWeight() then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
            player:addItem(itemID, 1)
            player:setStorageValue(PlayerStorageKeys.TravellingTrader.Mission02, 4)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemType:getWeight() .. ' oz. It\'s too heavy.')
        end
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
    end

    return true
end

package:uid(UNIQUE ID FROM MAP) -- coloque aqui o codigo uniqueid que você colocou no bau
package:register()


--- DOOR SCRIPT
local packdoor = Action()
function packdoor.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(PlayerStorageKeys.TravellingTrader.Mission02) == 3 then
            item:transform(item.itemid + 1)
            player:teleportTo(toPosition, true)
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.")
    end

    return true
end

packdoor:uid(UID FROM DOOR) -- coloque aqui o codigo uniqueid que você colocou na porta
packdoor:register()
 
Last edited:
Solution
Back
Top