Code viewer
Find closest script Class in script Class parent chain that overrides named Function/Event
#Code
A function to find closest script Class in parent chain of another script Class that overrides named Function/Event.
final static function class<Object> GetLastOverrideFunctionClass(class<Object> c, Name FunctionName, optional out Array<class<Object>> IteratedClasses) /* Returns closest script Class in parent chain of script Class "c" that overrides Function/Event named "FunctionName". IteratedClasses Array is used to prevent calling function multiple times on same script Class. Usage examples: GetLastOverrideFunctionClass(class'Hat_NPC_MetroCreepyCat_FoodShop', 'OnInteractedWith') -> class'Hat_NPC_MetroCreepyCat_FoodShop' GetLastOverrideFunctionClass(class'Hat_NPC_MetroCreepyCat', 'OnInteractedWith') -> class'Hat_NPC' GetLastOverrideFunctionClass(class'Pawn', 'OnInteractedWith') -> None */ { if (FunctionName == '' || c == None || IteratedClasses.Find(c) > -1) return None; IteratedClasses.AddItem(c); if (DynamicLoadObject(PathName(c)$":"$FunctionName, class'Function', true) != None) return c; if (c.default.ObjectArchetype == None) return None; return GetLastOverrideFunctionClass(c.default.ObjectArchetype.Class, FunctionName, IteratedClasses); }