Find_InArray

Kategorie: Objekte / Suche
Ab Engineversion: 6.1 OC

Beschreibung

Search criterion: Finds only objects in the array.

Syntax

array Find_InArray(array search_array);

Parameter

search_array:
Array in which the object must be.

Anmerkung

The implementation just checks for every object whether it is contained in the array. The object search is not reduced by checking only objects in the given array, so the criterion should not be used as an optimization to speed up object search. To perform such an optimization, a simple loop over the array should be used.

Beispiel

// A kind of healing spell for which people have to stay within a distance and cannot gain the healing effect if they are not present in Fx*Start

func FxHealingStart(object target, proplist effect, bool temp)
{
  if (!temp) effect.targets = FindObjects(Find_OCF(OCF_Alive), Find_Distance(200));
}

func FxHealingTimer(object target, proplist effect)
{
  for (var target in Find_Objects(Find_Distance(200), Find_InArray(effect.targets)));
    target->DoEnergy(+1);
}
Objects are healed by the effect and need to stay within 200 range to keep being healed. The Find_InArray criterion ensures that only objects that were initially in the range retrieve healing.
Siehe auch: FindObjects
Sven2, 2015-04