Difference between revisions of "Allow Changing Texture and Mesh on a Structure"

From ARK Modding Wiki
Jump to navigation Jump to search
Line 16: Line 16:
 
If you have never worked with the MultiUse Menu in ARK make sure to get familiar with the basics before proceeding, so you can actually understand each step.
 
If you have never worked with the MultiUse Menu in ARK make sure to get familiar with the basics before proceeding, so you can actually understand each step.
 
In this part we will prepare the menu entries that allow users to select their preferred mesh or texture. To show this off we will create two texture entries and two mesh entries.
 
In this part we will prepare the menu entries that allow users to select their preferred mesh or texture. To show this off we will create two texture entries and two mesh entries.
Make sure your graph for '''GetMultiUseEntries''' looks similar to the image below.
+
Before starting to edit the graph open the ''Defaults'' tab and check the "GetMultiUseEntries" option. Without this your entries will be ignored.
 +
Now search for the '''GetMultiUseEntries''' function in your Graph tab, right-click it and choose ''implement''. Finally create a graph similar to the image below.
 +
 
 +
Notes:
 +
* Make sure to choose a unique Index for each entry.
 +
* In this example we are using the TargetingTeam (that means the tribe) to determine if a user is allowed to see these menu entries. Please adjust this depending on your requirements.
 +
 
 +
== Step 3: Preparing BPTryMultiUse==
 +
We have already set up ''showing'' the entries, not it is time to handle when a user ''uses'' one of them.
 +
Like in the previous step, search for '''BPTryMultiUse'' and implement it, then follow the image below to create your example graph.

Revision as of 14:05, 12 September 2017

In this guide we will go through the necessary steps to allow changing a structure's mesh and/or texture using a multi-use menu. The resulting structure will also save these changes to persist over server restarts and properly replicate them to all users.

Before starting this guide make sure you have a structure set up and ready. Make sure you have a way to spawn and place it in order to test if it works.

Step 1: Setting up variables

In order to properly save any changes users make over server restarts you will need one variable per property that will change. In our case we will need one variable to identify the mesh, and one to identify the texture. A few different types could be used, but in order to keep the save game small and allow for efficient replication we will use one integer variable per property. Side Note: You could definitely use a byte variable in order to save even more space, but I am quite sure that UE4 will pad this to 4 bytes anyway. If you do happen to know how this is treated internally, make sure to update this article!

To finish this step create two integer variables on your structure. Let's call them TextureId and MeshId. Set both variables to RepNotify and check the "save game" checkbox as seen in the image below.

Step 2: Preparing GetMultiUseEntries

If you have never worked with the MultiUse Menu in ARK make sure to get familiar with the basics before proceeding, so you can actually understand each step. In this part we will prepare the menu entries that allow users to select their preferred mesh or texture. To show this off we will create two texture entries and two mesh entries. Before starting to edit the graph open the Defaults tab and check the "GetMultiUseEntries" option. Without this your entries will be ignored. Now search for the GetMultiUseEntries function in your Graph tab, right-click it and choose implement. Finally create a graph similar to the image below.

Notes:

  • Make sure to choose a unique Index for each entry.
  • In this example we are using the TargetingTeam (that means the tribe) to determine if a user is allowed to see these menu entries. Please adjust this depending on your requirements.

Step 3: Preparing BPTryMultiUse

We have already set up showing the entries, not it is time to handle when a user uses one of them. Like in the previous step, search for 'BPTryMultiUse and implement it, then follow the image below to create your example graph.