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

Make a backup of you project before following this guide.

Start by migrating the PlayerElectricitySystem folder from the Player Electricity 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.

Next edit the existing presets like shown in the video.

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

Next go to the BP_CableConnectionPointComponent and go to the Class Defaults then make sure the Preview Collision Channel is set to Preview.

Controller/Gamemode


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

Note – When following the image above if you have already integrated Player Farming System the code will need to look like the image linked (here).

Go to the BP_SGKGameMode and copy the video below.

Go to the BP_SGKMasterCharacter blueprint and copy the video below.

Open the E_BuildType in the content browser and add a new enumerator and call it Power like the image below.

At this point I recommend playing in editor, this will compile the effected blueprints, once the character loads in your can exit play in editor.

Player Building Component


Next go to the BP_PlayerBuildingComponent, create a new variable called PlayerPowerComponent and set its type to BP_PlayerPowerComponent then copy the images below, locations at the top of the screenshots.

The node connected to the Type pin is the Equal (Enum) node

Note – When following the image above if you have already integrated Player Farming System the code will need to look like the image linked (here).

The node connected to the Type pin is the Equal (Enum) node

Note – When following the image above if you have already integrated Player Farming System the code will need to look like the image linked (here).

Next I recommend playing in editor, this will compile the effected blueprints, once the character loads in your can exit play in editor, I also suggest clicking save all in the content browser to save your progress.

Player Power Component


Go to the BP_PlayerPowerComponent then go to its Class Defaults and copy the settings shown in the image below.

Create a new variable called PlayerInventory and set its type to BP_PlayerInventory

Then copy the images below, locations at the top of the screenshots.

Master Build Part


Go to the BP_MasterBuildPart and create a new variable called Power Device set its type to Boolean and tick on Instance Editable, set its Default Value to unticked. Then copy the images below, locations at the tops of the screenshots.

Note – When following the image above if you have already integrated Player Farming System the code will need to look like the image linked (here).

For older engine versions this code might look different, copy the image linked here if your using an older version

Note – When following the image above if you have already integrated Player Farming System the code will need to look like the image linked (here).

Next copy the video below, when selecting the Component Class on the GetComponentsByClass node select the BP_GroundDetectComponent.

Note – When following the image above if you have already integrated Player Farming System the code will need to look like the image linked (here).

Next create a new function called SavePowerData then add a new input called SaveGame and set its type to BP_SGKSaveGame then add a new output call it PowerIndex and set its type to Integer. In the function set the Power Index output value to -1 like the image below.

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 Power Device


Next go to the BP_MasterPowerDevice click the Class Settings button and copy the video below.

Next copy the images below, location at the top of the screenshots.

Create the Event Multicast Destroyed node then right click it and select the Add Call to Parent function to create the Parent:Multicast Destroyed node.

Select the StaticMesh component in the components panel and in the Details panel untick Visible like the image below.

Right click the BP_HealthComponent in the Components panel and select the Delete option

Next in the Class Defaults of the BP_MasterPowerDevice find the Power Device setting and tick it on.

Save System


Go to the BP_PowerGameModeComponent and remove the highlighted nodes shown in the image below, you can delete this node, make sure you connect the output of the Spawn Managers to the input of the Get All Direction Lights.

Next I recommend playing in editor this will compile the effected blueprints, then once the character loads in exit play in editor. I also recommend clicking save all in the content browser.

Go to the S_BuildPartSave structure in the content browser and add a new variable to it called PowerIndex and set its type to Integer like shown in the image below.

Then play in editor to compile the effected blueprints, once the character loads exit play in editor and click save all in the content browser.

Note – You may get errors in some blueprints if you do just open those blueprints and compile them this will resolve the errors.

Next go to the BP_MasterBuildPart and add the nodes shown below, locations at the tops of the images then compile and save.

Next go to the BP_SGKBuildingInterface and add a new function called SGK LoadPower then add a new input called SaveGame and set its type to BP_SGKSaveGame then add another input called PowerIndex and set its type to Integer like shown in the image below.

Next I recommend playing in editor, once the character loads exist play in editor and click save all in the content browser, then restart the project, this will make editing the next struct blueprints faster.

Next go to the S_LevelSaveData make sure its the one that comes with Survival Game Kit v2, then copy the video below. Do Not Save the struct after doing this!

Then again play in editor to compile the blueprint and exit once the character loads. You may get errors again, just go to those blueprint and compile them and the errors should be resolved. Then click save all in the content browser.

Next go to the BP_SGKSaveGame and create a new variable called TempDeviceSaveData and set its type to S_DeviceSaveData then set it to an array. To change a variable to an array click the drop down button next to the variable type drop down.

Then create another variable called TempCableSaveData and set its type to S_CableSaveData and set it to an array.

Then copy the image below, location at the top of the screenshot.

Next go to the BP_MasterPowerDevice and copy the image below, location at the top of the screenshot.

Next copy the video below.

Next go to the BP_MasterCable and copy the video below.

Next go to the BP_SaveSystem and copy the images below. To add the input pins on the Set memebers node select it and tick on the variables in the details panel.

Next copy the video below.

Next copy the image below, location at the top of the screenshots then compile and save.

Next go to the BP_NetworkManager and copy the code shown below.

Interaction


Go to the BP_Switch and copy the video below.

Next go to the BP_ElectricDoor and copy the video below.

Go to the BP_Generator and copy the video below.

UI


Go to the BP_DeviceHealth then go to the Graph view and go to the Update Widget function, then create a new local variable called BuildPartL and set its type to BP_MasterBuildPart. Then copy the images below.

Adding Build Parts


You will need to create new row entries in the Build Part List for each power device, you will also need to create an item for each device in the ItemList then you will need to create new world item blueprints for each of those items.

Below is an example how to setup these build parts and items, you will need to do the same for the rest of the devices. You can see a second example (here) for the large battery.

Click the Add button to add a new row to the BuildPartList, then double click the row name in the bottom left corner and set the device name. Then go though and set the build part details, make sure you set the Type to Power and make sure you set the Blueprint Class to the devices blueprint.

Next go to the ItemList and create a new row by selecting the Add button, then double click the row name in the bottom left corner and rename the row to the device name. Then go though and set the item details, make sure you add the Place action to the InventoryActions setting. You can set the other item details like UI Details, description, static mesh etc.

Next scroll down in the item details and find the build part details setting and set that to the device row from the build part list like the image below.

Next return to the Build Part List and select the devices row in the data table, then set its Override Item Cost, this will be the item cost of placing the device. Add an new entry to the setting and set the Data Table to the MasterItemList then set the Row Name to the entry you just added to the ItemList like the image below. You can also set the Amount of that item required to place the device.

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

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

Lastly open the device blueprint in the PlayerElectricitySystem/Blueprints/Devices so for example the BP_MasterCable 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 can now drag the new device world item into the level from the content browser for the player to pickup in game.

Keep in mind you will need to repeat these steps for each device, the cable wont be placeable until its snapped to a socket on anther device. You can see a second example (here).

Other blueprints


Open the BP_NoBuildZone, BP_DamageZone and BP_NoDamageZone blueprint and copy the video below.

Next go to the BP_PlotPole and select the OwnershipSphere in the Components panel, then in the details panel in the Collision Presets set Placement to Overlap like the image below.

You may want to remove HUD elements from the power HUD, there is a guide here on changing the HUD which includes instruction on removing the controls and resources panels.

Optional Extra Features


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