Community Forum

Add weed growth to grass

Forum Overview >> Scripting

CategoryScripting
Created26.11.2021 00:47


John Deere (JDeere2012) 26.11.2021 00:47
Hello :)
I would like to add weed to grass. For this I wrote the following code, inspired by the script lowering the minimum cutting level, and selfresearch by using the consolelogging:

Results
...
function WeedyGrass:update(dt)
if not self.initialized then
for name, fruitType in pairs(g_fruitTypeManager.nameToFruitType) do
if name == "GRASS" then
fruitType.plantsWeed = true
fruitType.maxWeederState = 5
fruitType.maxWeederHoeState = 3
fruitType.minHarvestingGrowthState = 1
fruitType.minForageGrowthState = 1
print(name)
print_r(fruitType)
end
end
self.initialized = true
end
end;
...

Sadly the grass is not spawning any weed eventho the entries are similar to the wheat entries.
If anyone has some advices, please let me know :)

PS: The goal would be to start spawning weed as soon as the maximum growth state is hit.
If anyone has any advice for this I wouldn't say no to this either but for now, I would like to know what I am missing from spawning weed in general on grass

Bilbo Beutlin (BBeutlin) 26.11.2021 01:38
Why a script? Simply use a map specific "fruitTypes.xml" to set the grass attribute plantsWeed="true".

Anyway, be aware the weed is handled by the fieldManager. This will not effect 'wild grass' outside regular fields.

John Deere (JDeere2012) 27.11.2021 22:58
Hey, thank you so much for your reply :)

First, because I would want to start spawning weed when the highest growth stage of the grass is reaches. So instead of "rotten" state the grass should start having some weed.

Secondly thank you for the tip. But how were they planting e.g. only sorrel as weed in between the "wild grass".

Lastly, what it the fruittype "meadow" handled by the fruitmanager then?

Thank you for your advice, best regards!

Bilbo Beutlin (BBeutlin) 27.11.2021 23:39
Weed in decoration or wild grass is usually static and 'painted' in editor.
The fruitType "meadow" has replaced the FS19 fruitType "weed".


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