Dark and Light Elves

Aura System

Auras are area effects that last for an indeterminate period of time.

Aura can optionally stack with other instances of the same aura, but they will stack with other auras and effects. Aura target effects, user effects, active cost(s), and radius are scalable with user magic level.

Auras don't necessarily have to be a spell in a spellbook to work. Theoretically, the aura could be implemented as anything that causes an area effect (e.g. a bed of kryptonite rock that causes a debilitating effect on Superman if he approaches within 15 feet of it). However, the system was written for the express purpose of simulating Diablo 2 Auras, so that would take the most advantage of the features of this system.

Files

How To Use It

Say that you wanted to create an aura that increases party members' strength by 5 if they are within 15 meters of the aura user. This will be a combat magic aura that a character can use starting at level 10. Add the following block to the strength aura object (spell) template:

[t:template,n:aura_strength]
{
	category_name = "magic";
	doc = "aura strength";
	specializes = base_spell_dark; //combat magic aura
	
	[aura]
	{
		aura_manager	= "aura_strength_manager";
		aura_component	= "aura_enchant";
	}
	[common]
	{
		screen_name = "Aura of Strength";
		description = "(Radius 15)\nProjects a 
			strengthening aura to all party members in range.";
	}
	[magic]
	{
		apply_enchantments = false;
		max_level = 10; 
		required_level = 10; 

		attack_damage_modifier_min = 15; //radius formula
		mana_cost = 1;
		mana_cost_modifier = 0; //mana cost formula

		target_type_flags = TT_NONE; //blocks the casting cursor
		usage_context_flags = uc_passive;

		require_state_check = false;
		state_name = aura_strength; 
	}
}
Some explanations...
  • aura_manager is the name of the aura manager template (aura managers are used to identify valid aura targets and, overall, manage information about the contents in the specified radius around the user)
  • aura_component is the name of the aura manager skrit component for the aforementioned aura_manager

The state_name field in the [magic] block of the spell template is used to store the enchantment name prefix, which is used to determine which enchantments to toggle (notice the names of the enchantments in the next template snippet).

Activity costs (e.g. mana drain) as well as user-specific bonuses (such as a mana pool increase), are specified as enchantments in the aura spell template, like the following, which imposes a fixed mana drain of 2, and increases the user's mana pool size by a fixed 100:
...
[aura]
{
	aura_manager	= "aura_strength_manager";
	aura_component	= "aura_enchant";
	
	enchantments	= 2; //number of enchantments
}
[magic]
{
	...
	[enchantments]
	{
		[aura_strength_1]
		{
			alteration		= ALTER_MANA_RECOVERY_UNIT;
			description		= "Mana Recharge Rate";
			duration		= #infinite;
			value			= -2;
			is_enhancement		= true;
			is_permanent		= true;
			is_single_instance	= false;
		}
		[aura_strength_2]
		{
			alteration		= ALTER_MAX_MANA;
			description		= "Max Mana";
			duration		= #infinite;
			value			= 100;
			is_enhancement		= true;
			is_permanent		= true;
			is_single_instance	= false;
		}
	}
}
...
Set the [aura] field enchant_scales to true if you are specifying scaling formulas (i.e. with macros) for the enchantment values. This option value causes the aura script check periodically for stat and skill changes and update the bonuses if it detects any changes.

The fields marked with "formula" comments (attack_damage_modifier_min and mana_cost_modifier) support formulas containing spell and enchantment related macros so that they can also scale.

Now you want to create the aura manager template specified in the aforementioned aura block, and that would be placed in the world\contentdb\templates\regular\special\ directory.

[t:template,n:aura_strength_manager]
{
	doc = "Aura Manager";
	
	[aura_enchant] 
	{
		interval		= 2.0; //area checking delay

		enchant_target		= 1;
		enchant_target_scales	= false;

		sfx_source		= "aura_glow"; //user Siege FX
		sfx_target		= "aura_marker"; //target Siege FX

		tracker			= "aura_tag";
	}	
	[magic]
	{
		apply_enchantments = false;
		max_level = 10;
		required_level = 10;

		attack_damage_modifier_min = 15; //radius formula
		mana_cost = 0;
		mana_cost_modifier = 0; //mana cost formula

		magic_class = mc_combat_magic;
		skill_class = "Combat Magic";

		require_state_check = false;
		state_name = aura_strength;
		target_type_flags = tt_human_party_member | tt_and | 
			tt_conscious_friend;
		
		[enchantments]
		{
			[aura_strength_1]
			{
				alteration		= ALTER_STRENGTH;
				description		= "description";
				duration		= #infinite;
				value			= 5;
				is_enhancement		= true;
				is_permanent		= true;
				is_single_instance	= false;
			}
		}
	}
}
Similar to the enchant_scales option in the [aura] block of the aura spell template, if you've specified a scaling enchantment values for the aura targets, set enchant_target_scales = true; in the [aura_enchant] block.

Be sure to specify costs_mana = true; in the [aura_enchant] block if there is a mana drain/cost. Similarly set costs_health = true; if there is a life drain/cost. Both can be true.

In the aura manager, the state_name field in the [magic] block plays two important roles:

  1. It is used to mark affected targets with a generic state name, so that it does not stack with other strength auras, and so that affected targets will be identified by the aura manager properly (i.e. the aura manager can tell that it has already been checked and tagged).
  2. It is used as a prefix value for the enchantment names, like with the aura spell template.

The target_type_flags field in the [magic] block is used to determine valid aura targets. In this case, our Aura of Strength is supposed to affect conscious party members (user included). As with regular spells, you can also use the target_type_flags_not field to specify additional exclusions from within the target_type_flags group.

There are three optional target_type_hint fields for the [aura_enchant] block (target_type_hint, target_type_hint2, target_type_hint3) which can be used to optimize the area search. For example, adding target_type_hint = QT_ALIVE; to the above [aura_enchant] block will automatically filter the area search results to contain only potential targets that are alive (i.e., inanimate and dead game objects are removed from the list of targets to check).

Enchantments are all well and good, but sometimes you want to do something more complex, like increasing the run speed of all party members in range. In such a situation, you can write a new tracker script -- let's call it my_aura_tag.skrit -- following the example of aura_tag.skrit (i.e., just copy and paste that, and edit the actions specified in the WE_TRIGGER_ACTIVATE (begin) message handling event and the OnExitState$ (end) event of the Tracking$ state). Create an omni tracker template to go with it, and place in the world\contentdb\templates\regular\special\ directory...

[t:template,n:my_aura_tag]
{
	doc = "Aura Tag";
	[my_aura_tag] {}
}
Now specify tracker = "my_aura_tag"; in the [aura_enchant] block of the aura manager template. And that's it, you have a custom effect aura.

Origin Ramblings

What can I say? I used to be a Diablo 2 junkie. Auras were always the cool party-friendly paladin skills, and although I didn't like to play paladin characters, I always liked to play with paladins in cooperative multiplayer games. Dungeon Siege seemed to be missing some party synergy features, and so the question was, "why not add some auras?"