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

I think i need a basic script.

Rafaelizidoro

New Member
Joined
Jan 5, 2013
Messages
9
Reaction score
0
I need the following script to create a simplified Postman.

1º Talk with an NPC so that it gives access to a port with storage.
2nd to access this port, use a crowbar and hit the mail box.
3rd when hitting the mail box, releasing another storage to access another mail box
(I want to make that player do this procedure for 4 times before having access to all the mailboxes of mail)
4th if possible, have the player come back and talk to the NPC to finish the quest.

NOTE: I believe that what you will really need is just the NPC with the beginning of the mission to give the first storage and the end to give the storage with the access to the other boxes of mail.

From the second mail box, it would be the same script, only different storage to be able to proceed.
 
I can probably do this for you but you are going to have to make a better effort to translate what you want, currently I do not know exactly what you want to happen.
 
Here is a basic set up of that....

NPC
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid)       npcHandler:onCreatureAppear(cid)       end
function onCreatureDisappear(cid)     npcHandler:onCreatureDisappear(cid)       end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg)     end
function onThink()         npcHandler:onThink()           end

local storage_mail = 25175

function creatureSayCallback(cid, type, msg)
     if not npcHandler:isFocused(cid) then
         return false
     end
    
    player = Player(cid)

     local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    if msg == "first msg"then
        if player:getStorageValue(storage_mail) == nil then
            selfSay("...", cid)
            player:setStorageValue(storage_mail, 0)
        end
      

    elseif msg == "other msg" then
        if player:getStorageValue(storage_mail) == 4 then --Unlocked all mailboxes--
            selfSay("...", cid)
            player:setStorageValue(storage_mail, 5)
        end
    end
  
return true
end


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Action script for mailboxes
Lua:
local storage_mail = 25175

local mail_boxes = {
[1] = {uid = 1000, storage = 25176},
[2] = {uid = 1001, storage = 25177},
[3] = {uid = 1002, storage = 25178},
[4] = {uid = 1003, storage = 25179}
}


function onUse(player, item, fromPosition, target, toPosition, isHotkey)

    for i = 1, #mail_boxes do
        if mail_boxes[i].uid == item:getAttribute('uid') then
            BOX = mail_boxes[i]
        end
    end
  
    if not BOX then return false end

    if player:getStorageValue(BOX.storage) == nil then
        if player:getStorageValue(storage_mail) < 4 and player:getStorageValue(storage_mail) ~= nil then
            player:setStorageValue(storage_mail, player:getStorageValue(storage_mail) + 1)
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have unlocked this mailbox.")
            player:setStorageValue(BOX.storage, 1)
        end
    end

return true
end
 
@Aled Sorry, i'm from brazil and a i have a bad english rsr
@Itutorial i using a TFS 0.4 for 8.7. -- This is for 0.4?
(Question: after i get storages: 25176, 25177, 25178, 25179, the NPC get me storage 25175 to open all mail boxes?

i want a simple postman, npc to get a first storage to open the first door, script to after i 'hit' the mail box, get a new storage to open the next door, after i get the four storage, i unlock in the NPC all the rest doors to use a mail box.
 
Back
Top