How to create custom rules action event conditions?
A "universal formula or module to create custom rules actions, events and conditions" (as is your question), is to write a custom module. To do so, you either create a new module, or you extend any of your existing custom modules. Refer to Drupal custom Rules how to write your own events conditions, actions and custom object (+custom tokens) for a great tutorial about how to do so. The main steps that are detailed in this tutorial are further described below (with the code included below quoted from that link).

Part 1: Defining the Event, Condition and Action

Define the Rules Event

/**
* Implementation of hook_rules_event_info().
* @ingroup rules
*/
function your_module_rules_event_info() {
  return array(
    'your_module_package_bought' =&gt; array(
      'label' =&gt; t('A package was bought'),
      'module' =&gt; 'your_module',
      'arguments' =&gt; array(
        'acting_user' =&gt; array('type' =&gt; 'user', 'label' =&gt; t('The user who bought the package.')),
        'package' =&gt; array('type' =&gt; 'package', 'label' =&gt; t('The purchased package.')),
      ),
    ),
  );
}


Define the Rules Condition

/**
 * implementation of hook_rules_condition_info()
 */
function your_module_rules_condition_info() {
  return array(
    'your_module_condition_package_type' =&gt; array(
      'label' =&gt; t('Type of the package'),
      'arguments' =&gt; array(
        'package_id' =&gt; array('type' =&gt; 'value', 'label' =&gt; t('The type of the purchased package.')),
        'package_type' =&gt; array('type' =&gt; 'string', 'label' =&gt; t('The type of the purchased package is')),
      ),
      'module' =&gt; 'your_module',
    ),
  );
}


Define the Rules Action

/**
 * Implementation of hook_rules_action_info().
 */
function packages_rules_action_info() {
  return array(
    'your_module_action_change_order_status' =&gt; array(
      'label' =&gt; t('Change the order status'),
      'arguments' =&gt; array(
        'order' =&gt; array('type' =&gt; 'value', 'label' =&gt; t('The order object.')),
      ),
      'module' =&gt; 'your_module',
    ),
  );
}


Part 2: Coding the custom Event, Condition and Action

Event:

Somewhere in your custom module, you need to include logic to trigger the event, with something similar to this example (note the your_module_package_bought in it):

  //here the code for buying a package will be located
  //when that code returns that a package was bought trigger the rule
  $order = order_load($oid);//$oid will be the id of the order made
  $package = package_load($pid);//pid will be the id of the bought package
  global $user;
  rules_invoke_event('your_module_package_bought', $user, $package, $order);


Condition:

To evaluate the Rules condition (to check if it is TRUE or FALSE), the function your_module_condition_package_type is executed using the arguments provided. Here is an example of how such function could look like:

function your_module_condition_package_type($pid, $type) {
  $package = package_load($pid);
  return ($package-&gt;type == $type) ? true : false;
}


Action:

Somewhere in your custom module, you need to include logic to perform the actual action, in this example it should be done within the function named your_module_action_change_order_status.