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

Solved...

Zikerus

Nutria Developer
Joined
Mar 13, 2008
Messages
193
Reaction score
0
Location
Poole, UK
The problem is I changed slightly weight system and...

PHP:
17:08 You see a wolf paw.
It weighs
130538193412406016583175846617338949631921956412654983784592231897503130771894169100411864897279076173480714552265641579494817760322525250292449919393859192157
56041198603798113221932595414105686381821928001124621935292008530305837342809352449929130731786846580563247104.00 oz.
The thing is I can't find any error and belive me, I exactly know what have I done and I am almost sure I made it right. What did exactly I made? I made function to change item weight (for example you can have knight legs that weighs 50 oz etc.) and it's stored in item attributes as object of class attribute (same as extra attack, extra defs, special texts etc.). I added it to serialize functions, vaildation functions etc. I also changed display, so it will display it's proper weight instead of standard item weight, I think this code is correct:

PHP:
double weight;
		if(item && item->hasAttribute(ATTR_ITEM_WEIGHT))
		double weight = item->getItemWeight();
		else
		double weight = it.weight;
		if(weight > 0)
			s << std::endl << getWeightDescription(it, weight);
I can't see the reason it display wrong weight (actually, random numbers). This is definition (inline) of function that sets new weight:
PHP:
void setItemWeight(int32_t weight) {setIntAttr(ATTR_ITEM_WEIGHT, weight);}
That is function which get its weight from object:
PHP:
int32_t getItemWeight() const {return hasAttribute(ATTR_ITEM_WEIGHT) ? getIntAttr(ATTR_ITEM_WEIGHT) : items[id].weight;}
I am not sure, but I have no error when compiling and I don't use any casting for int->double, double->int, do I need to?

If u need more info, any specific functions I will provide them of course.

@edit
It counts weight properly, when equip, dequip, put into bp, anywhere ;p

@edit2
I fixed wrong weight display, but still failed ;D Now it doesn't count weight when I put something with "unique" weight into my bp. It also does not show container weight if something is in there (it shows 18 oz. for backpack and ignore items inside). It takes me also 18 oz. when I put this bp (with items inside) into my hand or whatever (except my backpack). I know I am insane lol :D I think I messed up with containers :p I am going to take original one.

@EDIT3
Nice !! :) Nil replies :D I solved that by myself... I think there is no reason to help other ppl because when u need help there are no one to help... :/
 
Last edited:
Back
Top Bottom