Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/27/2024 in all areas

  1. Paint Foliage by Spline Panel This script is slightly different to the previous version in that it only paints in one area whereas the previous script painted in two independent area’s, this has been done to increase the stability of the script and also improve the Random Foliage Paint option. The script now automatically reads the map.i3d to list in the UI drop downs, all the Foliage Type’s associated with your map so there is no longer any need to add any extra foliage/crop to the script. 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. The script allows for a max no of Foliage/Crop Types = 100 and max no of individual Foliage States = 20 To undo any of the Foliage Layers, Set Foliage State to '0' and ensure Random Foliage Paint is deselected then Select Paint Foliage The script ignores any entry in the Set Foliage State if Random Foliage Paint is selected Unzip the Paint Foliage by Spline.zip (found at the end of the tutorial) and place the script in:- C:/Users/Your Computer Name/AppData/Local/GIANTS Editor 64bit 9.0.6/scripts The script requires the Farming Simulator 2022 installation path , it is set at a default of “C:/Program Files (x86)/Farming Simulator 2022” If your installation path is different then, Open Giants Editor, Select -- Window --Script Editor and navigate to where you have placed the new script and select it. Once opened, in the editor go to line 30 local gInst = “C:/Program Files (x86)/Farming Simulator 2022” and replace the entry (after the 😃 with your installation path including quotes Once done save the script, the Script Editor window can now be closed as the script is now ready to be used. Paint Foliage Open the script in GE Select -Scripts –Paint Foliage by Spline Panel a popup panel will appear on the screen Set Overall Width Width of area to be painted Set Offset Paint Distance Distance either side and away from the spline to be painted e.g A setting of 10 will paint foliage 10m to the left of the spline at the width set Set Foliage Type Select Foliage Type from the dropdown Set Foliage State This number when entered refers to the Foliage State 0,1,2 etc of the selected Foliage, refer to the Foliage State print out in the console log or to the foliage_States.txt file in the map.i3d folder for the associated numbers and foliage state types. Set Second Foliage State This number refers to the second Foliage State value used by the Variable Foliage State option and is only relevant if Variable Foliage State and Random Foliage Paint options are selected Variable Foliage State When selected along with Random Foliage Paint option allows only parts of the Foliage Types States to be randomly painted, see further description below Random Foliage Paint When selected allows random painting of all the foliage States for the selected Foliage along and around the spline To delete foliage after using, Random Foliage Paint must be deselected and ‘0’ entered in the Set Foliage State box Random Foliage Distance When selected paints the selected foliage at a random distance along the Spline, width of paint is controlled by the Overall Width setting Set Distance Between Foliage Paints the foliage at the distance set along the spline, width of paint is controlled by the Overall Width setting. Variable Foliage State Option This option allows the choice of which section of the Foliage Type States are to be randomly painted along/around the spline. It is only used in conjunction with the Random Foliage Paint. For example with Variable Foliage State and Random Foliage Paint selected and the other inputs set as follows Set Overall Width - 10 Set Foliage Type – groundFoliage, Set Foliage State – 7, Set Second Foliage State – 14 It will only randomly paint foliage states 7 (cover foliage) to 14 (stinging nettles) in a path 10m long along/around the spline. To delete foliage, Random Foliage Paint must be deselected and ‘0’ entered in Set Foliage State panel. If any of the random options have been used then there will be some bits of foliage left (due to the random paint). This can easily be deleted by selecting the relevant foliage layer in the Foliage Layer Painting panel in GE and using the subtract brush. When painting foliage using the same densityMap.gdm any existing foliage it will be erased by the new foliage. Normally the ground foliage ,stone and weed use separate density maps all other foliage use the densityMap_fruits.gdm. The following images show the script in basic operations Note: The over painting at either end of the spline is due to the Random Foliage Paint which will paint the selected foliage, foliage states at random along and around the spline This can easily be deleted by selecting the relevant foliage layer in the Foliage Layer Painting panel in GE and using the subtract brush. Bear in mind the wider and longer the painting the longer the script will take to work, the Paint Foliage button will turn blue when activated, when it turns white the script has finished. As always play around with the script on a blank map to see what effects you can obtain before using on a WIP map. The next image shows a short road/lane section created using the Spline Paint Panel and the Paint Foliage by Spline Panel scripts. Paint Foliage by Spline Panel.zip
    1 point
  2. This script can be used to easily place fences/power lines on a map using a spline. It consists of a basic spline placement script and a modified easyFence script (by modelleicher) combined with some extra enhancements. The script works by first placing posts/poles aligned to the terrain along a spline, it then places fence boards/wires on these posts/poles scaling them to match the distance to the next post/pole. To install download the script (available at the end of this tutorial) unzip the fencePowerPlacement.zip and Copy/Paste the script into C:\Users\Your Computer Name\AppData\Local\GIANTS Editor 64bit 9.0.4\scripts. Once installed, to initiate the script select the Fence Power Placement script in the GE Scripts tab. A panel will pop up somewhere on the screen. The image below shows the Panel, together with a brief description of the Inputs/Parameters Points to Note before using this script. All posts/poles/wires/boards Must be scaled at 0,0,0 before use in the script Items to be placed Must be aligned along their ‘Z’ axis with the point of origin at one end. Number of Wire/Board alignment nodes Must be the same on all posts/poles used and in the same order top to bottom otherwise you will have crossovers between the posts. The post/pole transform group hierarchy must always start with the post mesh followed by the wire/board alignment nodes it can then be followed by any other meshes although I think best practice would be to have a single mesh for the pole/post including all the parts. The following image shows the transform group hierarchy and the telegraphPost placed using the script Above Telegraph pole taken from the FS19_telegraph pole kit by Robbie available on modhub Placing a Simple Fence Simple post, fence board creation For this example I will create a simple post/board using the Create- Primitive - Cube in GE The finished fence will consist of square posts and three fence boards If you already have a suitably aligned post and fence board then skip the next section, import post and fence wire/board into GE and go to Adding the alignment nodes to a post. section. If not continue with the following, In GE Create - Primitive - cube In the attributes panel Translate 'Y' enter 0.5 also rename this post_1 Select Edit - Freeze Transformations and select Translate - this will move the cubes point of origin to the base of the cube In the attributes panel enter the following into the Scale transforms 'X' 0.15 , ‘Y’ 1.5, 'Z' 0.15 and Freeze transformation Scale (only Scale ensure all others boxes are deselected) In the material panel in Albedo Colour enter 0.4, 0.2, 0.2 this will give a brownish colour to the post Create a second cube In the attributes panel Translate 'Z' enter 0.5 and rename this to board_1. Select Edit - Freeze Transformations and select Translate - this will move the cubes point of origin to edge of the cube In the attributes panel enter the following into the Scale transforms Scale 'X' 0.1, 'Y 0.2 'Z' 4 and Freeze Transformation Scale (only Scale ensure all others boxes are deselected) Because this second cube still uses the material name ‘Unnamed material’ it will be the same colour as the post. Create a new transform group and name this fencePowerItems Select post_1 with the middle mouse button and keeping the middle mouse button pressed move post_1 into the fencePowerItems transform group, do the same with board_1. The reason for this is to keep the transforms all set to 0,0,0, which will prevent any unseen conflicts with translation positions. With the fencePowerItems transform selected on the keyboard select Ctrl B to place it in your current view port for reference. Adding the alignment nodes to a post. Create a new transform group –Create – Transform Group Select the new transform group with the middle mouse button and keeping the middle mouse button pressed move the new transform group into the post_1 transform. If you do not have a middle mouse button then cut/paste the new transform into the post transform. Next move the new transform up to where you want the lowest board to be With the new transform selected on the keyboard select Ctrl D to duplicate then move this second transform to the centre board position, repeat this step for the third transform placing it where the top board will be. Your post_1 alignment transforms should look like the post in the alignment image above. Your post transform should look like the following image Open your map in GE Create a spline – Create- Spline rename to spline_1 and align it along the route you want to place your fence. Select Scripts – Fence Power placement to initiate the script. In the Scenegraph a new transform group ‘fence_powerObjects’ will have been created consisting of three transform groups wire_fenceNode – place the fence board(s), wire(s) in this transform group fencePlacement Transform Group postObject – place your post(s)/ pole(s) in this group placedObjects – your complete fence/power line will be placed in this group when the script has been executed (select Create Fence/Power Line) The spline has to be placed in the fencePlacement Transform Group For those familiar with the original Spline Placement script this fencePlacement Transform Group works in the same way as the Spline Placement script. I have renamed the post_1 and board_1 meshes to post1S1,board_1S1 (S1 being spline_1) respectively. Unfortunately GE will scale all objects of the same name throughout the map so I have done this so that I can easily freeze the scale transformations on the completed fence/power line without affecting any other mesh in the map. Copy/Paste board_1 into the wire_fenceNode transform (rename if you want to). Copy/Paste post_1 into the postObject transform. (rename if you want to). Cut/Paste the spline into the fencePlacement transform Set Post Distance – 4 – posts will be set 4m apart Stay Upright – Selected – this will ensure the posts remain upright regardless of terrain contour Select Random Spline Order – Deselected – this will be used in a later section of the tutorial Select Random Wire/Board Placement – Deselected -- this will be used in a later section of the tutorial No of Wire/Board Nodes – 3 – this is the number of transform nodes on the post Maximum Posts – 0 – Default setting means all post will be used Start Post – 0 – default setting script will start at first post Remove Current Fence/Power Placement – Deselected With the fencePlacement transform Selected, Select the Create Fence/ Power Line button The fencePlacement transform must be selected for the script to run. In following image ‘Image 1’ shows the renamed post_1 and board_1 in their correct transform groups together with the spline in its correct position and the Fence/Power Placement Panel ready for input. Image 2 shows the Fence/Power Placement Panel with all the relevant data entered and the script executed by selecting Create Fence/ Power Line button Image 3 shows another view of the placed fence and the two other insets shoe the difference between Selecting/Deselecting the Stay Upright parameter You can check out the difference between the Stay Upright modes by, Remove Current Fence/Power Placement –Select – this will delete the current fence placement Stay Upright – Deselected Remove Current Fence/Power Placement –Deselect – Important step otherwise new placement will not take place Select -- Create Fence/ Power Line button – this will create the same fence placement but with the posts following the terrain contour To return to the original placement, Remove Current Fence/Power Placement –Select Stay Upright – Selected Remove Current Fence/Power Placement –Deselect – Important step otherwise new placement will not take place Select -- Create Fence/ Power Line button The Remove Current Fence/Power Placement selection can be used to delete an existing placement and add/change any parameter then execute the script with the new settings. For wire placement the alignment method is slightly different in that the transform nodes are placed on the outside of the post on the ‘X’ face. Although normally a fence post created for wire would already have the staples (the staples would have to be on the ‘X’ face of the post) as an integral part of the post mesh. Random Post/Board Placement For this example I have created a shiny round post by, Create – Primitive – Cylinder Rename – post_2 Translate ‘Y’ – 0.5 Freeze Transform Translate Scale X 0.2, Y 2, Z 0.2 Freeze Transform Scale Albedo Color 0.8,0.8,0.8, Smoothness 1 Metalness 1 Cut Paste into fencePowerItems Transform For the boards I have just duplicated board_1 twice renamed board _2, board _3 respectively and scaled X,Y values (not Z as this is the distance between posts) then Freeze Transformed scale on the new boards Ctrl B the new fencePower Items to your map location The alignment nodes on the post are set up the same way as for the post_1 (must be the same number) Copy/Paste board_2,3 into wire_fenceNodes Copy/Paste post_2 – into the postObject transform Using the same spline the script set up is as follows Set Post Distance – 4 – posts will be set 4m apart Stay Upright – Selected Select Random Spline Order –Selected Select Random Wire/Board Placement – Selected No of Wire/Board Nodes – 3 – this is the number of transform nodes on the post Maximum Posts – 0 – Default setting means all post will be used Start Post – 0 – default setting script will start at first post Remove Current Fence/Power Placement – Deselected With the fencePlacement transform Selected, Select the Create Fence/ Power Line button The image below shows the Script parameters and random placement of both the posts and boards If you want to create some missing fence boards add another empty transform group to the wire_FenceNode transform group. The odd posts are deliberate to highlight the effect of the random spline placement Power Lines I will be using some premade power pole and wires for this example An example of a power pole with multiple objects is shown in the Points to Note before using this script section at the beginning of this tutorial The alignment node set up method is slightly different for the power poles. Create a transform group and Select the new transform group with the middle mouse button and keeping the middle mouse button pressed move the new transform group into the powerPole transform group. With the new transform node selected, hover the mouse over the insulator you want to hold one of the wires, then Ctrl B left click twice to place it on the insulator Do the same for all the other insulators Image below shows the placement of Power Lines together with the relevant script settings, inset gives a clearer picture of the placement Below Power Placement using the Select Random Wire/Board Placement with an extra saggy wire (wireSag2) randomly placed again inset shows clearer placement Finally using the script twice to place power Lines and a damaged barbed wire fence Further Notes Wire_FenceNode objects must be single meshes and not part of any transform group. There is no limit on the no of items that can be placed in either the wire_FenceNode or the postObject node the only stipulation on extra posts is that they must all have the same number of alignment nodes. Post/poles must also be single meshes and not part of any transform group. The alignment nodes on any post/pole must be the first children of that mesh, however other meshes can be placed after the alignment nodes for example Though currently if using a tree it will only be placed in one rotation and LOD1 is not supported. You can of course manually place a tree in place of a post by first selecting the post in the viewport and then in the scenegraph copy the three transform nodes of that post. Using the replace function select the post as the Target and the tree in the Replace With section and select Replace, align the tree with the end of the previous posts wires and with the tree transform group selected paste the original 3 transform copied previously into it The following image shows the result of this method Error Messages Error messages will appear in the console log if, Nothing is in the wire_FenceNode transform group Nothing is in the postObjects transform group Incorrect number of transform alignment nodes on a postObject item error message and name object will be printed in the log Spline is in the wrong transform group or not present in the fencePlacement transform Group When the script has finished the following will be printed in the log Finished! Enjoy the fence 🙂 Spline Name: (name of spline) As normal I suggest you try this script out on a test map before using on any WIP map also this script is still being developed so may change at a later date. Original Easy Fence script available here select all and paste into new notepad++ file and save as easyFence.lua. https://pastebin.com/1DR6qDcE Damaged barbed wire/poles taken from FS 19 Barbed wire fence kit by Robbie https://www.farming-simulator.com/mod.php?mod_id=105801 Fence_Power_Placement.zip
    1 point