Integrating the Foliage System with the Survival Template

Begin by migrating the FoliageSystem to your MSGT folder

Add the C-Foliage component to your SurvivalController in MSGT

Open up the Initialize function in the SurvivalController

Add the Init function call inside the Initialize function in the SurvivalController

Add these function calls and checks inside the GetActionType() function, inside the SurvivalController

Copy all the Events and variables from GS_FoliageGameState Blueprint, paste them into the SurvivalGameState Blueprint.

Open up the Str_Resources struct file inside the FoliageSystem, change the RewardWhenHarvested struct type to “Str_SGT_Inventory_Entry”

Change the Struct type inside BPI_Foliage, see image below.

Open up BP_MasterResource Blueprint, re-connect the missing link inside GetRewardFromFoliageActor.

Replace the old Blueprint nodes with the ones you see below inside C-Foliage Component Blueprint


Open up the ReplaceInstanceWithActor function inside C-Foliage Component, replace GS_FoliageGameState with SurvivalGameState and make new function calls to the ones in the image below.

Edit DT_Resources, change the Reward settings to whatever you want this Tree to reward the player with.

Make sure the ResourceMesh is EXACTLY the same as the Mesh you are “planting” with your Foliage Placement tool.

Almost done!

Add this function call inside SurvivalController on BeginPlay, it should look like this:

And that’s it!