Fast Grow Script

Place for sharing your game modifications for Life is Feudal: Your Own

NVA_Lee22
 
Posts: 3
Joined: 27 Nov 2015, 14:49

Fast Grow Script

Post by NVA_Lee22 » 28 Nov 2015, 13:51

Hey, i tried to speed up the grow rate of crops on a Server.
I found a little solution to grow it faster, but there is this problem with that decay of crops. (disappear)


Now here is my actually script, i´m not the best in object oriented programming so these Torque 3D is new for me since the day before yesterday :fool:
(But im good with PHP and Javascript or Jquery but anyway.. ;) )
In this script i´m not really use objects i only use functions.
I have to read some ebooks and references about Tourque 3D and try this script. It works fine on my dedicated Server.


Code

create a new file for example "myScript.cs" and place it in your main directory where your main.cs is located. Than open your main.cs and add this to the top
Code: Select all
exec("myScript.cs");


Then open myScript.cs and copy this in it. (If you dont like the names of the function you can change it of Course, i just use it because i dont know if the game has functions with the exsiting names that i will overwrite if i use other names ;) )

Code: Select all
// Grow all crops and start the schedule again
function nvaGrowAll(%time){
    // Growfunction from life is feudal (i hope)
    stretchedGrowStart();
    centerPrintAll("Pflanzen wachsen lassen",5);
    echo("Grow Plants \n");
    // start schedule again
    nvaStart(%time);
}
// use this to start the grow faster
// time is in miliseconds 
// 30000 = 30 sec.
function nvaStart(%time){
    // clear timer to be safe
    nvaStop();
    // set the schedule in the global var $nvaInterval to cancel it
    $nvaInterval = schedule(%time, 0, "nvaGrowAll", %time);
    echo("setSchedule...");
    echo("Time = ");
    echo(%time);
}
// to stop this function
function nvaStop(){
    cancel($nvaInterval); 
}
// start this functions automatically
nvaStop();
// repeat every 2 min. i know its really fast you can change it of course
nvaStart(120000);



FYI here i found all functions and classes from life is feudal ;)
Classes
http://pastebin.com/tqhixQq9
Functions
http://pastebin.com/c3Eb3QPF

so now to understand how this crops work in database i have to explain what i have found.

How plants are grow ?

Crops(plants) are grow in 8 Levels.
if you plant a seed it will have Step 1.
Then it depends on your server <dayCycle> in your config.
I use 0.5 as example (1 ingame day need a 0.5 real time hour -- 30 min.)
Every ingame day the crops will go up 1 Step.
On Step 8 it is ready for your sickle :evil:
I read that it needs 1/3 of the time it grows to disappear.
In my test it is on step 12 see in the image link...

A Picture of my test what can explain it a little bit (i hope)
Image
http://envalee.de/lif/img/cropLevels.jpg

There you can see some database values and that the crops change the substance if the levelFlag goes over 96 ( or 100).
It start from the top when you set the seed.
I used wheat and the seed have the substance 101 OR 102 when you will plant it. ( I dont know why... maybe the rotation or something depends on placement)

After 30 min. the crops level up to "32" and so on...
Every Level up will create a new Database entry instead of update it :%)
After the substance 102 goes over 96 (or 100) with the levelFlag it will change the substance + 2 (=104) and also change the displaystyle in game that you can see it grow.

Databse tables

Used Tables from the DB are :
geo_patch
terrain_blocks

in the geo_patch are the fields you created and all crops with there level (state)

What terrain_blocks tabel is for i haven't found yet. Maybe someone can explain ? :)

What i want to do ?
I want to deny the cropdecay (disappear) or change the time that it needs more time (much more...) to disappear.
I tried to change some database values before the grow functions starts but only the change in Database have no effect.

I Think that this function of disappear is in another script and what i really hope is that this not need to change something on the client side :no:

If there is some out there who want to speed up the grow time and change the disappear time, then maybe this can be the beginning of that mod :beer:

I would be really happy if someone can help me :friends:

btw - sorry for mybe bad english i´m from germany :pardon:


GenetKal
 
Posts: 4
Joined: 05 Jan 2016, 02:52

Re: Fast Grow Script

Post by GenetKal » 05 Jan 2016, 02:57

Pretty cool script. I would like my day/night cycles longer. But that ups the rate of growth and my players arent liking the long growth time.

Did a test with it. Seems to work fine. Only issue is we are not seeing the visuals of the plants growing. Just the plot of soil it was planted on.

Thanks in advance for your time :D
Genet


CRFT_Casey
 
Posts: 1
Joined: 05 Jan 2016, 17:59

Re: Fast Grow Script

Post by CRFT_Casey » 05 Jan 2016, 19:12

First off Thank You NVA_Lee22 for the script going to try it asap.

@Genetkal do you have your grass turned up in the video section of the options menu. I only ask because I had the same problem and I forgot I lowered my grass settings to increase mt FPS and also to help me harvest herbs. I haven't tried the script here but using the /grow gm command I could see the soil change but nothing grow until I increased the grass.


GenetKal
 
Posts: 4
Joined: 05 Jan 2016, 02:52

Re: Fast Grow Script

Post by GenetKal » 06 Jan 2016, 06:34

Ahh yes.. For some reason advanced weather and plants get reset to off/zero if the server times out. At least thats what one player tells me.

Thanks for the awesome script


GenetKal
 
Posts: 4
Joined: 05 Jan 2016, 02:52

Re: Fast Grow Script

Post by GenetKal » 06 Jan 2016, 10:21

Quick question... Does this apply to tree growth as well?
I.E. Apple and/or Mulberry for example.

If not, is there a way to incorporate tree growth ?


Thanks in advance for your time


NVA_Lee22
 
Posts: 3
Joined: 27 Nov 2015, 14:49

Re: Fast Grow Script

Post by NVA_Lee22 » 28 Jan 2016, 21:58

Hello and thanks! :)

I haven´t worked on that script since I made this Post. :sorry: I have no idea how i found the list of all LiF Commands for the Server. But the Command --

"stretchedGrowStart();"

...starts that "grow" process. I´m not sure but i think that i tried a command on the server command line interface to get a list of LiF Server Commands.
:fool: (Where's the list) :fool:

I think that trees/apples are not included in that "grow" process but i´m not really sure. If someone will try this script than maybe he/she can tell us if trees/apples are grow faster?!

For testing i have to set up my LiF Server again and i have not much time now to get back into the topic. :(
Maybe i will have a look into it when i successfully passed all my exams.

Feel free to expand the script and share it with us... :beer:


**EDIT**
I'm an idiot...
I have posted the list of all function for LiF in the Mainpost :fool:

Functions
http://pastebin.com/c3Eb3QPF

...maybe you can search on that webside for "Tree" or "Grow" to test some functions in the server command line interface.
(Use Ctrl + F to open the searchdialog in your browser :) )

Return to Game mods