Lets allow creation of functions as members of Object Types and Families. The same way these objects can have instance variables, let them also have list of functions (custom actions).
When adding a function, a dialog will appear to specify function name, the names and types of parameters, and a return value, possibly also descriptions for all of these, that can be shown in editor and expressions. The parameter types also allow for typechecking of calls in editor. These function wills be listed in Object type / Family properties (similarly to instance variables), and allow to quickly navigate to function body definition.
Defining a function body:
For these functions a new trigger event will appear in "Add Event" dialog, with that particular function name, similarly to how today functions are accomplished via Function plugin. These function will have its parameters named and types, and those will be available in function body (when defining actions) directly by their name. The body of a function will be defined on event sheet by the capabilities available today (events, actions), such as defining a Group or using existing Function plugin.
Using functions in expressions:
Such functions can be called in expressions with syntax Object type.Function name (Param 0, Param 1, ...) and will execute for each Object type / Family in currently picked list.
Using functions as Actions:
These functions will appear as Custom Actions of that particular Object Type / Family in the list of Actions in Add Action dialog, and will execute for each Object type / Family in currently picked list.
For Families, the mechanism will allow "virtual" calls - imagine as lightweight Object Oriented capability (2 levels only) - Family functions must be defined and will be called by default, individual Object types - members of the Family - can override Family function with their own version (but dont have to). In that case the Object type version will be called. Imagine usage such Enemies.GetScoreOnHit, with some default implementation for most Enemies as function of the Family, but for SuperEnemy object type some specific, more elaborate calculation will be provided.