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

Help with storage number and value

Toast

New Member
Joined
Feb 28, 2008
Messages
150
Reaction score
0
My server is Forgotten server 0.3.2 client 8.4.
The trouble im having is I have a quest NPC who is supposed to give you a storage number after doing his quest so you can pull a lever to get to the next area.
The Problem is after talking to the npc he sets your storage value to 50215 with a value of 1.
And this alone lets you pass lever.
If you do his quest that value becomes 2
How can I fix it so you must do his quest to use lever?
Thank you for any help.



NPC script

Code:
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
function creatureSayCallback(cid, type, msg)
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    --[[
    REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
    ]]--
    local storage = 50215
    if(msgcontains(msg, 'quest') or msgcontains(msg, 'Death Certificate')) then
        if(getPlayerStorageValue(cid, storage) < 1) then
            npcHandler:say("Hey, I have quest for you. Bring me please {Death Certificate}.", cid)
            setPlayerStorageValue(cid, storage, 1)
        elseif(getPlayerStorageValue(cid, storage) == 1) then
            npcHandler:say("Do you have the Death Certificate?", cid)
            talkState[talkUser] = 1
        elseif(getPlayerStorageValue(cid, storage) == 2) then
            npcHandler:say("Sorry, you have already done my quest.", cid)
        end
    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        if(doPlayerRemoveItem(cid, 7703, 1) == TRUE) then
            npcHandler:say("Thanks! As I said, here\'s 100 god coins and some exp!", cid)
                        doPlayerAddExp(cid, 20000000)
            doPlayerAddItem(cid, 6527, 100)
            setPlayerStorageValue(cid, storage, 2)
                        doSendMagicEffect(getPlayerPosition(cid),11)
            talkState[talkUser] = 0
        else
            npcHandler:say("Sorry, you don\'t have Death Certificate.", cid)
            talkState[talkUser] = 0
        end
    elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
        npcHandler:say("Then not.", cid)
        talkState[talkUser] = 0
    end
    return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Action script

Code:
function onUse(cid, item, frompos, item2, topos)

      -- from mainland to island
      if item.uid == 15100 then
          queststatus = getPlayerStorageValue(cid,50215)

          if queststatus == -1 then
              doPlayerSendTextMessage(cid,22,"The Mayor of Munchkinland has not given you the power to go here.")
          else
            gopos = {x=1400, y=1127, z=7}
              doTeleportThing(cid, gopos)
        end      -- from island to mainland
      elseif item.uid == 15101 then
          backpos = {x=1402, y=1125, z=7}
          doTeleportThing(cid, backpos)

    else
        return 0
      end

      return 1
end
 
Code:
if queststatus == 2 then
     doTeleportThing(cid, {x=1400, y=1127, z=7})
else
     doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "The Mayor of Munchkinland has not given you the power to go here.")     
end     -- from island to mainland
 
Code:
if queststatus == 2 then
     doTeleportThing(cid, {x=1400, y=1127, z=7})
else
     doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "The Mayor of Munchkinland has not given you the power to go here.")   
end     -- from island to mainland

Code:
-- function SendAnmi(cid)
-- stone_pos={x=562,y=1591,z=8,stackpos=1}
       -- num = getGlobalStorageValue(98575)
-- stone = getThingfromPos(stone_pos)
   -- if stone.itemid == 6966 then
       -- --if num>0 then
       -- --   setGlobalStorageValue(98575, -1)
     -- --   end
   -- else
  

       -- num = num -1
       -- n = num + 17
       -- doSendAnimatedText(stone_pos, "".. n .."", TEXTCOLOR_RED)
     -- if num == 0 then
         -- num=17
     -- end
       -- setGlobalStorageValue(98575, num)

   -- end
-- end




function onStepIn(cid, item, pos)
pos1={x=556,y=1580,z=8,stackpos=1}
pos2={x=568,y=1589,z=8,stackpos=1}
stone_pos={x=562,y=1591,z=8,stackpos=1}
stone = getThingfromPos(stone_pos)
local found = nil
local player=nil
     for arenax = pos1.x, pos2.x  do
           for arenay = pos1.y, pos2.y  do
             for sp=0,253 do
               arenapos = {x=arenax, y=arenay, z=pos1.z, stackpos=sp}
                 slain1 = getThingfromPos(arenapos)
              
                 if slain1.itemid == 3028 then
                   found = true
                   x=slain1.duration
                  
                 end  
             end    
           end
       end
      
      
      
         if found and stone.itemid == 6966 then
           doRemoveItem(stone.uid,1)
           doSendMagicEffect(stone_pos, 41)
          
           for arenax = pos1.x, pos2.x  do
           for arenay = pos1.y, pos2.y  do
             for sp=0,253 do
               arenapos = {x=arenax, y=arenay, z=pos1.z, stackpos=sp}
                 slain1 = getThingfromPos(arenapos)
              
                 if slain1.itemid == 3028 then
                
                
                     for x = 1, 15 do

     end
             end    
           end
           end  
       end
         end  


          if found ~=true and stone.itemid ~= 6966 then
            doCreateItem(cid,6966,1,stone_pos)
            doSendMagicEffect(stone_pos, 43)
         end

end
 
Last edited by a moderator:
Back
Top