Community Forum


Forum Overview >> Farming Simulator 2009

CategoryFarming Simulator 2009
Created11.07.2010 13:21

Alex Shaw (Unknown) 11.07.2010 13:34
I'm currently fiddling around with a few liners trying to get a consistent yield, and dealing with being an lua newbie at the same time.

All of the scripts that have been applied reference maxWindrowValue via a line similar to this:

value = math.min(value, g_currentMission.maxWindrowValue);

Which I understand to mean that the variable value then either stays as it was or becomes maxWindrowValue - whichever is the lower amount. This effectively ensures the amount of material in the windrow doesn't exceed the maximum permissible amount held in maxWindrowValue and the game is able to create the windrow.

Given the area and the way that the liners work the value that maxWindrowArea constrains the amount of material in the windrow to isn't large enough. Would it be possible using a script in the mod folder along the lines of -

g_currentMission.maxWindrowValue = maxWindrowValue * 2;

Is this a viable approach, or even possible?



Stefan Geiger - GIANTS Software 12.07.2010 09:27
LUA allows you to change this value, however the code should look like this:
g_currentMission.maxWindrowValue = g_currentMission.maxWindrowValue * 2;

But you should not change the maxWindrowValue since this is a limit that is given by the foliage system respectively by the setup of the Farming Simulator density maps.
Only 2 bits are reserved to store the windows value at each position. Thus, values between 0 and 3 are possible.
If you try to save a bigger value, only the lowest 2 bits are used. E.g. if you try to save the value 5 (binary: 101), the value "01" is used, which is the same as using the value 1.
Thus you should use the code line you mentioned
value = math.min(value, g_currentMission.maxWindrowValue);
Which takes the smaller value of the desired value and the maximum value = 3.
If you dont do this, you might and up with even less value stored than the maximum value.

Alex Shaw (Unknown) 12.07.2010 18:24
Thank you for the speedy and detailed response.

I'm away from home at the moment so unable to pay about with things, but am I right in thinking that a windrow can only contain 3 fixed amounts of material no matter how large the area that was gathered to create the windrow?

I had come across the 'error' in the reading of the binary value which did in fact give some interesting results at times!

Note: Log in to post. Create a new account here.