Category: Effects
Since engine version: 1.0 OC
GetEffect
Description
Retrieves a certain effect. If an effect cannot be found the return value is
nil
.Syntax
any GetEffect(string name, object target, int index, int max_priority);
Parameters
- name:
- [opt] Name of the effect without preceding 'Fx'. You can use '*' and '?' wildcards.
- target:
- [opt] Target object in which to access effects. If
nil
, the global effects are accessed. - index:
- [opt] Effect index. With name specified and multiple matches for the search this will give you the indicated effect from the list of results.
- max_priority:
- [opt] If not 0, only those effects are counted which have the specified priority or lower.
Example
var i, effect; // Search all objects for (var obj in FindObjects(Find_And())) { // Count down from the effect count because effects are being removed i = GetEffectCount(0, obj); while (i--) if (effect = GetEffect("*Spell", obj, i)) RemoveEffect(0, obj, effect); } // remove global effects i = GetEffectCount(); while (i--) if (effect = GetEffect("*Spell", nil, i)) RemoveEffect(0, nil, effect);
Removes all magic effects from all objects and the global list.
See also: CheckEffect, CreateEffect, EffectCall, Effects Documentation, GetEffectCount, RemoveEffect