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

Can only store certain items inside the bag

Zazeros

Member
Joined
Feb 13, 2012
Messages
67
Reaction score
17
0.4
Just want to know (and if possible, how).
There is a way to make a bag, and you can't store any item unless it is specify in the script? Like an quiver, you can only store arrows.
Thanks
 
Solution
Without source edit, it's gonna be really challenging, if not impossible.

onThrow / onMove will take most of the logic, and that's if your specific tfs 0.x has either of these functions.
Some do, some don't.

Your next issue is worrying about random shit, like trading with other players.
If your main backpack is full, it might throw that shit into your quiver type scenario's.
Same issue, but with quest chests or Npc's giving the player items via script.

I'm not certain.. but I don't remember a function that can find the parent container. That would be useful if it exists. might be something called a cylinder. Might not exist at all. Might have to create your own function.

--
That being said, if you can figure out a way around all of...
Without source edit, it's gonna be really challenging, if not impossible.

onThrow / onMove will take most of the logic, and that's if your specific tfs 0.x has either of these functions.
Some do, some don't.

Your next issue is worrying about random shit, like trading with other players.
If your main backpack is full, it might throw that shit into your quiver type scenario's.
Same issue, but with quest chests or Npc's giving the player items via script.

I'm not certain.. but I don't remember a function that can find the parent container. That would be useful if it exists. might be something called a cylinder. Might not exist at all. Might have to create your own function.

--
That being said, if you can figure out a way around all of these random and small issues, it might be possible via Lua.

--
Edit

There is one other way that might be possible.. but only if the function exists..
Where your container starts with 0 slots, and you drag&drop arrows onto the arrow container.. and then you expand/collapse the container slot amount to exactly fit the arrow stacks that are remaining.

I remember playing with a function that could do this.. but it might've been only available on our heavily modified 0.3.7
and I can't remember what it's called..

But worth looking out for.
 
Solution
There is another workaround but it requires sources edit (nothing complex, just passing the cylinder/container as parameter)

And then you could do something like this:
Lua:
function onThrow(cid, item, count, fromPosition, toPosition, fromContainer, toContainer)
  if toContainer then
    if toContainer.itemid == 1777 then -- quiver
      if item.itemid ~= 1000 then -- item we are moving
        return false
      end
    end
  end
  return true
end

So new parameters are fromContainer, toContainer
Since im using 0.3.7, onThrow it was already there i just added new parameters

Still you may facing those problems that Xikini said
Your next issue is worrying about random shit, like trading with other players.
If your main backpack is full, it might throw that shit into your quiver type scenario's.
Same issue, but with quest chests or Npc's giving the player items via script.
 
@Xikini @Roddet
Thx for the reply guys, sorry for the delay to answer.
My source have a lot of errors and i can't compile them, so i kinda just give up of the idea, sorry.
But thanks a lot for the reply.
 
Back
Top