Limiting the times an ActionList can run

This script lets you set the number of times a scene-based ActionList (i.e. a Cutscene / Interaction / Trigger) can be run. If the limit has been exceeded, an alternative ActionList can be run in its place.

To use it: ActionListRepeater.cs: using UnityEngine; using AC; public class ActionListRepeater : MonoBehaviour { 	public int repeatableAmount = -1; public ActionList actionListOnFail; private int timesPlayed; private void OnEnable { 		EventManager.OnBeginActionList += OnBeginActionList; } 	private void OnDisable { 		EventManager.OnBeginActionList -= OnBeginActionList; } 	private void OnBeginActionList (ActionList actionList, ActionListAsset actionListAsset, int startingIndex, bool isSkipping) { 		if (repeatableAmount >= 0 && actionList == GetComponent ) { 			if (timesPlayed > repeatableAmount) { 				actionList.Kill ; if (actionListOnFail) actionListOnFail.Interact ; return; } 			timesPlayed ++; } 	}  }
 * 1) Create a new C# script named ActionListRepeater.cs, and paste in the code below
 * 2) Attach the new "Action List Repeater" component to the scene-based ActionList you wish to limit
 * 3) In its Inspector, set its "Repeatable Amount" value and (optionally) an "ActionList On Fail".