The FSG Modding Random Foliage Paint Script is designed to help making mapping a little easier by allowing modders to easily select areas they want random foliage types painted on.
Getting Started
We assume that you already have Giants Editor installed and understand many of the basic functions with the software. In this doc we will refer to Giants Editor as GE.
You can get GE
You can get this script from GE10 Scripts Modding Tools
FSG-FS25-RandomFoliageByPaint-v1.lua
Beginner tutorials coming soon.
To install the script, download from our GitHub page, then copy to the following folder location:
C:\Users\username\AppData\Local\GIANTS Editor 64bit 10.x.x\scripts
Make sure to use the latest version of GE and replace username with your computer’s username and select the folder for the latest version of GE.
Once you have put the script in GE’s script folder, be sure to restart GE so that it can read the newly added script.
Prep Your Map
Now that we have the script all setup and ready to go we want to prep the map so that we can generate foliage on specific terrain paint textures. We need to open the terrain layer manager and make sure each texture group has unique color codes.
Right click on the terrain in the scenegraph and click on Layer Manager.
In the Base Layers tab either make the window larger or scroll to the right to see the color column.
If you are running a map from one of the basegame maps many of the colors will be the same. We don’t want that. If you use a texture that shares colors with other textures the foliage may end up in places you do not want it. Each combined layer will have two base layers for them. So if you change one base layer make sure to copy the new color code to the second one. Notice how each of the following have the same name with the number at the end the only difference.
Notice here where each set has a unique color.
You do not want your colors to look like this. Notice they are all using the same color codes.
To change the colors, just double click on the color square and a selector will popup. Just move the value slider or alter one of the RGB values.
Once you have made the updates needed apply them, save the map, then close and reopen the map in GE. Do not reload as it will crash GE. Best to just close GE and open the map again.
Prepping the Ground
Now that we have everything setup for the script to work properly we want to start working with the foliage. We want to paint the areas we want the foliage generated on and pre paint the base foliage we want with a foliage such as grass. When doing a forest area we like to use decoFoliage > grassSmall as the base foliage on top of FOREST_GRASS texture layer.
Here we have GRASS as the texture layer. You may already have texture painted down, but for this example we are going to start with a blank slate and no foliage.
Now we are going to paint the FOREST_GRASS in the areas we want to generate this random foliage. In this case we made a donut shape because why not.
Now I am going to limit to the texture to paint down decoFoliage > grassSmall for the forest area and meadow > harvestReady for the grass area.
Once the done it should look something like this:
For this script to work we will need to create a transform group and place it in the texture we want to run this script. To create a new transform croup just click Create in the menu then select Transform Group.
Once created it will show up in your Scenegraph.
Select the new empty transform, press Left-Ctrl + B, then click where you want it placed in the map. The center of the gizmo needs to be on the texture you want to generate foliage on. Be sure to use the Left-Ctrl + B (interactive placement) function to place the transform or it may not read the terrain color code properly.
Once we are happy with our base setup we can continue to the next step and run the script.
Run the Script
Now that we have the map setup and ready we can start doing the fun stuff. To open the script we will want to click on the scripts menu at the top of GE, hover over User Scripts, then hover over the Random Foliage by Paint Tool script and click it. In my case I have the script a couple folders deep to help with organization as I plan to add a ton more scripts.
Once you select the script you should see this new window popup:
For best results we suggest using all fields available in this window. Any states that are set to 0 may remove foliage instead of doing nothing.
At this time the script is not able to auto update the states. We do hope to figure that out soon, but for now just watch the console for the state you have selected. Each time you select a state it will update the name of the state in the console. If you would like to see a list of each state for all available foliage types you can click the Show Foliage States in Console and it will print out a list in there. You can copy from there or open the GE log file for reference.
In this case we want to generate forest style foliage with some bushes in the mix. So we will select the options as shown in the following screenshot:
With the empty transform selected select Run Script and wait.
If you would like to watch the script run you can watch the editor_log.txt which is located in the same folder the scripts folder we installed the foliage script in. You can open it with a text editor and it will update with which section it is currently working. There are 64 sections that it will run. We have seen this script take anywhere from a few seconds to almost a full day. We suggest keeping your areas small and working in small sections and use a texture you are not using anywhere else on the map for the painting. Once you are done with that section paint it to the one you actually want in the areas you generated foliage.
Once the script is done you will see some info scroll though the console then it will pause and let you move around. Be sure to save you map so then make adjustments as needed. You should see something similar to the following:
If you zoom in you can see all the detail that was added.
If you are not happy with it you can run the script again and it will add more foliage, or you can set some of the states to 0 and it will reduce some of the foliage.
GE will not look as good as in game unless you have a really good computer that can handle the higher profile settings. If you go in game and take a look at your new foliage it will look like the following:
Here is another variation we did that looks really nice.
We hope you enjoy this script and find it as useful as we do. If you need any help or run into issues please reach out to use in the Farm Sim Game discord. We are happy to help and love input.