Jump to content

Age Items Over Time Mod Tool


nolanri

Recommended Posts

With this tool you can make Items in your mods change into other items over time. 

 

Items will age regardless of where they are, on the ground, in your inventory, in a crate, in a bag in a bag in a bag in a bag in your inventory...

 

Easily add item names to a table and give them a life span where on the expiry of said life span the item turns into another item.

for example:
 

ItemTimeTrackerMod["Dog"] = {};
ItemTimeTrackerMod["Dog"]["Life"] = 24.0;
ItemTimeTrackerMod["Dog"]["TurnInto"] = "Base.HungryDog";    

ItemTimeTrackerMod["HungryDog"] = {};
ItemTimeTrackerMod["HungryDog"]["Life"] = 24.0;
ItemTimeTrackerMod["HungryDog"]["TurnInto"] = "Base.StarvingDog"; 

ItemTimeTrackerMod["StarvingDog"] = {};
ItemTimeTrackerMod["StarvingDog"]["Life"] = 24.0;
ItemTimeTrackerMod["StarvingDog"]["TurnInto"] = "Base.DeadDog";

Where Life is the number of IN GAME HOURS the item has before it will expire into the "TurnInto" item.
And Obviously you can then add a "Feed Dog" recipe which will change hungry dogs into Normal dogs again.

Also this could be used to set time limits on crafts, for example.  If there is a recipe to breed dogs to get more dogs then something like this:
 

ItemTimeTrackerMod["TiredDog"] = {};
ItemTimeTrackerMod["TiredDog"]["Life"] = 12.0;
ItemTimeTrackerMod["TiredDog"]["TurnInto"] = "Base.Dog";	

 

And the recipe to breed dogs would return a "Tired" Dog rather than a normal dog. Which cannot be used in the breed recipe, until the 12 hours expire and he becomes a normal Dog.

You could even make items toggle back and forth into other items eg.

ItemTimeTrackerMod["Screwdriver"] = {};  
ItemTimeTrackerMod["Screwdriver"]["Life"] = 0.1;
ItemTimeTrackerMod["Screwdriver"]["TurnInto"] = "Base.Hammer";	

ItemTimeTrackerMod["Hammer"] = {};
ItemTimeTrackerMod["Hammer"]["Life"] = 0.1;
ItemTimeTrackerMod["Hammer"]["TurnInto"] = "Base.Screwdriver";

This will make a Hammer change into a Screwdriver every 10 in game minutes, and make the Screwdriver change back into a Hammer 10 Minutes Later.
Why would you need to do that?!? I don't know, but now you can if you want to...

 

 

As you can probably guess, I made this mostly for Hydrocraft but you can use it in your mods too if you want.



INSTRUCTIONS:
Just put the timetracker.lua and timetracker_definitions.lua in your lua/client/ folder
Do not edit timetracker.lua.

Just open up the timetracker_definitions.lua and add the items to the table as explained in that file. There are some examples.  You will want to delete the examples after you add yours.
 

 

 

 

timetracker.lua

timetracker_definitions.lua

Edited by nolanri
bug fix
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

Thank you very much for this mod.

 

After small test, is it possible to TurnInto containers to one another, or to a normal item?

 

I didn't managed to do it, a container don't change.

 

Thank you, and sorry for my english, I'm a french guy.

Link to comment
Share on other sites

On 2016-08-09 at 5:42 PM, krad007 said:

Hi,

 

Thank you very much for this mod.

 

After small test, is it possible to TurnInto containers to one another, or to a normal item?

 

I didn't managed to do it, a container don't change.

 

Thank you, and sorry for my english, I'm a french guy.

Yes, it should be. It should not matter what kind of item, container normal type or any other type. It will just replace an item with a different one after the timer expires. 

If it's not working, post the error. or just post all your files in your mod and i'll try to see the error for you.

Link to comment
Share on other sites

  • 4 weeks later...
12 hours ago, AiweLelia said:

I found if few mods use this files, array will be deleted this string:
 


ItemTimeTrackerMod = {}; -- DONT delete this!

 

Maybe rewrite only if array empty?


if ItemTimeTrackerMod == nil then
ItemTimeTrackerMod = {}; -- DONT delete this!
end

 

oh,  if multiple mods use this, yes that would be a problem. And that should fix it

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...