Survival Game Kit V2
Player Farming System
Integration

This is a guide on how to integrate Player Farming System into
Survival Game Kit V2.

Make a backup of your project before following this guide!

Start by migrating the PlayerFarmingSystem folder from the Player Farming System project to your Survival Game Kit V2 project like the video below. Make sure the engine version of both projects is the same.

Collision


In the Survival Game Kit V2 project go to the Project Settings then go to the Collision category and copy the video below.

Next create the new Presets and copy the settings show in the images below then copy the video below.

Go to the BP_WarmthDetectorComponent and in the Class Defaults set the Warmth Collision Channel to Light.

Then go to the BP_LightDetectorComponent and in the Class Defaults set the Light Collision Channel to Light.

Controller/Gamemode


Go to BP_SGKController and add the BP_PlayerFarmingComponent using the add button in the Components panel. Then add the highlighted nodes shown in the image below.

Go to the BP_SGKGameMode and also open the BP_FarmingGamemode and copy the video below.

Next copy the images below, locations at the tops of the screenshots, these functions will be in the Interfaces tab in the My Blueprint panel.

Player Building Component


Go to the E_BuildType in the content browser and add a new enumerator called Farming like the image below.

Next I recommend playing in editor, once the character loads in you can exit.

Note – You may have errors after this step this is fine they will be resolved.

Next go to the BP_PlayerBuildingComponent and create a new variable called FarmingComponent and set its type to the BP_PlayerFarmingComponent. Then copy the images below, locations at the tops of the screenshots.

SGK Master Character


Go to the BP_SGKMasterCharacter then copy the video below,

Next copy the images below, this function will be found in the Interfaces tab in the My Blueprint panel.

Master Build Part


Next go to the BP_MasterBuildPart in the Content Browser then create a new variable called Farming and set its type to Boolean and tick on Instance Editable in the variable settings and make sure its Default Value is unticked, then copy the images below.

Next copy the video and image below, make sure the BP_GroundDetectComponent you select on the Get Components By Class node is the one in the Farming Systems folders.

Next in the Components panel rename the StaticMesh component to BuildPartStaticMesh and compile, I recommend playing in editor after making this change, once the character loads you can exit play in editor.

Master Farming Actor


Go to the BP_MasterFarmingActor in the Content Browser, then copy the video and image below, location at the top of the image.

Then in the Class Defaults search for Farming and Tick on the Farming setting. Next copy the videos and image below.

Player Farming Component


Next go to the BP_PlayerFarmingComponent and in the Class Defaults make sure the settings shown below in your project and the same as the image below.

Next create a new variable called PlayerInventory and set its type to BP_PlayerInventory, then copy the images below, locations at the tops of the screenshots.

Then compile and save the blueprint. Then play in editor, once the character loads in you can exit play in editor. Then click save all in the content browser and save all the blueprints. Then I recommend closing the project and then reopening it.

Save System


Go to the S_LevelSaveData struct in the Content Browser, make sure you open the one included with Survival Game Kit and not Player Farming System then copy the video below.

Then play in editor, once the character loads in you can exit play in editor, then click save all in the Content Browser.

Note – If the engine crashes when you play in editor reopen it, copy the video above and click the save icon in the struct then play in editor, if the engine crashes you can reopen it and continue following the guide.

Note – You may get errors in the master cooking and master crafting build part blueprints if you do just open those blueprints and compile them this will resolve the errors.

Next go to the BP_SGKSaveGame then copy the video and images below.

Next open the BP_SaveSystem blueprint that comes with Survival Game Kit V2, and copy the video below.

Master Plant


Go to the BP_MasterPlant and copy the images below.

Next in the Class Defaults find the collision category in the Farming Settings and copy the settings shown below.

Next copy the videos below,

Next copy the images below, these functions are found in the Interfaces category in the My Blueprint panel.

In the SGK Interact function create a new local variable called FarmingComponentL and set its type to BP_PlayerFarmingComponent.

Then in the Class Defaults find the Show Health Bar UI and make sure its unticked.

Then select the StaticMesh component in the Components panel and in the Details panel clear the Static Mesh setting so its set to none.

Master Planter


Next follow the video below, copy the code shown in the BP_MasterPlant and paste it into the BP_MasterPlanter

Master Light


Next follow the video below, copy the code shown in the BP_MasterPlanter and paste it into the BP_MasterGrowLight.

Next copy the images below, these functions are found in the Interfaces category in the My Blueprint panel.

Master Sprinkler


Next follow the video below, copy the code shown in the BP_MasterGrowLight and paste it into the BP_MasterSprinkler.

Next copy the images below, these functions are found in the Interfaces category in the My Blueprint panel.

Open the Add Water function and on the Make Array node shown in the image below click add pin and set the new entry to Build Part like the image.

Interaction Context Menu


Go to the BP_InteractionContextMenu and add in the nodes shown below, location at the top of the image.

Then play in editor, once the character loads in you can exit play in editor. Then click save all in the content browser and save all the blueprints.

Adding Build Parts


In this section you can choose between two options. Run a script to add the new farming items, build parts, and world items to your project (Option A), or add each of them manually (Option B).

Option A

Download the Python script (here) then follow the video below to run it.

Important: Back up your project before running the script.

After running the script you can find the new farming item’s data in the Blueprints/Items folder in the FarmingItemList and their build part data in the Blueprints/BuildParts folder in the FarmingBuildPartList.

Option B

Next we’re going to add new entries to the ItemList and BuildPartList for the farming object, then we will create the world item blueprints for those objects.

Click Add to create a new row in the BuildPartList, then double-click the row name (bottom left) and enter the farming actor name. It must match the row name in the Player Farming System: PlantList for plants, PlanterList for planters, and ToolsList for tools, so check the relevant list first.

Then set Type to Farming and Blueprint Class to the farming object’s class like shown in the image below.

In the ItemList, click Add to create a new row, then double-click the row name (bottom left) and rename it to the farming actor name.

Set the item details: add the Place action to InventoryActions, and fill in the rest (UI Details, description, static mesh, etc.). You must set both the Inventory Icon and Move Icon in UI Details, or you’ll get an error.

Then scroll down to the build part details setting and point it to the farming actor row you just created in the BuildPartList, as shown in the image below.

Return to the BuildPartList and select the farming actor’s row, then set its Override Item Cost, which is the item cost of placing the device. Add a new entry, set the Data Table to MasterItemList, and set the Row Name to the entry you just added to the ItemList, as shown in the image below. You can also set the Amount of that item required to place the farming actor.

Next in the content browser go to the SurvivalGameKitV2/Blueprints/Items/WorldItems folder, then duplicate BP_9mm_WI blueprint and name it your farming actor name, so for example BP_TomatoPlant_WI

Then open that blueprint and go to the Class Defaults and find the Item setting, then change the Row Name to your farming actors row name in the ItemList like the image below.

Lastly open the build part blueprint in the PlayerFarmingSystem/Blueprints/Plants so for example the BP_TomatoPlant then in its Class Defaults search for Build Part then set its Data Table to MasterBuildPartList and set its Row Name to the devices row name from the BuildPartList like the image below.

You will need to repeat this section of guide for each of the plants, planters and tools.

Harvesting, Cure, Watering and Fertilizing


Next set the item the player receives when harvesting a plant. Open the plant’s blueprint in PlayerFarmingSystem/Blueprints/Plants (this example uses BP_TomatoPlant), select BP_PlantComponent, and in the Details panel go to Plant Settings then to Vegetable settings. Set it up as shown in the video below.

The Resource name must be a row name from the ItemList, as this determines the item the player receives. You can also set the min and max amounts, and add additional items if you wish.

You will need to do this with each plant that you can harvest.

Next set the item cost of watering a plant. Open BP_PlayerFarmingComponent, go to Class Defaults, and find Water Resource Cost in the Resources category. Set the Resource name to the row name of the ItemList item the water action should use, and set the amount, as shown in the image below.

You can set the Fertilize and Cure Resource Costs the same way, using an ItemList row name and an amount.

You can set multiple items in these cost settings, this will mean the player will have to have at least one of the items you add to the cost setting to be able to do that action.

HUD


You may want to now remove some of the HUD widgets from the farming systems HUD as we are no longer using them, you can follow the video below in the BP_FarmingHUD to remove these widgets.

Other Blueprints


Open BP_NoBuildZone, select the NoBuildZone component, and in the Details panel under Collision Presets, set Preview and Light to Ignore.

Next open BP_DamageZone, select the DamageZone component, and under Collision Presets set Preview, Light and Placement to Ignore. For plants to take damage from the zone, select the PlantMesh component in each plant’s blueprint and tick Generate Overlap Events in the Details panel.

Finally open BP_PlotPole, select OwnershipSphere in the Components panel, and set its Collision Presets as shown in the image below.

Optional Extras


You can find a guide below for additional optional extra features you may want to add in after integrating Player Farming System with Survival Game Kit V2