• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

C++ TFS 1.0 ADD NEW ITEM ATTRIBUTE

Azleh

Well-Known Member
Joined
Mar 2, 2009
Messages
434
Solutions
5
Reaction score
58
Location
Underworld
Hello everyone, i have a new request, i was experimenting with the TFS 1.0 sources but i failed to add something small, the following thing what i want to add it's just a Price description, something like:

Code:
15:47 See a bag (Vol:8).
It weighs 8.02 oz.
Price: 100 USD$

Having a tag via items.xml:
Code:
<attribute key="price" value="100 USD$" />

I wish what someone can help me, greetings xD
 
That req source edit, just see how they made with other attributes and just copy. But if you have no C++ knowlegde, just forget it. Use onLook and do it instead.
 
I know c++ and i know how to edit the source, but i tried that without success, that why i'm asking a faster way to add it, because via onLook doesn't work for me (I preffer to add it via items.xml, to have a global value by ID)...
 
Just look on how other attributes such as unique ID are being set.
Copy that functionality and define your own attribute and its done.
If you know how to code in C++, this shouldn't be hard at all, just search through the code and you'll understand it.
 
I know c++ and i know how to edit the source, but i tried that without success, that why i'm asking a faster way to add it, because via onLook doesn't work for me (I preffer to add it via items.xml, to have a global value by ID)...
Well, no idea why onLook is not working for you:
8MLzKL.png
 
Well, no idea why onLook is not working for you:
8MLzKL.png
That's the kind of system what i want, but with the tag at the items.xml because doing it by the way what u are saying it will need to have the attribute set, and i want to add to loot items and more...
 
That's the kind of system what i want, but with the tag at the items.xml because doing it by the way what u are saying it will need to have the attribute set, and i want to add to loot items and more...

What he is saying is that if you are going to go through all the trouble of putting that tag on each item, would be just as easy to make a table inside the onLook function. The only way that (custom) attribute would do you any more good was if you were going to utilize that tag for something other than just looking at the item. Even so, really what you are wanting done is very much possible through .lua anyways.
 
There is nothing complicated ...
Code:
local itemPrices = {
    [2160] = 5
}

local priceTable = itemPrices[thing.itemid]
if priceTable then
    print("Price: ".. priceTable .."$")
end
 
Back
Top