Wrinkley WrinkleysRule Posted March 27, 2023 Wrinkley Share Posted March 27, 2023 Create Field Dimensions and Farmlands Tutorial This tutorial will endeavour to show you how to create field dimensions, paint the farmland area (InfoLayer_farmlands.grle) and automatically add the relevant farmland entries in the farmland.xml together with painting your chosen Ground Type (i.e Plowed,Cultivated etc) and painting foliage at a chosen growing state on the chosen field using custom scripts. For clarity the abbreviation TG will be used to denote a Transform Group throughout this tutorial. I would like to thank Modelleicher for allowing me to use and giving permission to slightly modify the following scripts in this tutorial in order to add some extra functions. Create Field Dimension Panel Creates field dimensions from markers Paint_Farmland_Field_ID_Panel Paints the InfoLayer farmlands.grle and adds relevant data to the farmlands.xml. Paint Field Ground Foliage Panel Paints the chosen Ground Type (i.e.Plowed,Cultivated etc) and Foliage at a chosen state (i.e. wheat, harvest ready). All scripts are available in the Field Dimensions and Farmlands zip file and a TEXT ONLY VERSION (.docx format 'Word') of the Main tutorial all available at the end of the tutorial. If using the TEXT ONLY VERSION and problems occur please refer to the main tutorial for in depth description of the various methods/script. Also have a look at the following youTube videos by Modelleicher on the creation of the original scripts and for a master class on script creation. https://www.youtube.com/watch?v=jLL7x064mJc --Field Dimensions https://www.youtube.com/watch?v=QhCOBkOxjPE –Paint Farmlands https://www.youtube.com/watch?v=dxnZI8C02NY --Farmlands.xml Create Field Dimensions, Create Farmlands and Paint Ground and Foliage on the field The three scripts used for this are the Create Field Dimension Panel, Create Farmlands Panel and the Paint Field Ground Foliage Panel. The Paint Field Ground Foliage Panel script now automatically reads the Foliage Type, Ground Type, Ground Angle, Spray Type associated with your map from the map.i3d and displays it in a dropdown selection. However the Foliage State for each Foliage Type still requires a number value (position in the Layer State dropdown in GE) To assist with this the script now reads all the Foliage States of each Foliage Type directly from the maps foliage folder xml’s and prints result to the console log and to a foliage_States.txt file in the same folder as the map.i3d for easy reference, the image below shows the extracts from console log print out and the foliage_States.txt file . The foliage states listed here are from a test map based on the US map so yours may differ depending on your map set up. Open your map in Giants Editor and Select –Scripts, select the Field Dimensions and Farmlands folder to open it and then select the Create Field Dimension Panel script a popup Panel will appear on your screen. A new transform Group will automatically have been created in the Scenegraph called Field_Creation_Transform consisting of the following TG groups newFieldMarkers – this TG will be the the reference point for the fieldMapIndicator and also contains the Markers transform where the markers are placed. fieldsNew -- containing a fields transform although this will have the FieldUtil.onCreate attribute set by the script I suggest if copy/pasting the fields TG from the fieldsNew TG to the gameplay folder, delete the attributes and reassign them by Add New Attribute --Type --scriptcallback -- onCreate -- Add and in the new onCreate box enter FieldUtil.onCreate as some times GE doesn't recognise some script set User Attributes consequently field no's may not appear in game. farmlandDimensions -- containing a fields TG with the FieldUtil.onCreate attribute set. This will be used in the creation of the farmlandsDimensions Create a primitive (Create –Primitives, I will be using a cone throughout this tutorial.) and cut/paste into the newFieldMarkers transform (this will be the position of your fieldMapIndicator in the new fields TG). Copy/paste a cone into the Markers TG Your Scenegraph should now look like this. If you haven’t already got an outline of your proposed field area then I suggest you make one using the Terrain Detail Texture Mode and a suitable texture. Once you have a field border then CTRL ‘B’ the newFieldMarkers transform into the field area. Note: The newFieldMarkers transform MUST be placed in a position that allows ALL the field boundary to be seen from that position (the cone in the newFieldMarkers TG will provide a reference point) otherwise the script will not work correctly, so for complicated field shapes you will have to create the fieldDimensions manually or by using FieldDimensionsWithBitmap script available from here https://ls-modcompany.com/forum/thread/5852-fs19-ge-script-fielddimensions-per-bitmap/ Also the Markers (cones) must be in a consecutive order, so if you have to add any additional markers to your layout (after creating one) then the extra marker must be placed in between existing ones in the Markers TG as the script uses each marker in turn to create the field Dimensions. Place the ‘cones’ along the edge of the field by CTRL ‘D’ (copy existing cone)-CTRL ‘B’ (place new cone) at suitable points as shown in the following image ( I have scaled the cones up for better definition). Using the fields transform in the fieldsNew TG to create the new field dimensions. In the Enter Field Number box enter the field number you want for this field. Now, first selecting the fields transform and holding Ctrl key select the Markers transform, releasing the Ctrl key and select the Create Field Dimension button. The new field dimensions together with the fieldMapIndicator will be created in the fields TG in the fieldsNew TG, if they are not visible in GE then with the fields TG selected Select – Scripts – Map –Toggle Render Field Areas and they should appear in GE. A Created Field Dimension for Field ‘field01’ message will also appear in the console log (field number will change to field created in subsequent operations). Results shown in following image. The script sets the default for fieldGrassMissions and fieldMissionAllowed to false. To change this to your prefered setting select the field number transform (field01 in the folowing image) And select the relevant box as shown below. fieldAngle can be left at 0, fieldDimensionIindex and nameIndicatorIndex refers to their position in the field(01) transform group 0 and 1 respectively. Painting the Field and adding details to farmlands.xml There are some tasks and settings to be done before this can be carried out. Firstly if you are starting from scratch then I suggest you ’Wipe’ the infoLayer_farmlands.grle if you already have fields painted then skip this next step. ‘Wipe’ infoLayer_farmlands.xml In GE zoom out until the whole map area (I use a pda camera for this ) is in view select the Terrain info Layer Paint Mode and in the Info Layer Painting panel select farmland in the drop down, select all the info channels (1-7). In the Terrain Editing Brush panel set a radius of 1000 and Brush Type square, paint the whole map area (ensure it is completely covered otherwise you will get errors in the log) and save the map. farmlands.xml If you have renamed your farmlands .xml then obviously use that name in the following and check the note in the Create Farmlands section regarding filePaths. Navigate to where the map.xml is located in your map normally Map Name/maps/mapUS (orFR/alpine) And open this in notepad++ and locate the <farmlands filename entry in this case it is <farmlands filename="$data/maps/mapUS/farmlands.xml" /> Change this to <farmlands filename="maps/mapUS/farmlands.xml" /> if you want to keep your farmlands.xml in the default position However I am going to put my farmlands.xml in a separate xml folder so my <farmlands filename entry will look like this <farmlands filename="maps/mapUS/xml/farmlands.xml" /> with the farmlands.xml placed in the new xml folder. Save the maps.xml. Open the farmlands.xml in notepad++ and ensure the path to the infoLayer_farmland.grle is correct the densityMapFilename should read densityMapFilename="maps/mapUS/data/infoLayer_farmland.grle" If you are starting from scratch open farmlands.xml and delete all the farmland entries like so. However if you already have fields created in the farmlands.xml then only delete any entries that have not yet been created leaving only the created ones e.g A second set of field Dimensions now need to be created in the fieldDimensions TG using the original set of markers. Select each of the field border markers in turn and move them to the outside of the field boundary (or if you have two fields that you want to have as one farmalnd area, to the outside of the whole area) Remember if you add any new markers the extra marker must be placed in between existing ones in the Markers TG as the script uses each marker in turn to create the field Dimensions. Once done first select the fields transform in the fieldDimensions TG and holding the Ctrl key select the Markers TG release the Ctrl key and select the Create Field Dimension button. Note: the field number is left as 1 in the Create Field Dimension script because this is the field number to be painted. Create Farmlands To paint the field infoLayer_farmlands_grle and create the correct entries in the farmlands.xml in Giants Editor Select –Scripts, select the Field Dimensions and Farmlands folder to open it and then select the Create Farmlands Panel script, a popup Panel will appear on your screen. Set Land Price Scale- Enter your chosen price scale multiplier default is 1 Set NPC Area- Enter your chosen NPC area "ALPINE", "US" or "FR" Number of Different NPC’s Number of different NPC's (found in base maps npc.xml normally default 15) The npc number is randomly selected between 1 and the npcCount value in the script. Show on Farmlands Screen Default is true --false will stop field being shown on farmlands screen i.e showOnFarmlandsScreen="false" /> <!-- BGA, farmland bought via placeable --> When true the game scripts automatically show the farmlands so no showOnFarmlandsScreen entry will appear in the farmlands.xml Default Farm Property Default is false --true assigns ownership of field to player farm i.e defaultFarmProperty="true" /> Once you have made the relevant settings in the Panel , with the field01 TG (farmlandDimensions – fields - field01) selected, select the Create Farmlands button. Note: If your map has a non standard heiarchy or extra custom NPC characters then you will need to adjust some variables in the script, obviously if the map is a standard layout then this section can be ignored. The variables to change are, local farmLPath = {"farmlands.xml","xml/farmlands.xml"} – these are the normal places where the farmlands.xml is found. The script will automatically search for the xml in the following locations Main map folder Main Map/maps folder Main Map/maps/mapUS (orAlpine,FR) folder If your farmlands.xml has another name or placed in a different folder location then add this to the ‘farmLPath array ‘ not forgetting the quotes. local areas ={"ALPINE","US","FR"} – If you have another set of custom characters at a different location then add this to the ‘areas’ array again not forgetting the quotes. local npcCount = 15 -- If you have more custom characters then increase this number to the new amount. To carry out any of the above changes open the script in the GE Script Editor Window – Script Editor -- Field Dimensions and Farmlands - Create Farmlands Panel At the top of the script (lines 12,13,14) you will find these variables, adjust as necessary and save the script. The Script Editor can now be closed as it is no longer needed and the script is ready for use. The image below shows the resultant farmland painted (in Brown) with the farmlandDimensions overlayed in green. The inset shows the same farmland but selecting Farmland 1 in the Lands dropdown and show unmasked selected (removes the background colour) A INFO : Farmland id 1 Painted and farmlands.xml entry created message will also appear in the console log (field Id will change to any new Id created for subsequent fields). Note: Colours will vary as the Toggle Render Field Areas script randomly assigns colours to fields And the new entry in the farmlands.xml showing field 1 as belonging to the farm. You can create the fields in any order the script will adjust the farmlands.xml numerical order automaticaly and insert the next number in the appropriate place replacing the <farmland/> with the new field entry as shown below. If you try to create/paint a field ID that already exists then a warning will appear in the Console panel window and the existing farmland ID will not be overwritten , for example, +++++++++++++++++++++++++ Farmland ID 25 already exists in farmlands.xml Delete farmland Id 25 in the farmlands.xml if you wish to create a new farmland at Id 25 +++++++++++++++++++++++++ Should you wish to increase/decrease the size of the painted farmland area then in GE with the Terrain Layer Info Paint Mode selected and the farmland selected in the drop down in the Info Layer Painting Panel With the cursor over the area you wish to change select Ctrl ‘R’ on the keyboard and the correct farmland entry will appear in the Info Layer Painting Panel ready for you to paint Once happy save the map (sets the infolayer_farmland.grle) Painting Field Ground Type and Foliage This requires the Paint Field Ground Foliage Panel script. The script requires the correct Farming Simulator 2022 installation path, it uses a default path of "C:/Program Files (x86)/Farming Simulator 2022/". If your installation path is different then open the script in the GE Script Editor Window – Script Editor -- Field Dimensions and Farmlands - Paint Field Ground Foliage Panel At the top of the script at line 24 there is the following local gInst = "C:/Program Files (x86)/Farming Simulator 2022/" replace the "C:/Program Files (x86)/Farming Simulator 2022/" with your file path (including the quotes) and save the script. The Script Editor can now be closed as it is no longer needed and the script is ready for use. This script uses the created field dimensions to allow the painting of the Ground Type and Foliage to the field dimension area With the map open in GE select Scripts select the Field Dimensions and Farmlands folder then the Paint Field Ground Foliage Panel script the following pop up panel will appear on your screen Set Foliage Layer Select the Set Foliage Layer box and a dropdown will open listing all the various foliage layers in your map for example 'terrainDetail' Set Foliage State Only applies if terrainDetail not selected in the Set Foliage Layer. The number entered corresponds to the position of your chosen foliage state in the Layer State dropdown in the Foliage Layer Painting Panel of GE. To assist with finding the relevant foliage state all the foliage states for each ‘crop’ are printed in the console log and also in a foliage_states.txt file in the map.i3d folder Ground Type Selected from the Ground Type dropdown (all available terrain detail ground type’s listed). Ground Angle-Degrees Selected from the Ground Angle-Degrees dropdown (all available ground angles listed). Spray Types Selected from the Spray Type dropdown (all available spray types listed) Paint Ground/Foliage Executes the script Once you have entered your chosen settings with the field TG (i.e. field01) selected, select the Paint Ground/Foliage button Note: the Spray type works the same as if painted in GE so you will still get the requires lime/etc in the in game field info gui. The images below show console log print out for foliage states and the Paint Field Ground Foliage Panel settings for, Set Foliage Layer --terrain detail, Ground Type Ridge, Ground Angle -90,Spray Type Manure. Set Foliage Layer- potato, Foliage State - 5 (green big) Ground Type/GroundAngle/Spray Type left as previous as they have no effect if terrainDetail not selected. To erase/change any option select the foliage layer you want to change and either deselect it (blank) to remove or choose another foliage type , the same applies to the other options. For example selecting terraindetail and deselecting (blank) in the other setting(s) to be erased and selecting the Paint Ground/Foliage button will revert the field to the original ground texture ( in this case ‘dirt’) To remove foliage , select that foliage in the Set Foliage Layer dropdown and enter ‘0’ in the Foliage State select the Paint Ground/Foliage button will remove all the foliage of that selected Foliage Layer The script will work on any TG that has field dimensions so for example can be used to fill a predefined area that has been created using the field dimensions script. Note : Density Map Modifier details will also be printed in the log whenever the Paint Ground/Foliage script is used, this is not an script error but a GE info regarding number of channels e.g. DensityMapModifier: defaulting num channels to 10 DensityMapModifier: called from =C:/Users/Admin/AppData/Local/GIANTS Editor 64bit 9.0.6/scripts/PanelScripts/Field Creation Scripts/Paint Field Ground Foliage V4.lua (275) If manually painting the terrain detail a little tip, in the Limit to Texture drop down in the Foliage Layer Painting panel select the texture of your field area this will restrict the painting to that texture only and not paint over the grass border texture the image below shows the effect of these settings. To create other fields repeat the above methods. Once you have completed all your fields then, if starting from scratch cut/paste the fields TG from the fieldsNewTG to the gameplay TG replacing original. However if you already have fields created then copy/paste the fields TG from the fieldsNewTG to the gameplay TG and move any existing fields into the new field TG. Save the map. --------------------------------------------------------------------------------------------------------------- Method 2 Using a Spline This method is more or less the same as the first except I will be using a spline to create the field border and place the markers, the placedObjects TG will be used instead of the Markers TG when creating the field Dimensions. The scripts used in this section of the tutorial are:- Spline Placement set –Transform/Place/Delete Sets the required transform groups in the scenegraph Places objects along a spline Option to delete the current placed objects Create Field Dimension Panel Creates field dimensions from markers Create Farmlands Panel Paints the InfoLayer farmlands.grle and adds relevant data to the farmlands.xml. Paint Field Ground Foliage Panel Paints the chosen Ground Type (i.e.Plowed,Cultivated etc) and Foliage at a chosen state (i.e. wheat, harvest ready). Spline Paint Panel Paints chosen texture(s) along/either side of a spline If you haven’t used the Spline Placement scripts/ Spline Paint Panel scripts before then I suggest you have a look at the tutorials linked below. https://farmerboysmodding.com/index.php?/topic/2414-terrain-height-paint-terrain-and-spline-placement-scripts-tutorials/ Initial set up When using scripts in GE that do not require access to the script editor (such as the Toggle Render Field Areas) what I normally do is go to Scripts –Map, which opens the folder at the bottom of the popout is Detach Menu, selecting this undocks the folder from the Scripts list which can then be place anywhere on the screen or redocked into the side panels (see images in the tutorial for examples). Open map in GE, open Script Editor (Window – Script Editor) select and execute the following script (found in the Spline Placement folder):- SplinePlacement Transform – this will create the necessary transform group heirachy for the script In GE create a spline (Create—Spline) and cut paste it into the splinePlacement transform. Create a primitive (Create—Primitives) again I will be using a cone, and copy/paste one into the objectsTo Place transform and another into the splineObjects transform (this one is used as a guide for the fieldMapIndicator) . I will be using the exsisting transform group farmlandDimensions TG from the previous method infoLayer_farmlands.grle and farmlands.xml set up is the same as previous method. The splineObjects transform will be used to create a field boundary and place the markers, the spline itself will also be used to paint a field border in a suitable texture The farmlandDimensions TG with the fields transform will be used to create a second set of fieldDimensions in a new (in this case ) field02 transform to be used for painting the infoLayer_farmland.grle and creating a new entry in the farmlands.xml in the same way as before. Creating Field Dimensions These are created much the same way as the before the exception is now the field boundary is created using a spline. Select the splineObjects TG place it into the field by Ctrl ‘B’ , again the whole field boundary must be visible from the chosen location. Select the spline and place it in a suitable postion on the field boundary (I have chosen the top right corner and have also deleted the ‘S’ cv to forestall any rotation problems with the spline) and using just the ‘E’ cv create the field boundary (to get sharp corners insert an extra cv before continuing along the boundary). Once the boundary has been completed the field border can be painted by selecting the spline in the splinePlacement TG and in GE -- Select - Scripts—Spline Paint Panel the following image shows the panel set up for this particular field edge. This will paint a 5m ROUGHGRASS border to the left of the spline (viewed from the ‘S’ cv). The script reads all the various textures from the map.i3d and assigns them (in order) in the relevant dropdowns. You can of course select your own texture from the dropdown any texture/area you do not want painted the -1 must be selected. If required you can now easily paint the field texture (DIRT) itself by using the Limit to Texture method described earlier. With the border now painted select the splinePlacement transform to bring up the splinePlacement User Attributes and set the User Attributes as follows, Set Object Distance – 20 -- This can be set to any suitable number as long as the complete field border covered Fixed Distance --Selected –Enables items to be placed a fixed distance away from the spline Set Distance Fixed -- -5 --Is the distance objects will be placed away from the spline in this case - 5 m to allow for a 5m field border ( - 5 to the left of the spline viewed from the ‘S’ cv) other settings can be left as default. With the splinePLacement TG selected and the Spline Placement script selected either in the Script Editor or from the Detached Panel execute the script, (I have scaled the cone by 4 and freeze transformed for clarity). This image shows the field border painted together with the cones placed around the field perimeter The next step is to thin the cones out by deleting unnecessary ones (either one by one or left click drag to select multiples) and adjusting the position of others for better shaped field dimensions, in the next image the inset shows the the cones thinned out and the field dimensions created after entering field number then first selecting the fields transform (in the fieldsNew TG) and holding the Ctrl key select the placedObjects TG, release the Ctrl key and in the Create Field Dimension Panel select the Create Field Dimension button Note any other field dimension already created will also show when selecting Toggle Render Field Areas Next to create the second set of farmlandDimensions first select the spline Placement TG and in the Script Editor select Spline Placement Delete, in the Spline Placement folder (this will execute the script) In the Spline Placement User Attributes change the Set Fixed Distance to 2 (this will place the cones 2m outside the spline) and with the Set Object Distance still at 20 select Spline Placement, again adjust the position of the cones to create a smooth path around the field border If creating the fields farmlandDimension next to one already created then to ensure no gaps in the painting between the fields in the infoLayer_farmland.grle, with the fields TG ( in the farmlandsDimension TG) selected, select Scripts - Map – Toggle Render Field Areas, this will show all the farmlandDimension currently created. Then adjust the cones so that they align with the other fields farmlandDimensions, the following image shows an example of this in the inset. Once done, in the Create Field Dimension Panel leave the field number the same as the one for field dimensions first select the fields TG ( in the farmlandsDimension TG) and holding the Ctrl key select the placedObjects TG and select the Create Field Dimension button. The newly created field02 farmlandsDimension created Painting field infoLayer_grle and farmlands.xml This is done in the same way as the previous tutorial. Open the Create Farmlands Panel (Scripts - Field Dimensions and Farmlands - Create Farmlands Panel ) Set the options as required then in the fields TG ( in the farmlandsDimension TG) select (in this case) field02 and then the Create Farmlands button to execute the script. The image below shows the new field02 farmland painted in the infoLayer_farmland.grle (Terrain Info Paint Mode selected) together with the previous field01 creation. And in the farmlands.xml the following settings. Painting the Ground Type and Foliage State can be done using the Paint Field Ground Foliage script as described earlier in the tutorial in the Painting Field Ground Type and Foliage section. The spline can now be used to add fences/foliage/hedges etc by using the releveant scripts Fence Power Placement Paint Foliage by Spline Spline Placement All the above can be found in the relevant tutorials on the forum and are include in the Field Dimensions and Farmlands folder The following is an example using the Spline Placement. Adding hedges etc Delete the cones in the placedObjectsTG (with the splinePlacement TG selected, select and execute the Spline Placement Delete script) . Replacing the cone in the objetsToPlace TG with a 4m hedge from the in game foliage-hedge folder and setting the Set Object Distance to 4m with the splinePlacement TG selected execute the Spline Placement Script. Delete the 4m hedge from the objectsToPlace TG and replace it with a pagoda dogwood tree (or another of your choice) and reset the Spline Placements User attributes to Execute the spline Placement script Once happy with the reults then copy paste the placedObjects TG to another part of the Senegraph and rename and with the splinePlacement TG selected execut the Spline Placement Delete script to clear the placedObjects TG if required. Image below shows the result with the farmland painted with a wheat foliage texture in Giants Editor NOTE: At this point If using a fields Transform Group other than the default one in the maps gameplay TG do not forget to cut/paste the new fields TG to the correct place in the maps gameplay TG before saving the map. Also the fieldMapIndicator can now be moved to a different location if required as it is no longer used as a reference point for the scripts. With the map saved and then opened in game the following image shows the farmlands screen with farmland 01 selected showing field area with number and price. In game showing NPC details Finally field User Attributes if you want a particular field to have grass missions then all you have to do is select the fieldGrassMission option in the relevant field User Attribute in this case field01. Installation of scripts To install unzip the file and copy/paste the Field Dimensions and Farmlands folder into. C:/Users/Your Computer Names/AppData/Local/GIANTS Editor 64bit 9.0.6/scripts Note: Panel scripts can only be used with GE 9.0.6 if using earlier versions of the GE Editor then download the 'Archive Field Dimensions and Farmlands.zip' which also contains a web page copy of the old tutorial for reference. Archive Field Dimensions and Farmlands.zip Field Dimensions and Farmlands.zip Text only version.zip 2 Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted March 27, 2023 Author Wrinkley Share Posted March 27, 2023 Please note the Create Field Dimension script is still under development so changes will ocuur in later updates, mainly to the parrellogram section of the script to try and reduce the current number of corners. Link to comment Share on other sites More sharing options...
Legion Posted March 28, 2023 Share Posted March 28, 2023 OK Danke für die Info gibt es dazu dann ein Link Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted March 29, 2023 Author Wrinkley Share Posted March 29, 2023 Correct version of the tutorial now posted 1 Link to comment Share on other sites More sharing options...
Legion Posted March 29, 2023 Share Posted March 29, 2023 1 hour ago, WrinkleysRule said: Korrekte Version des Tutorials jetzt veröffentlicht Danke Schön und für die Info Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted April 9, 2023 Author Wrinkley Share Posted April 9, 2023 New script added Paint Field Ground Foliage and new section Painting Field Ground Type and Foliage added to the tutorial. This new scripts allows the Terrain Detail Ground Type (i.e. Plowed,Cultivated etc) and also a chosen foliage/ foliage state i.e wheat, harvest ready) to be painted using the field transform group (i.e. field01) Currently the Terrain Detail Ground Type (i.e. Plowed,Cultivated etc) will only be painted at the default angle and Spray Type is also not available these options will be addded on a future update to this particular script. Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted April 11, 2023 Author Wrinkley Share Posted April 11, 2023 Paint Field Ground Foliage v2.1 script now updated to allow painting of Terrain Detail Angle and also Spray type. Script added to Paint Field Ground Foliage .zip and tutorial update to reflect changes Link to comment Share on other sites More sharing options...
Pepperonie Posted December 11, 2023 Share Posted December 11, 2023 On 3/27/2023 at 7:21 PM, WrinkleysRule said: Hallo zusammen, ich bekomme beim V3 immer diesen fehlerError: C:/Program Files/GIANTS Software/GIANTS_Editor_9.0.6_64-bit/scripts/Felder Erstellen/Paint Field Ground Foliage V3.lua:72: attempt to concatenate global 'instD' (a nil value) und ich habe den pfad korrekt angegben. kann mir jemand behilflich sein? On 3/27/2023 at 7:21 PM, WrinkleysRule said: Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted December 12, 2023 Author Wrinkley Share Posted December 12, 2023 Apologise, its an error on my part to fix open the script in the Script Editor and at line 72 replace the instD with gInst. I have updated the zip file in the tutorial to correct the Line 72 error. However I have also noticed another problem which I will rectify as soon as possible , if the foliage folder is not in the normal location (maps/foliage) but inside another folder i.e. maps/textures/foliage the script will not print the foliage state of any foliage in that folder. Link to comment Share on other sites More sharing options...
Pepperonie Posted December 12, 2023 Share Posted December 12, 2023 Anything can happen. but I'm still a bit too stupid for that 😄 Error: C:/Program Files/GIANTS Software/GIANTS_Editor_9.0.6_64-bit/scripts/Felder Erstellen/Paint Field Ground Foliage V3.lua:145: bad argument #2 to 'sub' (number expected, got nil) Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted December 12, 2023 Author Wrinkley Share Posted December 12, 2023 It would appear you either have the foliage folder for your map inside a different folder like 'textures/foliage' or multiple instances of a foliage folder for the script to work the foliage folder must be in one of the following positions Map root folder /foliage maps/foliage mapUS (or mapFR/mapAlpine) / foliage I have just tried the script with Mod Map Alpine (created by mod from game), Bucks County, Alma,FS22_Recanto_da_Alvorada with no problems or errors Link to comment Share on other sites More sharing options...
Zxodiacx Posted December 15, 2023 Share Posted December 15, 2023 Well, I'm learning a lot thanks to you guys but this one I can't figure out. I get the fields made and all but I'm not sure how to make them buyable. There's no field numbers on the farmland or overview maps. Also, leaving the field number at 0 it's making two fields at once. If I start at 1 will it auto increment? And, to save me a post in the future, when I get all the fields made and copied to gameplay/fields, do I delete the Tags made by the script? Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted December 15, 2023 Author Wrinkley Share Posted December 15, 2023 Slightly confused as to where you have got to with your fields/farmlands. Basically fields are made buyable via the farmlands.xml with the price set by the pricePerHa value together with the priceScale value. Field numbers will only be seen if the field Dimensions (in GE and farmlands id (in farmlands.xml) have been created The field size is the actual field dimensions in GE Farmland size can include several fields or empty pastures/forest area and is created in the infoLayer_farmland.grle '0' should not be used as a field number it is only there to start with field nos start at 1, and no it does not increment automatically (allows flexibility when creating fields) If using the Create_FieldDimensions Panel script (from the Spline Panels folder --(https://farmerboysmodding.com/index.php?/topic/2439-new-spline-paint-height-csv-field-creationdimension-panel-scripts/) you will get an error message in the log if '0' is used for a field number. Once you have created all your fields/farmlands.xml/infoLayer_farmlands.grle and have cut pasted your fielfds transform from the fieldsNew transform to the gameplay -- fields transform (first deleting any (child) fields transform already there) then you can delete the Field_Creation_Transform Link to comment Share on other sites More sharing options...
Zxodiacx Posted December 15, 2023 Share Posted December 15, 2023 Sorry if that was confusing, I had just woke up. Files are setup as instructed and these are the steps I'm taking. ( I didn't see a spoiler tag so I'll delete this after) . The fields do show in the in-game maps but I cannot select them and they do not have numbers on either map. initial setup --> brackets mean [selected] TGs etc --> these.are.script.names Quote Field.Dimensions.Set.Up script make cones - one in newFieldMarkers, border cones in newFieldMarkers/Markers [fieldsNew/fields] - Scripts – Map – Toggle.Render.Field.Areas and for each field Quote place nFM cone in center, nfm/M cones around border [fieldsNew/fields] - Create.Field.Dimensions script - change field number [fieldsNew/fields] + [Markers] - Create.Field.Dimensions script - Execute move cones outside field edges [farmlandDimensions/fields] + [Markers] - Create.Field.Dimensions script - Execute [farmlandDimensions/fields/fieldXX] - Paint.Farmland_farmlands.xml script - Execute copy fieldsNew/fields/fieldXX to gameplay/fields/fieldXX and select it Paint.Field.Ground.Foliage script - choose foliage options [gameplay/fields/fieldXX] - Paint.Field.Ground.Foliage.v2.1 script - Execute Also, the tut says : Quote Open the Script Editor in GE (Window – Script Editor) and with the fields transform selected, in the Script Editor select the Create Field Dimension script, adjusting the variable fieldNumber setting to the next consecutive field number in this case 2. If you leave the field number at zero it will automatically start at 1 and increase consecutively throughout the current session. ETA: I also get an error if I use gameplay/fields instead of fieldsNew/fields. Link to comment Share on other sites More sharing options...
Zxodiacx Posted December 16, 2023 Share Posted December 16, 2023 I never figured it out, I deleted it and started over (that was a fresh start as well) and it mostly works now. Please feel free to delete my comments. Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted December 16, 2023 Author Wrinkley Share Posted December 16, 2023 Yes you are correct if using the old version of the script the field number does automatically increase, this was changed in the new version to allow for any fields already created and avoid any problems with field dimensions being inadvertently overwritten. I really should have deleted the old versions and updated the tutorial at the time as I am currently in the process of updating these scripts I will do the rewrite when they are completed. The latest script creates a new transform group 'Field_Creation_Transform with transform groups newFieldMarkers/fieldsNew/farmlandDimensions already set up this should be used whilst creating your field/farmlands and only when finished should the original fields transform in gameplay/fields/fields be replaced with the new fields transform group from the fieldsNew transform group You mention an error when using gameplay/fields, what is the error. Link to comment Share on other sites More sharing options...
Zxodiacx Posted December 16, 2023 Share Posted December 16, 2023 Well, just know that I appreciate everything, especially you sharing your time with me. I have a bit of the 'tism so the learning curve has been pretty steep. The error is "Error: Please select FieldDefinition defintions root!" and it happens if I use gameplay/fields rather than fieldsNew/fields when running the Create Field Dimensions script. Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted December 16, 2023 Author Wrinkley Share Posted December 16, 2023 That simply means you have to select the FieldDefinition defintions root transform group, in gamplay transform group it would be gameplay/fields easily checked by refering to the User Attributes panel in GE which should show in the Attributes onCreate --FieldUtil.onCreate In the Field_Creation_Transform it would be fieldsNew/fields and also farmlandDimensions/fields as they both require the User Attribute "onCreate --FieldUtil.onCreate" to work correctly. Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted January 8 Author Wrinkley Share Posted January 8 I have updated the tutorial to reflect the new scripts which are available at the end of the tutorial in the Field Dimensions and Farmlands.zip Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted February 28 Author Wrinkley Share Posted February 28 A problem has ben highlighted regarding the FieldUtil.onCreate attribute set by the script, it appears sometimes GE doesn't recognise some script set User Attributes leading to problems in game To overcome any problems I have amended the fieldsNew section of the tutorial to the following, fieldsNew -- containing a fields transform although this will have the FieldUtil.onCreate attribute set by the script I suggest deleting the attributes and reassigning them by Add New Attribute --Type --scriptcallback -- onCreate -- Add and in the new onCreate box enter FieldUtil.onCreate as some times GE doesn't recognise some script set User Attributes. This only applies to the field TG in the fieldsNew TG. The relevant entries created in this fields TG must be copy/pasted in to the gameplay –fields TG replacing originals before using in game If just copy/pasting the individual fields TG's (i.e field01,field02 etc) into the original gameplay -- fields TG then this amendment isn't necessary as the original fields TG should have the correct format. Link to comment Share on other sites More sharing options...
RuLon Posted March 13 Share Posted March 13 On 3/27/2023 at 7:21 PM, WrinkleysRule said: Create Field Dimensions and Farmlands Tutorial This tutorial will endeavour to show you how to create field dimensions, paint the farmland area (InfoLayer_farmlands.grle) and automatically add the relevant farmland entries in the farmland.xml together with painting your chosen Ground Type (i.e Plowed,Cultivated etc) and painting foliage at a chosen growing state on the chosen field using custom scripts. For clarity the abbreviation TG will be used to denote a Transform Group throughout this tutorial. I would like to thank Modelleicher for allowing me to use and giving permission to slightly modify the following scripts in this tutorial in order to add some extra functions. Create Field Dimension Panel Creates field dimensions from markers Paint_Farmland_Field_ID_Panel Paints the InfoLayer farmlands.grle and adds relevant data to the farmlands.xml. Paint Field Ground Foliage Panel Paints the chosen Ground Type (i.e.Plowed,Cultivated etc) and Foliage at a chosen state (i.e. wheat, harvest ready). All scripts are available in the Field Dimensions and Farmlands zip file available at the end of the tutorial. Also have a look at the following youTube videos by Modelleicher on the creation of the original scripts and for a master class on script creation. https://www.youtube.com/watch?v=jLL7x064mJc --Field Dimensions https://www.youtube.com/watch?v=QhCOBkOxjPE –Paint Farmlands https://www.youtube.com/watch?v=dxnZI8C02NY --Farmlands.xml Create Field Dimensions, Create Farmlands and Paint Ground and Foliage on the field The three scripts used for this are the Create Field Dimension Panel, Create Farmlands Panel and the Paint Field Ground Foliage Panel. The Paint Field Ground Foliage Panel script now automatically reads the Foliage Type, Ground Type, Ground Angle, Spray Type associated with your map from the map.i3d and displays it in a dropdown selection. However the Foliage State for each Foliage Type still requires a number value (position in the Layer State dropdown in GE) To assist with this the script now reads all the Foliage States of each Foliage Type directly from the maps foliage folder xml’s and prints result to the console log and to a foliage_States.txt file in the same folder as the map.i3d for easy reference, the image below shows the extracts from console log print out and the foliage_States.txt file . The foliage states listed here are from a test map based on the US map so yours may differ depending on your map set up. Open your map in Giants Editor and Select –Scripts, select the Field Dimensions and Farmlands folder to open it and then select the Create Field Dimension Panel script a popup Panel will appear on your screen. A new transform Group will automatically have been created in the Scenegraph called Field_Creation_Transform consisting of the following TG groups newFieldMarkers – this TG will be the the reference point for the fieldMapIndicator and also contains the Markers transform where the markers are placed. fieldsNew -- containing a fields transform although this will have the FieldUtil.onCreate attribute set by the script I suggest deleting the attributes and reassigning them by Add New Attribute --Type --scriptcallback -- onCreate -- Add and in the new onCreate box enter FieldUtil.onCreate as some times GE doesn't recognise some script set User Attributes. This only applies to the field TG in the fieldsNew TG. The relevant entries created in this fields TG must be copy/pasted in to the gameplay –fields TG replacing originals before using in game farmlandDimensions -- containing a fields TG with the FieldUtil.onCreate attribute set. This will be used in the creation of the farmlandsDimensions Create a primitive (Create –Primitives, I will be using a cone throughout this tutorial.) and cut/paste into the newFieldMarkers transform (this will be the position of your fieldMapIndicator in the new fields TG). Copy/paste a cone into the Markers TG Your Scenegraph should now look like this. If you haven’t already got an outline of your proposed field area then I suggest you make one using the Terrain Detail Texture Mode and a suitable texture. Once you have a field border then CTRL ‘B’ the newFieldMarkers transform into the field area. Note: The newFieldMarkers transform MUST be placed in a position that allows ALL the field boundary to be seen from that position (the cone in the newFieldMarkers TG will provide a reference point) otherwise the script will not work correctly, so for complicated field shapes you will have to create the fieldDimensions manually or by using FieldDimensionsWithBitmap script available from here https://ls-modcompany.com/forum/thread/5852-fs19-ge-script-fielddimensions-per-bitmap/ Also the Markers (cones) must be in a consecutive order, so if you have to add any additional markers to your layout (after creating one) then the extra marker must be placed in between existing ones in the Markers TG as the script uses each marker in turn to create the field Dimensions. Place the ‘cones’ along the edge of the field by CTRL ‘D’ (copy existing cone)-CTRL ‘B’ (place new cone) at suitable points as shown in the following image ( I have scaled the cones up for better definition). Using the fields transform in the fieldsNew TG to create the new field dimensions. In the Enter Field Number box enter the field number you want for this field. Now, first selecting the fields transform and holding Ctrl key select the Markers transform, releasing the Ctrl key and select the Create Field Dimension button. The new field dimensions together with the fieldMapIndicator will be created in the fields TG in the fieldsNew TG, if they are not visible in GE then with the fields TG selected Select – Scripts – Map –Toggle Render Field Areas and they should appear in GE. A Created Field Dimension for Field ‘field01’ message will also appear in the console log (field number will change to field created in subsequent operations). Results shown in following image. The script sets the default for fieldGrassMissions and fieldMissionAllowed to false. To change this to your prefered setting select the field number transform (field01 in the folowing image) And select the relevant box as shown below. fieldAngle can be left at 0, fieldDimensionIindex and nameIndicatorIndex refers to their position in the field(01) transform group 0 and 1 respectively. Painting the Field and adding details to farmlands.xml There are some tasks and settings to be done before this can be carried out. Firstly if you are starting from scratch then I suggest you ’Wipe’ the infoLayer_farmlands.grle if you already have fields painted then skip this next step. ‘Wipe’ infoLayer_farmlands.xml In GE zoom out until the whole map area (I use a pda camera for this ) is in view select the Terrain info Layer Paint Mode and in the Info Layer Painting panel select farmland in the drop down, select all the info channels (1-7). In the Terrain Editing Brush panel set a radius of 1000 and Brush Type square, paint the whole map area (ensure it is completely covered otherwise you will get errors in the log) and save the map. farmlands.xml If you have renamed your farmlands .xml then obviously use that name in the following and check the note in the Create Farmlands section regarding filePaths. Navigate to where the map.xml is located in your map normally Map Name/maps/mapUS (orFR/alpine) And open this in notepad++ and locate the <farmlands filename entry in this case it is <farmlands filename="$data/maps/mapUS/farmlands.xml" /> Change this to <farmlands filename="maps/mapUS/farmlands.xml" /> if you want to keep your farmlands.xml in the default position However I am going to put my farmlands.xml in a separate xml folder so my <farmlands filename entry will look like this <farmlands filename="maps/mapUS/xml/farmlands.xml" /> with the farmlands.xml placed in the new xml folder. Save the maps.xml. Open the farmlands.xml in notepad++ and ensure the path to the infoLayer_farmland.grle is correct the densityMapFilename should read densityMapFilename="maps/mapUS/data/infoLayer_farmland.grle" If you are starting from scratch open farmlands.xml and delete all the farmland entries like so. However if you already have fields created in the farmlands.xml then only delete any entries that have not yet been created leaving only the created ones e.g A second set of field Dimensions now need to be created in the fieldDimensions TG using the original set of markers. Select each of the field border markers in turn and move them to the outside of the field boundary (or if you have two fields that you want to have as one farmalnd area, to the outside of the whole area) Remember if you add any new markers the extra marker must be placed in between existing ones in the Markers TG as the script uses each marker in turn to create the field Dimensions. Once done first select the fields transform in the fieldDimensions TG and holding the Ctrl key select the Markers TG release the Ctrl key and select the Create Field Dimension button. Note: the field number is left as 1 in the Create Field Dimension script because this is the field number to be painted. Create Farmlands To paint the field infoLayer_farmland_grle and create the correct entries in the farmlands.xml in Giants Editor Select –Scripts, select the Field Dimensions and Farmlands folder to open it and then select the Create Farmlands Panel script, a popup Panel will appear on your screen. Set Land Price Scale- Enter your chosen price scale multiplier default is 1 Set NPC Area- Enter your chosen NPC area "ALPINE", "US" or "FR" Number of Different NPC’s Number of different NPC's (found in base maps npc.xml normally default 15) The npc number is randomly selected between 1 and the npcCount value in the script. Show on Farmlands Screen Default is true --false will stop field being shown on farmlands screen i.e showOnFarmlandsScreen="false" /> <!-- BGA, farmland bought via placeable --> When true the game scripts automatically show the farmlands so no showOnFarmlandsScreen entry will appear in the farmlands.xml Default Farm Property Default is false --true assigns ownership of field to player farm i.e defaultFarmProperty="true" /> Once you have made the relevant settings in the Panel , with the field01 TG (farmlandDimensions – fields - field01) selected, select the Create Farmlands button. Note: If your map has a non standard heiarchy or extra custom NPC characters then you will need to adjust some variables in the script, obviously if the map is a standard layout then this section can be ignored. The variables to change are, local farmLPath = {"farmlands.xml","xml/farmlands.xml"} – these are the normal places where the farmlands.xml is found. The script will automatically search for the xml in the following locations Main map folder Main Map/maps folder Main Map/maps/mapUS (orAlpine,FR) folder If your farmlands.xml has another name or placed in a different folder location then add this to the ‘farmLPath array ‘ not forgetting the quotes. local areas ={"ALPINE","US","FR"} – If you have another set of custom characters at a different location then add this to the ‘areas’ array again not forgetting the quotes. local npcCount = 15 -- If you have more custom characters then increase this number to the new amount. To carry out any of the above changes open the script in the GE Script Editor Window – Script Editor -- Field Dimensions and Farmlands - Create Farmlands Panel At the top of the script (lines 12,13,14) you will find these variables, adjust as necessary and save the script. The Script Editor can now be closed as it is no longer needed and the script is ready for use. The image below shows the resultant farmland painted (in Brown) with the farmlandDimensions overlayed in green. The inset shows the same farmland but selecting Farmland 1 in the Lands dropdown and show unmasked selected (removes the background colour) A INFO : Farmland id 1 Painted and farmlands.xml entry created message will also appear in the console log (field Id will change to any new Id created for subsequent fields). Note: Colours will vary as the Toggle Render Field Areas script randomly assigns colours to fields And the new entry in the farmlands.xml showing field 1 as belonging to the farm. You can create the fields in any order the script will adjust the farmlands.xml numerical order automaticaly and insert the next number in the appropriate place replacing the <farmland/> with the new field entry as shown below. If you try to create/paint a field ID that already exists then a warning will appear in the Console panel window and the existing farmland ID will not be overwritten , for example, +++++++++++++++++++++++++ Farmland ID 25 already exists in farmlands.xml Delete farmland Id 25 in the farmlands.xml if you wish to create a new farmland at Id 25 +++++++++++++++++++++++++ Should you wish to increase/decrease the size of the painted farmland area then in GE with the Terrain Layer Info Paint Mode selected and the farmland selected in the drop down in the Info Layer Painting Panel With the cursor over the area you wish to change select Ctrl ‘R’ on the keyboard and the correct farmland entry will appear in the Info Layer Painting Panel ready for you to paint Once happy save the map (sets the infolayer_farmland.grle) Painting Field Ground Type and Foliage This requires the Paint Field Ground Foliage Panel script. The script requires the correct Farming Simulator 2022 installation path, it uses a default path of "C:/Program Files (x86)/Farming Simulator 2022/". If your installation path is different then open the script in the GE Script Editor Window – Script Editor -- Field Dimensions and Farmlands - Paint Field Ground Foliage Panel At the top of the script at line 24 there is the following local gInst = "C:/Program Files (x86)/Farming Simulator 2022/" replace the "C:/Program Files (x86)/Farming Simulator 2022/" with your file path (including the quotes) and save the script. The Script Editor can now be closed as it is no longer needed and the script is ready for use. This script uses the created field dimensions to allow the painting of the Ground Type and Foliage to the field dimension area With the map open in GE select Scripts select the Field Dimensions and Farmlands folder then the Paint Field Ground Foliage Panel script the following pop up panel will appear on your screen Set Foliage Layer Select the Set Foliage Layer box and a dropdown will open listing all the various foliage layers in your map for example 'terrainDetail' Set Foliage State Only applies if terrainDetail not selected in the Set Foliage Layer. The number entered corresponds to the position of your chosen foliage state in the Layer State dropdown in the Foliage Layer Painting Panel of GE. To assist with finding the relevant foliage state all the foliage states for each ‘crop’ are printed in the console log and also in a foliage_states.txt file in the map.i3d folder Ground Type Selected from the Ground Type dropdown (all available terrain detail ground type’s listed). Ground Angle-Degrees Selected from the Ground Angle-Degrees dropdown (all available ground angles listed). Spray Types Selected from the Spray Type dropdown (all available spray types listed) Paint Ground/Foliage Executes the script Once you have entered your chosen settings with the field TG (i.e. field01) selected, select the Paint Ground/Foliage button Note: the Spray type works the same as if painted in GE so you will still get the requires lime/etc in the in game field info gui. The images below show console log print out for foliage states and the Paint Field Ground Foliage Panel settings for, Set Foliage Layer --terrain detail, Ground Type Ridge, Ground Angle -90,Spray Type Manure. Set Foliage Layer- potato, Foliage State - 5 (green big) Ground Type/GroundAngle/Spray Type left as previous as they have no effect if terrainDetail not selected. To erase/change any option select the foliage layer you want to change and either deselect it (blank) to remove or choose another foliage type , the same applies to the other options. For example selecting terraindetail and deselecting (blank) in the other setting(s) to be erased and selecting the Paint Ground/Foliage button will revert the field to the original ground texture ( in this case ‘dirt’) To remove foliage , select that foliage in the Set Foliage Layer dropdown and enter ‘0’ in the Foliage State select the Paint Ground/Foliage button will remove all the foliage of that selected Foliage Layer The script will work on any TG that has field dimensions so for example can be used to fill a predefined area that has been created using the field dimensions script. Note : Density Map Modifier details will also be printed in the log whenever the Paint Ground/Foliage script is used, this is not an script error but a GE info regarding number of channels e.g. DensityMapModifier: defaulting num channels to 10 DensityMapModifier: called from =C:/Users/Admin/AppData/Local/GIANTS Editor 64bit 9.0.6/scripts/PanelScripts/Field Creation Scripts/Paint Field Ground Foliage V4.lua (275) If manually painting the terrain detail a little tip, in the Limit to Texture drop down in the Foliage Layer Painting panel select the texture of your field area this will restrict the painting to that texture only and not paint over the grass border texture the image below shows the effect of these settings. To create other fields repeat the above methods. Once you have completed all your fields then, if starting from scratch cut/paste the fields TG from the fieldsNewTG to the gameplay TG replacing original. However if you already have fields created then copy/paste the fields TG from the fieldsNewTG to the gameplay TG and move any existing fields into the new field TG. Save the map. --------------------------------------------------------------------------------------------------------------- Method 2 Using a Spline This method is more or less the same as the first except I will be using a spline to create the field border and place the markers, the placedObjects TG will be used instead of the Markers TG when creating the field Dimensions. The scripts used in this section of the tutorial are:- Spline Placement set –Transform/Place/Delete Sets the required transform groups in the scenegraph Places objects along a spline Option to delete the current placed objects Create Field Dimension Panel Creates field dimensions from markers Create Farmlands Panel Paints the InfoLayer farmlands.grle and adds relevant data to the farmlands.xml. Paint Field Ground Foliage Panel Paints the chosen Ground Type (i.e.Plowed,Cultivated etc) and Foliage at a chosen state (i.e. wheat, harvest ready). Spline Paint Panel Paints chosen texture(s) along/either side of a spline If you haven’t used the Spline Placement scripts/ Spline Paint Panel scripts before then I suggest you have a look at the tutorials linked below. https://farmerboysmodding.com/index.php?/topic/2414-terrain-height-paint-terrain-and-spline-placement-scripts-tutorials/ Initial set up When using scripts in GE that do not require access to the script editor (such as the Toggle Render Field Areas) what I normally do is go to Scripts –Map, which opens the folder at the bottom of the popout is Detach Menu, selecting this undocks the folder from the Scripts list which can then be place anywhere on the screen or redocked into the side panels (see images in the tutorial for examples). Open map in GE, open Script Editor (Window – Script Editor) select and execute the following script (found in the Spline Placement folder):- SplinePlacement Transform – this will create the necessary transform group heirachy for the script In GE create a spline (Create—Spline) and cut paste it into the splinePlacement transform. Create a primitive (Create—Primitives) again I will be using a cone, and copy/paste one into the objectsTo Place transform and another into the splineObjects transform (this one is used as a guide for the fieldMapIndicator) . I will be using the exsisting transform group farmlandDimensions TG from the previous method infoLayer_farmlands.grle and farmlands.xml set up is the same as previous method. The splineObjects transform will be used to create a field boundary and place the markers, the spline itself will also be used to paint a field border in a suitable texture The farmlandDimensions TG with the fields transform will be used to create a second set of fieldDimensions in a new (in this case ) field02 transform to be used for painting the infoLayer_farmland.grle and creating a new entry in the farmlands.xml in the same way as before. Creating Field Dimensions These are created much the same way as the before the exception is now the field boundary is created using a spline. Select the splineObjects TG place it into the field by Ctrl ‘B’ , again the whole field boundary must be visible from the chosen location. Select the spline and place it in a suitable postion on the field boundary (I have chosen the top right corner and have also deleted the ‘S’ cv to forestall any rotation problems with the spline) and using just the ‘E’ cv create the field boundary (to get sharp corners insert an extra cv before continuing along the boundary). Once the boundary has been completed the field border can be painted by selecting the spline in the splinePlacement TG and in GE -- Select - Scripts—Spline Paint Panel the following image shows the panel set up for this particular field edge. This will paint a 5m ROUGHGRASS border to the left of the spline (viewed from the ‘S’ cv). The script reads all the various textures from the map.i3d and assigns them (in order) in the relevant dropdowns. You can of course select your own texture from the dropdown any texture/area you do not want painted the -1 must be selected. If required you can now easily paint the field texture (DIRT) itself by using the Limit to Texture method described earlier. With the border now painted select the splinePlacement transform to bring up the splinePlacement User Attributes and set the User Attributes as follows, Set Object Distance – 20 -- This can be set to any suitable number as long as the complete field border covered Fixed Distance --Selected –Enables items to be placed a fixed distance away from the spline Set Distance Fixed -- -5 --Is the distance objects will be placed away from the spline in this case - 5 m to allow for a 5m field border ( - 5 to the left of the spline viewed from the ‘S’ cv) other settings can be left as default. With the splinePLacement TG selected and the Spline Placement script selected either in the Script Editor or from the Detached Panel execute the script, (I have scaled the cone by 4 and freeze transformed for clarity). This image shows the field border painted together with the cones placed around the field perimeter The next step is to thin the cones out by deleting unnecessary ones (either one by one or left click drag to select multiples) and adjusting the position of others for better shaped field dimensions, in the next image the inset shows the the cones thinned out and the field dimensions created after entering field number then first selecting the fields transform (in the fieldsNew TG) and holding the Ctrl key select the placedObjects TG, release the Ctrl key and in the Create Field Dimension Panel select the Create Field Dimension button Note any other field dimension already created will also show when selecting Toggle Render Field Areas Next to create the second set of farmlandDimensions first select the spline Placement TG and in the Script Editor select Spline Placement Delete, in the Spline Placement folder (this will execute the script) In the Spline Placement User Attributes change the Set Fixed Distance to 2 (this will place the cones 2m outside the spline) and with the Set Object Distance still at 20 select Spline Placement, again adjust the position of the cones to create a smooth path around the field border If creating the fields farmlandDimension next to one already created then to ensure no gaps in the painting between the fields in the infoLayer_farmland.grle, with the fields TG ( in the farmlandsDimension TG) selected, select Scripts - Map – Toggle Render Field Areas, this will show all the farmlandDimension currently created. Then adjust the cones so that they align with the other fields farmlandDimensions, the following image shows an example of this in the inset. Once done, in the Create Field Dimension Panel leave the field number the same as the one for field dimensions first select the fields TG ( in the farmlandsDimension TG) and holding the Ctrl key select the placedObjects TG and select the Create Field Dimension button. The newly created field02 farmlandsDimension created Painting field infoLayer_grle and farmlands.xml This is done in the same way as the previous tutorial. Open the Create Farmlands Panel (Scripts - Field Dimensions and Farmlands - Create Farmlands Panel ) Set the options as required then in the fields TG ( in the farmlandsDimension TG) select (in this case) field02 and then the Create Farmlands button to execute the script. The image below shows the new field02 farmland painted in the infoLayer_farmland.grle (Terrain Info Paint Mode selected) together with the previous field01 creation. And in the farmlands.xml the following settings. Painting the Ground Type and Foliage State can be done using the Paint Field Ground Foliage script as described earlier in the tutorial in the Painting Field Ground Type and Foliage section. The spline can now be used to add fences/foliage/hedges etc by using the releveant scripts Fence Power Placement Paint Foliage by Spline Spline Placement All the above can be found in the relevant tutorials on the forum and are include in the Field Dimensions and Farmlands folder The following is an example using the Spline Placement. Adding hedges etc Delete the cones in the placedObjectsTG (with the splinePlacement TG selected, select and execute the Spline Placement Delete script) . Replacing the cone in the objetsToPlace TG with a 4m hedge from the in game foliage-hedge folder and setting the Set Object Distance to 4m with the splinePlacement TG selected execute the Spline Placement Script. Delete the 4m hedge from the objectsToPlace TG and replace it with a pagoda dogwood tree (or another of your choice) and reset the Spline Placements User attributes to Execute the spline Placement script Once happy with the reults then copy paste the placedObjects TG to another part of the Senegraph and rename and with the splinePlacement TG selected execut the Spline Placement Delete script to clear the placedObjects TG if required. Image below shows the result with the farmland painted with a wheat foliage texture in Giants Editor NOTE: At this point If using a fields Transform Group other than the default one in the maps gameplay TG do not forget to cut/paste the new fields TG to the correct place in the maps gameplay TG before saving the map. Also the fieldMapIndicator can now be moved to a different location if required as it is no longer used as a reference point for the scripts. With the map saved and then opened in game the following image shows the farmlands screen with farmland 01 selected showing field area with number and price. In game showing NPC details Finally field User Attributes if you want a particular field to have grass missions then all you have to do is select the fieldGrassMission option in the relevant field User Attribute in this case field01. Installation of scripts To install unzip the file and copy/paste the Field Dimensions and Farmlands folder into. C:/Users/Your Computer Names/AppData/Local/GIANTS Editor 64bit 9.0.6/scripts Note: Panel scripts can only be used with GE 9.0.6 if using earlier versions of the GE Editor then download the 'Archive Field Dimensions and Farmlands.zip' which also contains a web page copy of the old tutorial for reference. Field Dimensions and Farmlands.zip 21.96 kB · 36 downloads Archive Field Dimensions and Farmlands.zip 20.54 MB · 16 downloads Hello, firstly, I am here first time so let me know if I send this reply correctly, second thing, I need some help with painting farmlands, the script. So it wont paint farmlands on fields that I created with script with these red dots, everything seems to work fine becouse in console appear INFO: Farmland id (for example 10) painted in farmlands.xml entry created- and in the xml file it appear too, but I cant see that any farmland was painted in giants editor. I can say too that it works fine with fields that I painted ,,by hand". What should I do Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted March 14 Author Wrinkley Share Posted March 14 Could you supply a GE image of the InfoLayer_farmlands.grle of your map with the Terrain Info Layer Paint Mode selected and farmlands selected in the Terrain Editing Panel Info Layer Painting, Info Layer box Preferably of the farmland area's that appear to have not been painted by the script Link to comment Share on other sites More sharing options...
Brummie Farmer Posted May 17 Share Posted May 17 Just downloaded script and started using it, created first field no issues, when i tried to create the farmland got this error Error: Running LUA method 'UIButton::onClick'. C:/Users/Brummie Farmer/AppData/Local/GIANTS Editor 64bit 9.0.6/scripts/Field Dimensions and Farmlands/Field Dimensions and Farmlands/Create Farmlands Panel.lua:199: attempt to index local 'modifier' (a nil value) it creates the line in farlands.xml, but it does not paint the farmland onto the map. I followed the above tutorial and tried 5-6 times, but still can't get it to work. Link to comment Share on other sites More sharing options...
Wrinkley WrinkleysRule Posted May 17 Author Wrinkley Share Posted May 17 I have just downloaded and tried the script several times and I am getting no errors in execution. The error points to a problem in the field dimension creation so I suggest you check/redo the Create Field Dimensions script and see if that helps. For the farmland paint to show up in GE the Terrain Info Layer Paint Mode must be selected and the relevant Info Layer 'farmland' and Lands (field no) must be selected. Nothing to do with the error but bit curious about this double folder entry C:/Users/Brummie Farmer/AppData/Local/GIANTS Editor 64bit 9.0.6/scripts/Field Dimensions and Farmlands/Field Dimensions and Farmlands/Create Farmlands Panel Link to comment Share on other sites More sharing options...
Brummie Farmer Posted May 17 Share Posted May 17 I have tried starting from scratch again, but still not working, not sure why, but i have added screenshots. 1 is the field generated. 1 is the field generation for the farmland and the other is when Info Layer selected. It creates the entry in in xml, but I just can't get it to show in ge tbh I didn't even notice the double foldr, it happened when I unzipped from download, there is folder inside folder, but I corrected that now 🙂 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now