• 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 choose 1 chest only give mount tfs 1.3

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hello guys, if possible, would anyone of u great coders do this? i have searched but i havent found anything like this, a quest like anihilator, where you choose only 1 chest, but it gives you a mount, not an item, for tfs 1.3 :D
 
Solution
Sorry for miss understood, u want all gives mount right? i made this code, not tested, let me know if works
Lua:
 local chests = {
    [20000] = {mountid = 80},
    [20001] = {mountid = 81},
    [20002] = {mountid = 82},
    [20003] = {mountid = 83},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local chest = chests[item.uid]
    if chests[item.uid] then
    if player:getstorageValue(35000) ~= 0 then
       player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
      return true
      end
    if chest[20000] then
    player:setStorageValue(35000,1)
    player:addMount(80)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get the Plumfish Mount.')
    elseif chest[20001] then
    player:setStorageValue(35000,1)...
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mountid = (Mountid) - add here the mount id
    doPlayerAddMount(cid, mountid) --add the mount
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations you got a new mount!") --message in console (red)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED) --effect on player
    return TRUE
end
This works for TFS 1.0 and 1.1 u can try convert this on 1.3 or maybe works
just add storage
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local mountid = (Mountid) - add here the mount id
    doPlayerAddMount(cid, mountid) --add the mount
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations you got a new mount!") --message in console (red)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED) --effect on player
    return TRUE
end
This works for TFS 1.0 and 1.1 u can try convert this on 1.3 or maybe works
just add storage
"where you choose only 1 chest"
 
Lua:
local chests = {
    [9008] = {itemid = 2495, count = 1},
    [9009] = {itemid = 8905, count = 1},
    [9010] = {itemid = 16111, count = 1},
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if chests[item.uid] then
        if player:getStorageValue(9999) ~= 0 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
            return true
        end

        local chest = chests[item.uid]
        local itemType = ItemType(chest.itemid)
        if itemType then
            local article = itemType:getArticle()
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. (#article > 0 and article .. ' ' or '') .. itemType:getName() .. '.')
        end   
        player:addItem(chest.itemid, chest.count)
        player:setStorageValue(9999,1)
    end
     elseif chest[9012] and  player:getStorageValue(9990) ~= 1 then
      player:addMount(MountID)
      player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get a new Mount.')
      player:setStorageValue(9999,1)
      else 
      player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.') 
    return true
end
end
try this, no tested
 
Lua:
local chests = {
    [9008] = {itemid = 2495, count = 1},
    [9009] = {itemid = 8905, count = 1},
    [9010] = {itemid = 16111, count = 1},
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if chests[item.uid] then
        if player:getStorageValue(9999) ~= 0 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
            return true
        end

        local chest = chests[item.uid]
        local itemType = ItemType(chest.itemid)
        if itemType then
            local article = itemType:getArticle()
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. (#article > 0 and article .. ' ' or '') .. itemType:getName() .. '.')
        end  
        player:addItem(chest.itemid, chest.count)
        player:setStorageValue(9999,1)
    end
     elseif chest[9012] and  player:getStorageValue(9990) ~= 1 then
      player:addMount(MountID)
      player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get a new Mount.')
      player:setStorageValue(9999,1)
      else
      player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
    return true
end
end
try this, no tested
that is for items :(
Use the search function, literally released like 10 days ago.
Action - Quest Chests on Steroids TFS 1.2

thanks! gonna test that ;)
 
Lua:
   elseif chest[9012] and  player:getStorageValue(9990) ~= 1 then
this code if the chest has uniqueID 9012 is gonna give you a mount, you check it at least?
 
Lua:
   elseif chest[9012] and  player:getStorageValue(9990) ~= 1 then
this code if the chest has uniqueID 9012 is gonna give you a mount, you check it at least?
im sorry im having trouble understanding the code, how in there i can choose 1 out of three?
 
Lua:
local chests = {
    [9009] = {itemid = 2495, count = 1},
    [9010] = {itemid = 8905, count = 1},
    [9011] = {itemid = 16111, count = 1},
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if chests[item.uid] then
        if player:getStorageValue(9999) ~= 0 then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
            return true
        end

        local chest = chests[item.uid]
        local itemType = ItemType(chest.itemid)
        if itemType then
            local article = itemType:getArticle()
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. (#article > 0 and article .. ' ' or '') .. itemType:getName() .. '.')
        end 
        player:addItem(chest.itemid, chest.count)
        player:setStorageValue(9999,1)
    end
     elseif chest[9012] and  player:getStorageValue(9990) ~= 1 then
      player:addMount(MountID)
      player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get a new Mount.')
      player:setStorageValue(9999,1)
      else
      player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
    return true
end
end
Well in local chest
Lua:
local chests = {
    [9009] = {itemid = 2495, count = 1},
    [9010] = {itemid = 8905, count = 1},
    [9011] = {itemid = 16111, count = 1},
}
9008,9,10 means the UNIQUEID from the chest, u should add those in your map editor
For example if you use 4 chest, then 1 chest must have 9008, another 9009 another 9010 and the last 9011
then {itemid = 2495, count = 1}, here u can edit which items is gonna get and the count if is money or stuff like this
then in actions xml you should add
XML:
   <action uniqueid="9009" script="chest.lua"/>
  <action uniqueid="9010" script="chest.lua"/>
  <action uniqueid="9011" script="chest.lua"/>
   <action uniqueid="9012" script="chest.lua"/>
Lua:
     elseif chest[9012] and  player:getStorageValue(9990) ~= 1 then
      player:addMount(MountID)
in this part where it says mountID you need to put mountID, you can looking for it on mounts.xml
 
Sorry for miss understood, u want all gives mount right? i made this code, not tested, let me know if works
Lua:
 local chests = {
    [20000] = {mountid = 80},
    [20001] = {mountid = 81},
    [20002] = {mountid = 82},
    [20003] = {mountid = 83},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local chest = chests[item.uid]
    if chests[item.uid] then
    if player:getstorageValue(35000) ~= 0 then
       player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
      return true
      end
    if chest[20000] then
    player:setStorageValue(35000,1)
    player:addMount(80)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get the Plumfish Mount.')
    elseif chest[20001] then
    player:setStorageValue(35000,1)
    player:addMount(81)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get the Gorongra Mount')
    elseif chest[20002] then
    player:setStorageValue(35000,1)
    player:addMount(82)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get the Noctungra Mount')
    elseif chest[20003] then
    player:setStorageValue(35000,1)
    player:addMount(83)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get the Silverneck Mount.')
    return true
end
end
end
 
Sorry for miss understood, u want all gives mount right? i made this code, not tested, let me know if works
Lua:
 local chests = {
    [20000] = {mountid = 80},
    [20001] = {mountid = 81},
    [20002] = {mountid = 82},
    [20003] = {mountid = 83},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local chest = chests[item.uid]
    if chests[item.uid] then
    if player:getstorageValue(35000) ~= 0 then
       player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
      return true
      end
    if chest[20000] then
    player:setStorageValue(35000,1)
    player:addMount(80)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get the Plumfish Mount.')
    elseif chest[20001] then
    player:setStorageValue(35000,1)
    player:addMount(81)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get the Gorongra Mount')
    elseif chest[20002] then
    player:setStorageValue(35000,1)
    player:addMount(82)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get the Noctungra Mount')
    elseif chest[20003] then
    player:setStorageValue(35000,1)
    player:addMount(83)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get the Silverneck Mount.')
    return true
end
end
end
Assuming the code is working as intended, I made your script a bit more organised.
Hopefully you can learn from this and it will help you and your scripts in the future. :oops:

Lua:
local storage = 35000
local chests = {
    [20000] = {mount_id = 80, mount_name = "Plumfish Mount"},
    [20001] = {mount_id = 81, mount_name = "Gorongra Mount"},
    [20002] = {mount_id = 82, mount_name = "Noctungra Mount"},
    [20003] = {mount_id = 83, mount_name = "Silverneck Mount"},
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getstorageValue(storage) == 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It's empty.")
        return true
    end
 
    local chest = chests[item.uid]
    if chest then
        player:setStorageValue(storage, 1)
        player:addMount(chest.mount_id)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received the " .. chest.mount_name .. ".")
    end
    return true
end

-- Edit

The actions.xml line should only contain a single line and that is for 'actionid'.
The chests on the map editor should contain both the actionid from actions.xml, and the uniqueid from the table in the above script. 20000, 20001, 20002, 20003, as exampled by CharlesHudson.
 
Last edited:
Solution
Assuming the code is working as intended, I made your script a bit more organised.
Hopefully you can learn from this and it will help you and your scripts in the future. :oops:

Lua:
local storage = 35000
local chests = {
    [20000] = {mount_id = 80, mount_name = "Plumfish Mount"},
    [20001] = {mount_id = 81, mount_name = "Gorongra Mount"},
    [20002] = {mount_id = 82, mount_name = "Noctungra Mount"},
    [20003] = {mount_id = 83, mount_name = "Silverneck Mount"},
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getstorageValue(storage) == 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
        return true
    end
 
    local chest = chests[item.uid]
    if chest then
        player:setStorageValue(storage, 1)
        player:addMount(chest.mount_id)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received the " .. chest.mount_name .. ".")
    end
    return true
end
LOVE YOU <3
 
Assuming the code is working as intended, I made your script a bit more organised.
Hopefully you can learn from this and it will help you and your scripts in the future. :oops:

Lua:
local storage = 35000
local chests = {
    [20000] = {mount_id = 80, mount_name = "Plumfish Mount"},
    [20001] = {mount_id = 81, mount_name = "Gorongra Mount"},
    [20002] = {mount_id = 82, mount_name = "Noctungra Mount"},
    [20003] = {mount_id = 83, mount_name = "Silverneck Mount"},
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getstorageValue(storage) == 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It's empty.")
        return true
    end
 
    local chest = chests[item.uid]
    if chest then
        player:setStorageValue(storage, 1)
        player:addMount(chest.mount_id)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received the " .. chest.mount_name .. ".")
    end
    return true
end

-- Edit

The actions.xml line should only contain a single line and that is for 'actionid'.
The chests on the map editor should contain both the actionid from actions.xml, and the uniqueid from the table in the above script. 20000, 20001, 20002, 20003, as exampled by CharlesHudson.
oh im sorry man im getting this error

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/monturas1.lua:onUse
data/actions/scripts/monturas1.lua:10: attempt to call method 'getstorageValue' (a nil value)
stack traceback:
        [C]: in function 'getstorageValue'
        data/actions/scripts/monturas1.lua:10: in function <data/actions/scripts/monturas1.lua:9>
 
Just for test
Lua:
local storage = 35000
local chests = {
    [20000] = {mount_id = 80, mount_name = "Plumfish Mount"},
    [20001] = {mount_id = 81, mount_name = "Gorongra Mount"},
    [20002] = {mount_id = 82, mount_name = "Noctungra Mount"},
    [20003] = {mount_id = 83, mount_name = "Silverneck Mount"},
}


function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(storage) == 1 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It\'s empty.')
        return true
    else
    local chest = chests[item.uid]
    if chest then
        player:setStorageValue(storage, 1)
        player:addMount(chest.mount_id)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received the " .. chest.mount_name .. ".")
    end
    return true
end
end
EDIT fixed and tested, now should be ok
 
Last edited:
Back
Top