Skip to main content

Multiplayer Survival Game Template (MSGT)

Outdated

This tutorial was made for an older version of the Multiplayer Survival Game Template and may need changes for newer versions.

Step 1: Create the Data Table​

Create a Data Table with FoliageData as the row structure.

Create the Data Table

Step 2: Create the Foliage Actor​

Create a Blueprint class with FoliagePluginActor as the parent class.

Create the Foliage Actor

Step 3: Assign the Data Table in the Project Settings​

Set the Data Table in Project Settings → Game → Foliage Plugin. In newer plugin versions, the Foliage Actor is set per resource with Foliage Actor Class in the Data Table.

Project Settings

Step 4: Change the component class​

Set Component Class to FoliagePluginComponent on your foliage types.

Change the component class

Step 5: Add a tree resource​

Tree resource

Step 6: Implement the interface in SurvivalController​

Add the Foliage Plugin Interface to the SurvivalController Blueprint.

Add the interface

Right-click in the SurvivalController Event Graph and add the interface event. This example adds the foliage rewards to the inventory:

Add the rewards to the inventory

Step 7: Create the harvest event​

In the SurvivalController Event Graph, create a new event as below:

Harvest event

Step 8: Output the hit result from the interaction trace​

Open the C_Manager-HUD component and change the InteractiveTrace function to output the Hit Result:

InteractiveTrace

In the GetActionType function (SurvivalController), add an input of type Hit Result:

GetActionType input

Connect the new Hit Result in the InteractAction function (SurvivalController):

InteractAction

Step 9: Call the harvest event​

Change GetActionType to call the event you created in Step 7, as shown in yellow:

Call the harvest event