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

C++ setCustomAttribute in source

ohman

Member
Joined
Oct 24, 2008
Messages
294
Reaction score
8
Location
Sweden
Hey! :)

I'm currently working on a project where I need to set a custom attribute in the source code and then access it in Lua. Here's what I've done so far:

In Source Code:
newItem->setIntAttr(ITEM_ATTRIBUTE_CORPSEOWNER, 321);
newItem->setCustomAttribute("TEST", "123");

In Lua:
print(item:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER))
print(item:getCustomAttribute("TEST"))

Console Output:
321.0
nil

As you can see, while the integer attribute ITEM_ATTRIBUTE_CORPSEOWNER returns the expected value of 321, the custom attribute "TEST" returns nil. I've tried different variations of setCustomAttribute, with and without quotation marks around the value, but this is the only way that allows the code to compile.

-- BlackTek server (based on TFS 1.4.2)
 
Back
Top