Community Forum

New fruittype

Forum Overview >> Farming Simulator 2009

CategoryFarming Simulator 2009
Created23.06.2009 22:27


Julian Schlüter (Unknown) 23.06.2009 22:29
hello

how I can make a new fruittype? Gave it a model for it?

Stefan Geiger - GIANTS Software 26.06.2009 09:21
1. Insert a new foliage layer in the map i3d, including the new file and material entries

Check the FoliageSubLayer with the names wheat, wheat_cut_short and wheat_windrow for a reference.

Use as densityMapTypeIndex the next free value, which in the default map is 7.


2. Add a new extra source file to a new mod.
And enter this line:

FruitUtil.registerFruitType(string name, bool needsSeeding, bool allowsSeeding, bool hasStraw, int minHarvestingGrowthState, float pricePerLiter, float literPerQm, float seedUsagePerQm, float seedPricePerLiter, string hudFruitOverlayFilename)

Where name is the name you chose in the map i3d.
-needsSeeding should always be true.
-allowsSeeding should be true, if you want to allow a sowingmachine to sow this fruit type.
-hasStraw should be true, if combines should drop straw, instead of using the chopper(needs to have a FoliageSubLayer with the name <name>_windrow
-minHarvestingGrowthState is the minimum growth state the fruit needs to have to be cut.

Unfortunately hudFruitOverlayFilename does not work with mod files. Thus you have to use one of the default files.

The code for the wheat fruit type looks like this.
FruitUtil.registerFruitType("wheat", true, true, true, 3, 0.4, 1.3, 0.01, 0.5, "dataS/missions/hud_fruit_wheat.png");

Benjamin Gerisch (Unknown) 09.07.2009 15:10
@Stefan Geiger
you have forgot an " at this cod --> "dataS/missions/hud_fruit_wheat.png"

Tibor Gy (Unknown) 14.07.2009 19:53
hi

how do i sow this fruit ? because i can't select this fruit in the sowingmachine

Felix Sorge (Unknown) 14.07.2009 21:59
hudFruitOverlayFilename works with the update function

local wheatHud = Utils.getFilename("wheat_hud.png", self.baseDirectory);
g_currentMission.fruitOverlays[self.currentFillType] = Overlay:new("wheatOverlay", wheatHud , g_currentMission.fruitSymbolX, g_currentMission.fruitSymbolY, g_currentMission.fruitSymbolSize, g_currentMission.fruitSymbolSize * (4 / 3));

Tibor Gy (Unknown) 15.07.2009 10:49
my problem:
I created a sunflower, I can harvest it, but I can't sow it with a sowing machine like that the one that is a default machine


my ExtraFile.lua:
__________________________________
print("loading Sunflower MOD");
FruitUtil.registerFruitType("sunflower", true, true, false, 3, 0.4, 1.3, 0.01, 0.5, "hud_sunflower.png");
__________________________________
--- hud_sunflower.png location-> c:\program files\ls2009\ -- where datas.gar

my modDesc.xml:
______________________________________________________________
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<modDesc descVersion="1">
<author>cheebra</author>
<version>1.0</version>
<extraSourceFiles>
<sourceFile filename="ExtraFile.lua" />
</extraSourceFiles>
</modDesc>
_____________________________________________________________

Felix Sorge (Unknown) 15.07.2009 15:25
as hud display, use this and read the post from Stegei about that problem

hud_fruit_wheat.png

FruitUtil.registerFruitType("sunflower", true, true, true, 3, 0.4, 1.3, 0.01, 0.5, "dataS/missions/hud_fruit_wheat.png");

Stefan Geiger - GIANTS Software 15.07.2009 16:23
Cheebra, your path to the hud_sunflower.png is correct, since you placed it where the dataS.gar is.
Tbe other code seems to be correct as well.
Unfortunately there is a bug in the SowingMachine specialization.

You can fix this by placing this small code snipped in your ExtraFile.lua:

local oldSowingMachineLoad = SowingMachine.load;
SowingMachine.load = function(self, xmlFile)
oldSowingMachineLoad(self, xmlFile);
local newSeeds = {};
for k, index in pairs(self.seeds) do
table.insert(newSeeds, index);
end;
self.seeds = newSeeds;
end;

Tibor Gy (Unknown) 15.07.2009 18:05
thank you! it works!

Tibor Gy (Unknown) 15.07.2009 19:55
how to create silo? :D i want to store it :)

Stefan Geiger - GIANTS Software 15.07.2009 21:53
Select the trigger object you want to use to put sunflowers into (e.g. the tip trigger at the farm) and open the User Attributes window (Windows->User Attributes). Add the name of your fruit type at the end of the value 'fruitTypes'.
This should look something like this: wheat barley rape maize sunflower

To fill the fruit from the silo into the tipper, you need to duplicate an existing silo, select it, and change the user attribute value 'fruitType' to sunflower.

Tibor Gy (Unknown) 15.07.2009 22:14
thx, works :)

K. Martin (NHG240) 11.02.2011 11:54
I have a question about the fruits.

What defines exactly the channel numbers what you have to pick in Giants Editor to place the fruit?
For example, i want to add a new type of grass, but i don't know what the channel numbers are.

Please help!

Stefan Geiger - GIANTS Software 23.02.2011 15:49
The first 4 channels define the fruit type. The rest defines what kind of fruit is there (e.g. fruit to cut, windrows, long cutted grass)

The first 4 channels are already selected correctly by the editor when you select the correct fruit type in the drop down.

There is an article on ls-mods.de which describes which channels to select for the rest.
http://ls-mods.de/show_article.php?id=7

Sheldon Major (Chaos_Darkrai) 28.10.2014 00:40
I know this might be old, but when I duplicate a Silo, in the user attributes, I only see the name, not fruitType, and to be clear, I am using Giants Editor 5.5.2. And if I want to add an attribute, there is only: boolean, float, integer string, and script callback... If anyone would help me, it would be much appreciated.

Unknown 11.11.2014 22:39
I know this might be old, but when I duplicate a Silo, in the user attributes, I only see the name, not fruitType, and to be clear, I am using Giants Editor 5.5.2. And if I want to add an attribute, there is only: boolean, float, integer string, and script callback... If anyone would help me, it would be much appreciated.


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