The idea is to allow multiple checks without many variables.
E.g. an action is taken when a book is taken and a page read. You have to have 2 variables and two actions to check both.
Instead you can have a float[2]. I checked and modified gvar.cs to include a "FloatArray" (and enum.cs) with the help of Claude.
From actions, you can now a) check a specific index of that array, therefore you can group related actions only to one variable and b) check all values of the array -> instant result when all the actions must be e.g. 1 to proceed.
Generally, limiting the number of variables needed if the data to be managed is "related" is a good idea.
I'm following this post with all the required changes in the cs files.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Enum.cs VariableType
public enum VariableType { Boolean, Integer, String, Float, PopUp, Vector3, GameObject, UnityObject, FloatArray };GVar.gs
Property
[SerializeField] protected float[] floatArrayVal = new float[0];In all constructors
floatArrayVal = new float[0];Copy constructor
floatArrayVal = (assetVar.floatArrayVal != null) ? (float[]) assetVar.floatArrayVal.Clone () : new float[0];GetValue
case VariableType.FloatArray: return "[" + string.Join (", ", System.Array.ConvertAll (FloatArrayValue, f => f.ToString ())) + "]";CopyFromValue
case VariableType.FloatArray: { FloatArrayValue = (oldVar.floatArrayVal != null) ? (float[]) oldVar.floatArrayVal.Clone () : new float[0]; break; }ShowGUI
GVar.gs helper
SaveSystem.cs - CreateVariablesData
UnloadVariablesData
ActionVarSet.cs
Properties
AssignValues
arrayIndex = AssignInteger (parameters, arrayIndexParameterID, arrayIndex);SetVariable
ShowVarGUI
SetLabel
ActionVarCheck.cs
Properties
AssignValues
CheckCondition
Helper to add
ShowVarGUI
GetLabelString:
And a final AC action to check the float array either by index or ALL parameters
https://pastebin.com/tNJSd7QT
A fix in SaveSystem to cope for expanded arrays after saves.