Lumina Posted July 18, 2017 Share Posted July 18, 2017 I have a diggable item, i want it to "regrow" over time, a little like pickable item. What is the best way to achieve that ? I know the code i must use for the "regen" part, i think (something like testing if there is a workable component, and if not, adding one), but not how to do the regen part. I'm not sure i should use dotaskintime since i want a regrow every ten days (more or less) and dotaskintime seems to be for short delay. Any advice ? Thanks Link to comment https://forums.kleientertainment.com/forums/topic/80686-best-way-to-regen-a-diggable-item/ Share on other sites More sharing options...
ZupaleX Posted July 18, 2017 Share Posted July 18, 2017 (edited) Maybe add a counter on your object and a ListenForEvent which catch when a new day begin and increase that counter. Then if the counter == 10, regrow and counter = 0. EDIT: it won't be a ListenForEvent but something similar. function EntityScript:WatchWorldState(var, fn) EntityWatchWorldState(self, var, fn) TheWorld.components.worldstate:AddWatcher(var, self, fn, self) end In your prefab init function you could add inst:WatchWorldState("isday", OnNewDayFn) Edited July 18, 2017 by ZupaleX Link to comment https://forums.kleientertainment.com/forums/topic/80686-best-way-to-regen-a-diggable-item/#findComment-940077 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now