Asset instances and references

When scripting long quests, it is ideal to split one long quest into pieces and have them as seperate assets. This also helps with version control when multiple designers want to edit different sections of the quest. The quest system allows to split a bigger quest into seperate assets and add a refernece of the quest segments to a main quest asset.
It is also useful to have the ability to create action sequence templates that can be reused in other action sequences. The quest system allows creating such assets and creating instances of these assets inside other action sequences.
Asset references
A quest asset can have references to another action asset (Quest, Action sequence, Dialogue). The referenced asset can be activated like a normal action inside the main quest asset.
Multiple assets can reference the same asset. The referenced asset is activated when one of the referencers activates it and then it completes normally. The reference node inside the referencing asset will complete when the referenced asset completes. When a referencing asset tries to activate an asset that is already active, it won't activate it again but will just listen to the complete event. If a referencing asset tries to activate an asset that has already ended, it will not activate the referenced asset but instead will just call complete on the reference node.
Follow the steps below to create an action sequence asset and reference it inside a quest asset. Lets use the quest created in the Your first quest example. For the action sequence asset, we will create a new one.
-
Right click on the content browser and select Quest System->Action Sequence and select QuestActionSequence. Call it AS_ReferencedAction.
-
Lets print a string saying "Referenced action sequence activated"when this action sequence gets activated and then delay for 10 seconds and finally complete the action sequence. The graph should like below.
-
Drag and drop the AS_ReferencedAction asset on the Q_YourFirstQuest graph.
-
You should get two options, to either create an instance of the asset or create a reference. Choose Asset Reference.
-
You should now have an Asset Reference Handler node. Alternatively, you could just right click and search for an Asset Reference Handler node and set the Asset to the AS_ReferencedAction asset.
-
Make changes to the first quest graph as shown below. We will activate the referenced action once the spawned actor has been destroyed and then once the referenced action completes, we will print a string saying "Referenced Action Finished" to know it has completed.
Play the quest to see the references action in work. Since the AS_ReferencedAction asset is the one being executed, and not a local copy inside the main quest asset, you can open the AS_ReferencedAction asset to see the progress of the quest as shown in the video below.
Asset instances
Adding asset instances is similar to adding asset references, except choose Asset Instance after dropping the asset on the graph. This will create a local copy of the asset inside the graph the asset was dropped in. Double click the instance node to open the sub graph.
It is possible to edit the sub graph but we recommend you only edit the properties marked with PreserveDuringAssetInstanceReplacement metadata as these will be preserved when you make changes the source asset and apply changes to copies.
After you have created an instance of an action asset and saved the asset with the copy, you will find a Refresh Instances button on the source asset's toolbar. After you make changes to the source asset, press this button to refresh all copies of this asset.

Right click on an asset instance node to get the node context menu. You will find an asset instance section with two options. Selecting Open Asset Instance Template will open the source asset's editor. Selecting Release Asset Instance will cause this instance to no longer be treated as a copy of the source asset. Refreshing the source asset will have no effect on this instance anymore.

Both asset instances and asset references will not allow cyclic dependancies. Action A cannot have an instance of Action A. If Action A has an instance of Action B, Action B cannot have an instance of Action A.