Skip to content

Help with function?

Can someone help me with this? I'm trying to create a function that will retrieve a specific parameter in the ItemPropertyLight of a staff. I keep getting "ERROR: NOT ALL CONTROL PATHS RETURN A VALUE". What am I not seeing here?
int GetStaffLight (object oStaff)
{
    /// Find the ItemPropertyLight in the staff:
    itemproperty ipLight = GetFirstItemProperty(oStaff);

    while (GetIsItemPropertyValid(ipLight))
    {
        if (GetItemPropertyType(ipLight) == ITEM_PROPERTY_LIGHT)
        {
            /// Get the "brightness" parameter of the ItemPropertyLight.
            return GetItemPropertyCostTableValue(ipLight);
        }

        ipLight = GetNextItemProperty(oStaff);
    }
}

Comments

  • KamirynKamiryn Member Posts: 74
    edited February 2020
    There's a return statement missing at the end of your function:
    int GetStaffLight (object oStaff)
    {
        /// Find the ItemPropertyLight in the staff:
        itemproperty ipLight = GetFirstItemProperty(oStaff);
    
        while (GetIsItemPropertyValid(ipLight))
        {
    	...
        }
        return -1;
    }
    
  • gpeddinogpeddino Member Posts: 51
    Thank you! That totally worked!
Sign In or Register to comment.