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

Virtual Containers (TFS 1.1)

Acedayz

Member
Joined
Jan 24, 2015
Messages
38
Reaction score
19
Any ideas on how to implement virtual containers?

For example, a container that can be assigned an id which you use to open/close the container.
Code:
local container = Container(100)
player:openContainer(100)
container:addItem(2160, 100)

So I could use it to store items in them without actually having a container equipped.
I've been trying to figure it out myself for the past few hours with no success, so any help is appreciated.
 
Any ideas on how to implement virtual containers?

For example, a container that can be assigned an id which you use to open/close the container.
Code:
local container = Container(100)
player:openContainer(100)
container:addItem(2160, 100)

So I could use it to store items in them without actually having a container equipped.
I've been trying to figure it out myself for the past few hours with no success, so any help is appreciated.

You can't create virtual containers outside the source I don't think... The only virtual containers I can think of right now are the market and depot systems and I'm pretty sure those are both written in the source, but that would be where you should start looking, if you find out that one of them is scripted, then find the script, but like I said, I'm pretty certain it is done in the source....
 
protocolgame.cpp search for "switch (recvbyte) {"

add
Code:
cout << recvbyte;
above that to see received bytes when you click on purse icon
don't forget about compiling
after that you may implement your own function to switch instruction in sources

parseSeekInContainer(msg) - checking that function may be useful too
 
When you click the purse button is calling the parseUseItem, and the purse is on the slot 11. But since the purse doesn't have a spriteid/itemid you can't do much... Unless someone knows how to set a internal id like the browsefield container.
 
Code:
int32_t LuaScriptInterface::luaPlayerGetDepotChest(lua_State* L)
from luascript.cpp may be useful example
 
Code:
int32_t LuaScriptInterface::luaPlayerGetDepotChest(lua_State* L)
from luascript.cpp may be useful example
The real problem (at least to me) is assign some id or something to handle the purse event... But thanks you anyway ♥
 
if you use visual studio open tfs project and then luascript.cpp and right click on thing you're looking for and then "go to definition" to see where it's defined
it helps a lot in looking for stuff in sources

after that you may write similiar thing for your custom virtual container
 
I think that you didn't get what I was trying to say :p
At least can be useful for customs virtual containers (not purse).
 
Thanks for the help guys, but I managed to do it another way.
Would still be nice to have this function if someone could make it though.
 
Back
Top