Community Forum

Making bales

Forum Overview >> Farming Simulator 2009

CategoryFarming Simulator 2009
Created25.01.2010 11:48


Adam Klodowski (unknown) 25.01.2010 11:56
Hello,
I'm trying to make a balemaker with some special features. So far I managed to collect straw from wheat:

local totalArea =0;
local usedFruitType = FruitUtil.FRUITTYPE_UNKNOWN;
for k, cuttingArea in pairs(self.cuttingAreas) do
local x,y,z = getWorldTranslation(cuttingArea.start);
local x1,y1,z1 = getWorldTranslation(cuttingArea.width);
local x2,y2,z2 = getWorldTranslation(cuttingArea.height);
local area = Utils.updateFruitWindrowArea(FruitUtil.FRUITTYPE_WHEAT, x, z, x1, z1, x2, z2, 0);
area = area + Utils.updateFruitCutLongArea(FruitUtil.FRUITTYPE_WHEAT, x, z, x1, z1, x2, z2, 0);
if area > 0 then
totalArea = totalArea+area;
usedFruitType = fruitType;
end;
end;
self.fillLevel=self.fillLevel+totalArea;

but I would like to know how to do that with the barley or dry grass. The problem I faced is after i know how much straw I have collected is how to create a bale using one of the bale types from the game. I have found that the bales are within the id3 files:
straw = "data/maps/models/objects/strawbale/strawbaleBaler.i3d"
hay = "data/maps/models/objects/strawbale/haybaleBaler.i3d"
now how to use that files to create bale objects that are dynamicaly responding and how to create them at specific location/node of the vehicle model that i'm building?
The other thing is how to set or change the fill level of the vehicle, do I need to include some specific specialisaitons to achieve that? And what kind of functions i can use to update the fill level and type of content of the vehicle.
Thanks in advance for all replays,
Adam

Stefan Geiger - GIANTS Software 01.02.2010 11:55
You need to have the specialization Trailer included to have a fill level.

The function setFillLevel(level, fillType) sets the fill level as well as the type that is in there.

To collection barley or any other fruit type, you should change the values FruitUtil.FRUITTYPE_WHEAT in your code to the corresponding fruit type.

There is FRUITTYPE_WHEAT FRUITTYPE_BARLEY, FRUITTYPE_RAPE, FRUITTYPE_MAIZE, FRUITTYPE_GRASS and FRUITTYPE_DRYGRASS in the original game. Mods can add new fruit types as well.

To create new bale, you can use the function Utils.loadSharedI3DFile(filename, baseDirectory).

For example to load the strawbaleBaler.i3d you should something like this:
local baleNode = Utils.loadSharedI3DFile("$data/maps/models/objects/strawbale/strawbaleBaler.i3d", self.baseDirectory);


The variable baleNode now points to the node that contains your bale. So you should link this to the root node or to any other node that make sense.
Please note the $ at the start of the filename. This denotes that the path is relative to the game.exe and not to the mod directory. If you want to add your own i3d files with your mode, you would use "yourOwnI3d.i3d" as the path.

D. Bronson (unknown) 19.03.2010 20:21
I have a really question for whoever can reply. I have tons of round bales that I need to get back to my barns. Is there a trailer or an automatic round bale loader that I can pick up? The other bale loader for square bales works just fine. However I have found out that I can only bale grass/Alfalfa in round bale form.
If anybody can help me out please respond to E-Mail address.
bkmdano1957@yahoo.
Much Thanks!


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