Пример #1
0
        /// <summary>
        /// Get a value from a string field.
        /// This is for a field that contains Value, Variable, Property, Global.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="actionFieldID">ID assigned to action field A.</param>
        /// <param name="convertVariablesToText">Convert variables to text?</param>
        /// <returns>The value from a string field.</returns>
        public static string GetValueA(HeroKitObject heroKitObject, int actionFieldID, bool convertVariablesToText = false)
        {
            // Get the action
            HeroAction action = heroKitObject.heroState.heroEvent[heroKitObject.heroStateData.eventBlock].actions[heroKitObject.heroStateData.action];

            // Get the data type
            int           itemType  = action.actionFields[actionFieldID].ints[3];
            string        itemValue = "";
            HeroKitObject targetHKO = null;

            if (itemType == 0)
            {
                Debug.LogError("String type was never specified for " + action.actionTemplate.name + " " + HeroKitCommonRuntime.GetHeroDebugInfo(heroKitObject));
                return("");
            }
            // get string from field
            else if (itemType == 1)
            {
                itemValue = action.actionFields[actionFieldID].strings[1];
                targetHKO = heroKitObject;
            }
            // get string from variable field or property field
            else if (itemType == 2 || itemType == 3)
            {
                // Get the hero kit object
                targetHKO = HeroObjectFieldValue.GetTargetHeroObject(heroKitObject, actionFieldID);
                if (targetHKO == null)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoHeroKitObjectDebugInfo(action.actionTemplate.name, 0, heroKitObject));
                    return("");
                }

                // Get the slot in the list that contains the string
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                // Get the string from variable list
                if (itemType == 2)
                {
                    if (targetHKO.heroList.strings.items.Count <= slotID || slotID < 0)
                    {
                        Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Variables", "String", slotID, 0, heroKitObject));
                        return("");
                    }
                    itemValue = targetHKO.heroList.strings.items[slotID].value;
                }

                // Get the string from property list
                if (itemType == 3)
                {
                    int propertyID = action.actionFields[actionFieldID].ints[5] - 1;

                    if (targetHKO.heroProperties == null || targetHKO.heroProperties.Length == 0 ||
                        targetHKO.heroProperties.Length <= propertyID || propertyID < 0 ||
                        targetHKO.heroProperties[propertyID].itemProperties.strings.items.Count <= slotID || slotID < 0)
                    {
                        Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Properties", "String", slotID, 0, heroKitObject));
                        return("");
                    }

                    itemValue = targetHKO.heroProperties[propertyID].itemProperties.strings.items[slotID].value;
                }
            }
            // get string from global field
            else if (itemType == 4)
            {
                // Get the slot in the list that contains the string
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                if (HeroKitDatabase.GetGlobals().strings.items.Count <= slotID || slotID < 0)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, "n/a", "Globals", "String", slotID, 0, heroKitObject));
                    return("");
                }
                itemValue = HeroKitDatabase.GetGlobals().strings.items[slotID].value;
            }

            // localize the text
            itemValue = HeroKitDatabase.GetLocalization(itemValue);

            // convert variables into text
            if (convertVariablesToText)
            {
                bool useVariables = (itemType > 1) ? UseVariables(heroKitObject, actionFieldID) : true;
                if (useVariables)
                {
                    itemValue = InsertVariablesInString(targetHKO, itemValue);
                }
            }

            // Return the string
            return(itemValue);
        }
Пример #2
0
        /// <summary>
        /// Checks to see if a string list field has the Use Variables flag enabled.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="actionFieldID">ID assigned to the action field.</param>
        /// <returns>Is the Use Variables flag enabled in a string list field.</returns>
        private static bool UseVariables(HeroKitObject heroKitObject, int actionFieldID)
        {
            bool useVariables = false;

            // Get the data type
            HeroAction action   = heroKitObject.heroState.heroEvent[heroKitObject.heroStateData.eventBlock].actions[heroKitObject.heroStateData.action];
            int        itemType = action.actionFields[actionFieldID].ints[3];

            if (itemType == 0)
            {
                Debug.LogError("String type was never specified for " + action.actionTemplate.name + " " + HeroKitCommonRuntime.GetHeroDebugInfo(heroKitObject));
                return(false);
            }

            if (itemType == 2 || itemType == 3)
            {
                // Get the hero kit object
                HeroKitObject targetHKO = HeroObjectFieldValue.GetTargetHeroObject(heroKitObject, actionFieldID);
                if (targetHKO == null)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoHeroKitObjectDebugInfo(action.actionTemplate.name, 0, heroKitObject));
                    return(false);
                }

                // Get the slot in the list that contains the string
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                // check strings for variables if data type is variable
                if (itemType == 2)
                {
                    if (targetHKO.heroList.strings.items.Count <= slotID || slotID < 0)
                    {
                        Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Variables", "String", slotID, 0, heroKitObject));
                        return(false);
                    }

                    useVariables = targetHKO.heroList.strings.items[slotID].useVariables;
                }
                // check strings for variables if data type is property
                if (itemType == 3)
                {
                    int propertyID = action.actionFields[actionFieldID].ints[5] - 1;

                    if (targetHKO.heroProperties == null || targetHKO.heroProperties.Length == 0 ||
                        targetHKO.heroProperties.Length <= propertyID || propertyID < 0 ||
                        targetHKO.heroProperties[propertyID].itemProperties.strings.items.Count <= slotID || slotID < 0)
                    {
                        Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Properties", "String", slotID, 0, heroKitObject));
                        return(false);
                    }

                    useVariables = targetHKO.heroProperties[propertyID].itemProperties.strings.items[slotID].useVariables;
                }
            }
            else if (itemType == 4)
            {
                // Get the slot in the list that contains the string
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;
                // Check if there are variables to parse
                useVariables = HeroKitDatabase.GetGlobals().strings.items[slotID].useVariables;
            }

            return(useVariables);
        }
Пример #3
0
        /// <summary>
        /// Get a value from a game object field.
        /// This is for a field that contains Value, Variable, Property, Global.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="actionFieldID">ID assigned to action field A.</param>
        /// <returns>The value from a game object field.</returns>
        public static GameObject GetValueA(HeroKitObject heroKitObject, int actionFieldID, bool includeInactive = false)
        {
            // Get the action
            HeroAction action = heroKitObject.heroState.heroEvent[heroKitObject.heroStateData.eventBlock].actions[heroKitObject.heroStateData.action];

            // Get the data type
            int        itemType  = action.actionFields[actionFieldID].ints[3];
            GameObject itemValue = null;

            // don't get item. Item type was never specified
            if (itemType == 0)
            {
                Debug.LogError("Game Object type was never specified for " + action.actionTemplate.name + " " + HeroKitCommonRuntime.GetHeroDebugInfo(heroKitObject));
                return(null);
            }
            // get value from Value
            else if (itemType == 1)
            {
                string name = action.actionFields[actionFieldID].strings[0];

                // get gameobjects
                // WARNING: If you use Resources.Find... this will return hidden scene objects, including prefabs that you don't want
                // to work with. Only use this option if you absolutely must. If you have any prefabs with the same name as objects
                // in your scene, the prefabs might be referenced instead of the object you want
                Transform[] transforms = (includeInactive) ? Resources.FindObjectsOfTypeAll <Transform>() : Object.FindObjectsOfType <Transform>();
                for (int i = 0; i < transforms.Length; i++)
                {
                    if (transforms[i].gameObject.name == name)
                    {
                        itemValue = transforms[i].gameObject;
                        break;
                    }
                }
            }
            // Get the item from the value list (2=variables, 3=properties, 4=this)
            else if (itemType == 2 || itemType == 3 || itemType == 4)
            {
                HeroKitObject targetHKO = HeroObjectFieldValue.GetTargetHeroObject(heroKitObject, actionFieldID);
                if (targetHKO == null)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoHeroKitObjectDebugInfo(action.actionTemplate.name, 0, heroKitObject));
                    return(null);
                }

                // Get the slot in the list that contains the game object
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                // Get the item from the variable list
                if (itemType == 2)
                {
                    if (targetHKO.heroList.gameObjects.items.Count <= slotID || slotID < 0)
                    {
                        Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Variables", "Game Object", slotID, 0, heroKitObject));
                        return(null);
                    }

                    itemValue = targetHKO.heroList.gameObjects.items[slotID].value;
                }

                // Get the item from the property list
                if (itemType == 3)
                {
                    int propertyID = action.actionFields[actionFieldID].ints[5] - 1;

                    if (targetHKO.heroProperties == null || targetHKO.heroProperties.Length == 0 ||
                        targetHKO.heroProperties.Length <= propertyID || propertyID < 0 ||
                        targetHKO.heroProperties[propertyID].itemProperties.bools.items.Count <= slotID || slotID < 0)
                    {
                        Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Properties", "Game Object", slotID, 0, heroKitObject));
                        return(null);
                    }

                    itemValue = targetHKO.heroProperties[propertyID].itemProperties.gameObjects.items[slotID].value;
                }

                // Get the item from target hero kit object
                if (itemType == 4)
                {
                    itemValue = targetHKO.gameObject;
                }
            }
            // get item from global field
            else if (itemType == 5)
            {
                // Get the slot in the list that contains the item
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                if (HeroKitDatabase.GetGlobals().gameObjects.items.Count <= slotID || slotID < 0)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, "n/a", "Globals", "Game Objects", slotID, 0, heroKitObject));
                    return(null);
                }
                itemValue = HeroKitDatabase.GetGlobals().gameObjects.items[slotID].value;
            }

            return(itemValue);
        }
Пример #4
0
        /// <summary>
        /// Get a value from a game object field.
        /// This is for a field that contains Variable, Property, Global.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="actionFieldID">ID assigned to the action field.</param>
        /// <returns>The value from a game object field.</returns>
        public static GameObject GetValueB(HeroKitObject heroKitObject, int actionFieldID, bool includeInactive = false)
        {
            // Get the action
            HeroAction action = heroKitObject.heroState.heroEvent[heroKitObject.heroStateData.eventBlock].actions[heroKitObject.heroStateData.action];

            // Get the data type
            int        itemType  = action.actionFields[actionFieldID].ints[3];
            GameObject itemValue = null;

            // don't get item. Item type was never specified
            if (itemType == 0)
            {
                Debug.LogError("Game Object type was never specified for " + action.actionTemplate.name + " " + HeroKitCommonRuntime.GetHeroDebugInfo(heroKitObject));
                return(null);
            }
            // get item from variable or property list
            else if (itemType == 1 || itemType == 2)
            {
                HeroKitObject targetHKO = HeroObjectFieldValue.GetTargetHeroObject(heroKitObject, actionFieldID);
                if (targetHKO == null)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoHeroKitObjectDebugInfo(action.actionTemplate.name, 0, heroKitObject));
                    return(null);
                }

                // Get the slot in the list that contains the game object
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                // Get the item from the variable list
                if (itemType == 1)
                {
                    if (targetHKO.heroList.gameObjects.items.Count <= slotID || slotID < 0)
                    {
                        Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Variables", "Game Object", slotID, 0, heroKitObject));
                        return(null);
                    }

                    itemValue = targetHKO.heroList.gameObjects.items[slotID].value;
                }

                // Get the item from the property list
                if (itemType == 2)
                {
                    int propertyID = action.actionFields[actionFieldID].ints[5] - 1;

                    if (targetHKO.heroProperties == null || targetHKO.heroProperties.Length == 0 ||
                        targetHKO.heroProperties.Length <= propertyID || propertyID < 0 ||
                        targetHKO.heroProperties[propertyID].itemProperties.bools.items.Count <= slotID || slotID < 0)
                    {
                        Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Properties", "Game Object", slotID, 0, heroKitObject));
                        return(null);
                    }

                    itemValue = targetHKO.heroProperties[propertyID].itemProperties.gameObjects.items[slotID].value;
                }
            }
            // get item from globals
            else if (itemType == 3)
            {
                // Get the slot in the list that contains the item
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                if (HeroKitDatabase.GetGlobals().gameObjects.items.Count <= slotID || slotID < 0)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, "n/a", "Globals", "Game Object", slotID, 0, heroKitObject));
                    return(null);
                }
                itemValue = HeroKitDatabase.GetGlobals().gameObjects.items[slotID].value;
            }

            return(itemValue);
        }
Пример #5
0
        /// <summary>
        /// Get a value from a float field.
        /// This is for a field that contains Value, Variable, Property, Global.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="actionFieldID">ID assigned to action field A.</param>
        /// <returns>The value from a float field.</returns>
        public static float GetValueA(HeroKitObject heroKitObject, int actionFieldID)
        {
            // Get the action
            HeroAction action = heroKitObject.heroState.heroEvent[heroKitObject.heroStateData.eventBlock].actions[heroKitObject.heroStateData.action];

            // Get the Float type
            int   itemType  = action.actionFields[actionFieldID].ints[3];
            float itemValue = 0;

            // don't get item. Item type was never specified
            if (itemType == 0)
            {
                Debug.LogError("Float type was never specified for " + action.actionTemplate.name + " " + HeroKitCommonRuntime.GetHeroDebugInfo(heroKitObject));
                return(0f);
            }
            // get Float from field
            else if (itemType == 1)
            {
                itemValue = action.actionFields[actionFieldID].floats[0];
            }
            // get Float from Float field or property field
            else if (itemType == 2 || itemType == 3)
            {
                // Get the hero kit object
                HeroKitObject targetHKO = HeroObjectFieldValue.GetTargetHeroObject(heroKitObject, actionFieldID);
                if (targetHKO == null)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoHeroKitObjectDebugInfo(action.actionTemplate.name, 0, heroKitObject));
                    return(0f);
                }

                // Get the slot in the list that contains the Float
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                // Get the Float from Float list
                if (itemType == 2)
                {
                    if (targetHKO.heroList.floats.items.Count <= slotID)
                    {
                        Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Variables", "Float", slotID, 0, heroKitObject));
                        return(0);
                    }
                    itemValue = targetHKO.heroList.floats.items[slotID].value;
                }

                // Get the Float from property list
                if (itemType == 3)
                {
                    int propertyID = action.actionFields[actionFieldID].ints[5] - 1;

                    if (targetHKO.heroProperties == null || targetHKO.heroProperties.Length == 0 ||
                        targetHKO.heroProperties.Length <= propertyID || propertyID < 0 ||
                        targetHKO.heroProperties[propertyID].itemProperties.bools.items.Count <= slotID || slotID < 0)
                    {
                        Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Properties", "Float", slotID, 0, heroKitObject));
                        return(0);
                    }

                    itemValue = targetHKO.heroProperties[propertyID].itemProperties.floats.items[slotID].value;
                }
            }
            // get Float from global field
            else if (itemType == 4)
            {
                // Get the slot in the list that contains the float
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                if (HeroKitDatabase.GetGlobals().floats.items.Count <= slotID || slotID < 0)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, "n/a", "Globals", "Float", slotID, 0, heroKitObject));
                    return(0);
                }
                itemValue = HeroKitDatabase.GetGlobals().floats.items[slotID].value;
            }

            // Return the Float
            return(itemValue);
        }
Пример #6
0
        /// <summary>
        /// Get a value from a unity object field.
        /// This is for a field that contains Value, Variable, Property, Global.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="actionFieldID">ID assigned to action field A.</param>
        /// <returns>The value from a unity object field.</returns>
        public static UnityObjectField GetValueA(HeroKitObject heroKitObject, int actionFieldID, bool requiredField = true)
        {
            // Get the action
            HeroAction action = heroKitObject.heroState.heroEvent[heroKitObject.heroStateData.eventBlock].actions[heroKitObject.heroStateData.action];

            // Get the object type
            int itemType = action.actionFields[actionFieldID].ints[3];
            UnityObjectField itemValue = new UnityObjectField();

            itemValue.sceneID = -1;

            // don't get item. Item type was never specified
            if (itemType == 0)
            {
                if (requiredField)
                {
                    Debug.LogError("Unity Object type was never specified for " + action.actionTemplate.name + " " + HeroKitCommonRuntime.GetHeroDebugInfo(heroKitObject));
                }
                return(itemValue);
            }
            // get object from field
            else if (itemType == 1)
            {
                itemValue.value     = action.actionFields[actionFieldID].unityObjects[0];
                itemValue.sceneID   = action.actionFields[actionFieldID].ints[5];
                itemValue.sceneName = action.actionFields[actionFieldID].strings[1];
            }
            // get object from variable field or property field
            else if (itemType == 2 || itemType == 3)
            {
                // Get the hero kit object
                HeroKitObject targetHKO = HeroObjectFieldValue.GetTargetHeroObject(heroKitObject, actionFieldID);
                if (targetHKO == null)
                {
                    if (requiredField)
                    {
                        Debug.LogError(HeroKitCommonRuntime.NoHeroKitObjectDebugInfo(action.actionTemplate.name, 0, heroKitObject));
                    }
                    return(itemValue);
                }

                // Get the slot in the list that contains the object
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                // Get the object from variable list
                if (itemType == 2)
                {
                    if (targetHKO.heroList.unityObjects.items.Count <= slotID || slotID < 0)
                    {
                        if (requiredField)
                        {
                            Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Variables", "Hero Object", slotID, 0, heroKitObject));
                        }
                        return(itemValue);
                    }

                    itemValue = itemValue.Clone(targetHKO.heroList.unityObjects.items[slotID]);
                }

                // Get the object from property list
                if (itemType == 3)
                {
                    int propertyID = action.actionFields[actionFieldID].ints[6] - 1;

                    if (targetHKO.heroProperties == null || targetHKO.heroProperties.Length == 0 ||
                        targetHKO.heroProperties.Length <= propertyID || propertyID < 0 ||
                        targetHKO.heroProperties[propertyID].itemProperties.bools.items.Count <= slotID || slotID < 0)
                    {
                        if (requiredField)
                        {
                            Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO.heroObject.name, "Properties", "Hero Object", slotID, 0, heroKitObject));
                        }
                        return(itemValue);
                    }

                    itemValue = itemValue.Clone(targetHKO.heroProperties[propertyID].itemProperties.unityObjects.items[slotID]);
                }
            }
            // get object from global field
            else if (itemType == 4)
            {
                // Get the slot in the list that contains the value
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                if (HeroKitDatabase.GetGlobals().unityObjects.items.Count <= slotID || slotID < 0)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, "n/a", "Globals", "Unity Object", slotID, 0, heroKitObject));
                    return(itemValue);
                }
                itemValue = itemValue.Clone(HeroKitDatabase.GetGlobals().unityObjects.items[slotID]);
            }

            // Return the object
            return(itemValue);
        }
Пример #7
0
        /// <summary>
        /// Set a value for an int field.
        /// This is for a field that contains Variable, Property, Global.
        /// </summary>
        /// <param name="heroKitObject">The hero kit object that contains the data for this action.</param>
        /// <param name="eventID">The ID assigned to the event.</param>
        /// <param name="actionID">The ID assigned to the action.</param>
        /// <param name="actionFieldID">ID assigned to the action field.</param>
        /// <param name="newValue">The value from an int field.</param>
        public static void SetValueB(HeroKitObject heroKitObject, int eventID, int actionID, int actionFieldID, int newValue)
        {
            // Get the action
            HeroAction action = heroKitObject.heroState.heroEvent[eventID].actions[actionID];

            // Get the integer type
            int itemType = action.actionFields[actionFieldID].ints[3];

            // don't get item. Item type was never specified
            if (itemType == 0)
            {
                Debug.LogError("Integer type was never specified for " + action.actionTemplate.name + " " + HeroKitCommonRuntime.GetHeroDebugInfo(heroKitObject));
                return;
            }
            // set item in variable or property list
            else if (itemType == 1 || itemType == 2)
            {
                // Get the hero kit object
                HeroKitObject[] targetHKO = HeroObjectFieldValue.GetTargetHeroObject(heroKitObject, eventID, actionID, actionFieldID);
                if (targetHKO == null)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoHeroKitObjectDebugInfo(action.actionTemplate.name, 0, heroKitObject));
                    return;
                }

                // Get the slot in the list that contains the integer
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                // Get the integer from the integer list
                if (itemType == 1)
                {
                    for (int i = 0; i < targetHKO.Length; i++)
                    {
                        if (targetHKO[i].heroList.ints.items.Count <= slotID || slotID < 0)
                        {
                            Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO[i].heroObject.name, "Variables", "Integer", slotID, 0, heroKitObject));
                            return;
                        }

                        // Set the integer
                        targetHKO[i].heroList.ints.items[slotID].value = newValue;
                    }
                }

                // Get the integer from the property list
                if (itemType == 2)
                {
                    for (int i = 0; i < targetHKO.Length; i++)
                    {
                        int propertyID = action.actionFields[actionFieldID].ints[6] - 1;

                        if (targetHKO[i].heroProperties == null || targetHKO[i].heroProperties.Length == 0 ||
                            targetHKO[i].heroProperties.Length <= propertyID || propertyID < 0 ||
                            targetHKO[i].heroProperties[propertyID].itemProperties.ints.items.Count <= slotID || slotID < 0)
                        {
                            Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, targetHKO[i].heroObject.name, "Properties", "Int", slotID, 0, heroKitObject));
                            return;
                        }

                        targetHKO[i].heroProperties[propertyID].itemProperties.ints.items[slotID].value = newValue;
                    }
                }
            }
            // set item in global list
            if (itemType == 3)
            {
                // Get the slot in the list that contains the item
                int slotID = action.actionFields[actionFieldID].ints[2] - 1;

                if (HeroKitDatabase.GetGlobals().ints.items.Count <= slotID || slotID < 0)
                {
                    Debug.LogError(HeroKitCommonRuntime.NoVariableDebugInfo(action.actionTemplate.name, "n/a", "Globals", "Integer", slotID, 0, heroKitObject));
                    return;
                }
                HeroKitDatabase.GetGlobals().ints.items[slotID].value = newValue;
            }
        }