pyrovoice Posted May 28, 2015 Share Posted May 28, 2015 Hi guys, I'm new to modding and i'd like to use an OnEndGrowth event. For example, your farm frow a fruit. When the fruit is full grown, the function drop is called and the fruit is dropped on the ground. Does an event like this already exists ? If not, do you know how events are managed ? I couldn't find a list in the LUAsĀ Thanks for your help ! Link to comment https://forums.kleientertainment.com/forums/topic/54513-onendgrowth-event/ Share on other sites More sharing options...
Seiai Posted May 28, 2015 Share Posted May 28, 2015 (edited) @pyrovoice, well, i dont think theres an event, since there's no real need to push the event to something. the growing is done by the plant and only affects the plant. u will probably have to directly mod the plants/farms. and events are not centrally managed, events are used all over the code, whenever theres a need to tell another entity something, that should also affect this other entity. (ofc theres a part of the code that takes care of how the events are passed(in entityscript.lua) but i dont think thats what u mean?) Edited May 28, 2015 by Seiai Link to comment https://forums.kleientertainment.com/forums/topic/54513-onendgrowth-event/#findComment-641577 Share on other sites More sharing options...
pyrovoice Posted May 28, 2015 Author Share Posted May 28, 2015 ok thanks, so my job to find how events are created. Link to comment https://forums.kleientertainment.com/forums/topic/54513-onendgrowth-event/#findComment-641594 Share on other sites More sharing options...
Blueberrys Posted May 28, 2015 Share Posted May 28, 2015 @pyrovoice The crop component has a onmature function.-- For chaining and compatibilitylocal old_onmatured = inst.components.crop.onmaturedinst.components.crop:SetOnMatureFn(function(inst)) -- ... if old_onmatured then return old_onmatured(inst) endend) Link to comment https://forums.kleientertainment.com/forums/topic/54513-onendgrowth-event/#findComment-641664 Share on other sites More sharing options...
Seiai Posted May 28, 2015 Share Posted May 28, 2015 @pyrovoice,btw, events are just created for example like this:inst:PushEvent("onpickup", {item = act.target}) Link to comment https://forums.kleientertainment.com/forums/topic/54513-onendgrowth-event/#findComment-641697 Share on other sites More sharing options...
pyrovoice Posted May 28, 2015 Author Share Posted May 28, 2015 ok thanks I don't kniw if I will use it tho, I had in mind a farm-like that spawn ressources periodicaly. But still very nice to know how to do it Link to comment https://forums.kleientertainment.com/forums/topic/54513-onendgrowth-event/#findComment-641701 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