ChangeEffect

Category: Effects
Since engine version: 4.9.5.0 CE

Description

Changes the name of an effect. This also affects the names of the related callback functions.

Syntax

bool ChangeEffect (string szEffectName, object pTarget, int iIndex, string szNewEffectName, int iNewTimer);

Parameters

szEffectName:
[opt] Name of the effect without preceding 'Fx'. You can use '*' and '?' wildcards.
pTarget:
[opt] Targt object in which to change effects. With 0, the global effects are processed.
iIndex:
[opt] Effect index. If using a wildcard search in szEffectName results in multiple matches, this index will indicate which effect from the list of results to use. If on the other hand no szEffectName is specified, this index will access the effect of the given effect number. As opposed to direct access via effect numbers, access by index will ensure that all indexed effects from 0 to the given number are reached.
szNewEffectName:
[opt] New effect name without prepended 'Fx'
iNewTimer:
[opt] New timer interval. If -1, the previous value will be kept. Otherwise, this call will also reset effect time.

Examples

ChangeEffect("MeinEffekt", 0, 0, "AndererEffekt");
Renames the global effect "MyEffect" (if it exists) to "OtherEffect".
var obj, i, iEffect;
while ((i=0) || obj=FindObject(0, 0,0,0,0, 0, 0,0, 0, obj))
  while (iEffect = GetEffect("*Fire*", obj, i))
    ChangeEffect(0, obj, i++, GetEffect(0, obj, iIndex, 1), 2);
Switches all fire into fast mode.
See also: AddEffect, CheckEffect, EffectCall, EffectVar, Effects Documentation, GetEffect, GetEffectCount, RemoveEffect
Sven2, März 2004