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

Item Duration Help!

Deaktiver

Materia
Joined
Nov 25, 2007
Messages
637
Reaction score
4
Location
Germany
Hello,

i added a Item to my Ots (ID:2329) and put in items.xml:
<attribute key="duration" value="2592000"/>
<attribute key="showduration" value="1"/>
because I want that the Item dissapear after 30 days. But the Minutes does not gone. What I should have to do that the Item lost Minutes (like a ring). But the Item have to be in the Backpack and loose Items. How can I add it? And why are 2592000 not 30 days? Because when I look on the Items comes this Message:
22:37 You see a Card that has energy for 71554405 minutes left.

Please Help me



Deaktiver
 
add
Code:
<attribute key="decayTo" value="0"/>
to make it dissapear.
Look in movements.xml for the death ring or boots of haste and make the same with your item but change "slot" and "id". The rest I dont really understand, you want the items time to be counting even when it is in backpack?
 
I guess no one ever thought about making items for so long, so the (probably) source-code only sets seconds to minutes.
 
Im not even a noob at C++ but I tried something.
item.cpp
Find and replace
Code:
		if(hasAttribute(ATTR_ITEM_DURATION))
		{
			uint32_t duration = getDuration() / 1000;
			s << " that has energy for ";
			if(duration >= 120)
				s << duration / 60 << " minutes left.";
			else if(duration > 60)
				s << "1 minute left.";
			else
				s << " less than a minute left.";
		}
		else
			s << " that is brand-new.";
	}
WITH
Code:
		if(hasAttribute(ATTR_ITEM_DURATION))
		{
			uint32_t duration = getDuration() / 1000;
			s << " that has energy for ";
			if(duration >= 172800)
			        s << duration / 86400 << " days left.";
			else if(duration > 86400)
			        s << "1 day left.";
			else if(duration >= 7200)
			        s << duration / 3600 << " hours left.";
			else if(duration > 3600)
			        s << "1 hour left.";
			else if(duration >= 120)
			        s << duration / 60 << " minutes left.";
			else if(duration > 60)
			        s << "1 minute left.";
			else
				s << " less than a minute left.";
		}
		else
			s << " that is brand-new.";
	}

Then rebuild all.
As I said, You cant even call me a noob at C++ so I dont know how will, if this will, work.
 
Last edited:
hmm ok thanks I think this is great!
But I haven't the Source of TFS..But I know where to Download. But do I have to donwload the source per file? :s
 
Back
Top