Difference between revisions of "Effect"

From Dragon Age Toolset Wiki
Jump to: navigation, search
(import from extranet)
 
m (Fixing links, fixing category)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
An Effect is a modifier that can be applied to a game objectWhen the effect is removed (usually because the duration on the effect expires) the modifier is removed. These modifiers can be rule or stat based or more complicated visual and game effects.
+
{{dafunction
 +
|name          = Effect
 +
|brief        = Basic effect constructor.
 +
|param1type    = int
 +
|param1name    = nType
 +
|param1desc    = an [[EFFECT_TYPE_*]] constant or literal
 +
|param1default = EFFECT_TYPE_INVALID
 +
|returntype    = effect
 +
|returndesc    = a blank effect
 +
|sourcefile    = script.ldf
 +
|sourcemodule =
 +
}}
 +
== Description ==
 +
<!-- This section contains the full description from the functions comments. Do not change unless you are confident these are incomplete or incorrect. -->
 +
Creates an basic effect of the specified type.
 +
== Remarks ==
 +
<!-- This section contains additional comments, observations and known issues. -->
 +
The basic effect constructor can be used to create any type of effect however it does not set any of the effect's other parameters so the effect returned may be incomplete. If an effect has additional parameters these would have to be set using [[SetEffectFloat]], [[SetEffectInteger]], etc. Therefore, for pre-existing effects such as damage or heal it is better to use the appropriate constructor, namely, [[EffectDamage]] or [[EffectHeal]].
 +
<!-- == Examples == -->
 +
<!-- This section contains examples transcluded from the snippet library. -->
 +
== See also ==
 +
<!-- This section contains links to articles, functions or constant groups. -->
 +
* [[Effect keyword]]
  
Every effect has a type set on it that determines how it affects the object it is applied to.  They also have a number of parameters on them, which vary based on the type, that change the specific behaviour.
+
[[Category:Effect functions]]
 
+
They can be assigned different duration types which affect how they're applied and removed:
+
 
+
# '''Temporary:''' Applied for a short duration (measured in seconds)
+
# '''Permanent:''' Applied until manually removed through scripting
+
# '''Instant:'''  These are one-shot modifiers that are not stored on the object (the death effect is an instant modifier for example)
+
# '''Equipped:''' Associated with an equipped item. The effect is removed when the item is unequipped.
+
 
+
Some effect types can only be applied as instant effects.  These effects will delete themselves after they've been applied no matter what duration type was set for them.  All other duration types will be stored in a list on the object they're applied to.
+
 
+
Effects are usually created and applied through the [[script|scripting language]].  The list of effects applied to an object can also be examined and modified through scripting.  The game engine itself will apply some instant effects when appropriate (like death or damage during combat).
+
 
+
When an effect is applied through scripting, the designer has the option of specifying a sub-type on it.  The subtype, which can be either "normal" or "magical", affects whether a "Dispel Magic" spell should clear the effect or not (Dispel Magic is an instant effect type).  Magical effects are usually tagged with the spell id that created it so that more rules checking can be done when they're cleared.
+
 
+
Some effects trigger [[event]]s to the object that they're applied to.  This is especially important for hostile effects like damage or death.  Each effect is tagged with the object id of the creator so that the target can react appropriately. 
+
 
+
All stat modifiers stack with each other.  If an object has two bonuses of the same type applied, they will get the full bonus from each.
+
 
+
When a game is reloaded, all the effects on an object are re-applied but with a special "loading" flag turned on.  Most effects will see this and do nothing, since the object they're applying themselves to has already had the modifiers applied.  A few effects will need to re-apply themselves if their effect is not easily saved.
+
 
+
Packages of effects can be constructed by "linking" them in the scripting language before they're applied.  Any effects that are linked together will be given the same unique id when they're applied.  If any effect in this group is then removed, either through expiry or scripting, then the entire group will go with them. This is most often used to tie a visual effect to a stat modifier.  When the modifier expires the visual effect will disappear.
+
 
+
Effects are applied internally by signalling an "apply effect" event with pointer to the effect attached.  They are usually removed in the same way because you don't know what else is linked to that effect and what dispelling them will do to the object.
+
 
+
The check to see if an effect has expired is done as part of an object's AI Update.  Some effect types also have timers that are checked here to see if they need to be given an update (used for regeneration type effects).
+
 
+
Party members will have a series of "effect icons" that appear on their character sheets so that the player can see what effects are on them.  These icons will be controlled by a special "Effect Icon" effect that will be linked to the spell's effects and managed by the scripter.
+
 
+
== Effect Behaviour ==
+
 
+
Behaviour for effects can be defined in either the engine or in scripting.  When an effect is applied or removed, the game will check for a defined handler for that effect type.  If none exists, then the object will receive an event to their script with the effect attached.
+
 
+
To access the effect in an onApply or onRemove event, use the <code>effect GetCurrentEffect()</code> scripting command.  The properties on this effect can be examined to determine type, duration and other parameters.  If your script handles the effect properly and you want it to be stored (so that you get the onRemove event later) you need to call the special <code>void SetIsCurrentEffectValid(int nValid)</code> function.  This will add it to the effect list on that object.
+
 
+
Effects will usually be handled by the core scripts rather than by an object's AI script.
+

Latest revision as of 20:40, 10 March 2012

Basic effect constructor.

effect Effect(
int nType = EFFECT_TYPE_INVALID
);
Parameters:
nType
an EFFECT_TYPE_* constant or literal
Returns:

a blank effect

Source:

script.ldf

Description

Creates an basic effect of the specified type.

Remarks

The basic effect constructor can be used to create any type of effect however it does not set any of the effect's other parameters so the effect returned may be incomplete. If an effect has additional parameters these would have to be set using SetEffectFloat, SetEffectInteger, etc. Therefore, for pre-existing effects such as damage or heal it is better to use the appropriate constructor, namely, EffectDamage or EffectHeal.

See also