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

Compiling How to create new item attributes

Summ

(\/)(;,,;)(\/) Y not?
Staff member
Global Moderator
Joined
Oct 15, 2008
Messages
4,152
Solutions
12
Reaction score
1,107
Location
Germany :O
Hey guys

Since I am no pro at C++, I tried to add a new item attribute. First I had a problem that the server couldn't load items.otb, but I fixed that.
Now if I start my server the new attribute works, but somehow I can't move. Every tile item is "blocking", it pushes me back. Also tile items like stone tiles are above stairs (like there is a box under the tile).

Which part of source does affect this and what did I do wrong?
Where do I need something about the new attribute?
What I did:
•items.cpp: add so the attribute is read in xml
•luascript.cpp: added on getItemInfo (not really nessecary)
•item.h: added prototype to get item attribute
•item.h: function like this:
[cpp] inline int32_t Item::get*Attribute*()[/cpp]
•items.h: added to:
[cpp]uint32_t shootRange, charges, decayTime, attackSpeed, wieldInfo, minReqLevel, minReqMagicLevel, worth, levelDoor;[/cpp]

Screen:
scrfe.jpg



Edit (With debug mode on):
Code:
[16:55:37.842] [Error - Item::CreateItem] Item 203 has been declared as deprecat
ed
[16:55:37.842] Error: [Game::transformItem] Item of type 1506 transforming into
invalid type 203
[16:55:42.822] [Error - Item::CreateItem] Item 200 has been declared as deprecat
ed
[16:55:42.823] [Error - Item::CreateItem] Item 200 has been declared as deprecat
ed
[16:55:42.823] [Error - Item::CreateItem] Item 200 has been declared as deprecat
ed
[16:55:42.824] [Error - Item::CreateItem] Item 200 has been declared as deprecat
ed
 
Last edited:
Why should I edit .dat which only handles the sprites?
Why should I edit any of those if I just add a new custom attribute.
 
Maybe you don't add code which is showing attribute in item:
Code:
	if(it.[COLOR="red"]attributeName[/COLOR] || (item && item->get[COLOR="red"]AttributeName[/COLOR]()))
	{
		s << std::endl << "[COLOR="red"]Attribue Name: [[/COLOR]" << int32_t(item ? item->get[COLOR="red"]AttributeName[/COLOR]() : it.[COLOR="red"]attributeName[/COLOR]) << "[COLOR="red"]].[/COLOR]" << std::noshowpos;
	}

(Red = change it)

Add this in item.cpp before:

Code:
	if(lookDistance <= 1 && it.pickupable)
 
I already have code displaying the attribute. Also that wouldnt explain why I have this problem
 
I added attribute too. And I had the same problem but I solve it (but I don't know how :p) ^_^

Have you changed something in items.h?? :huh:
 
I fixed it now, but I don't know how and why^^
Just rewrote some codes or so xD
 
Back
Top