Here is the code which will apply visual effects. Set this in an Area's OnEnter Script when testing, and it will step through and apply Visual effects to all objects in the area with the tags "o_Stoned", "o_Barkskin", "o_Iced", "o_Shadowed", or "o_VFX". Objects tagged o_VFX will default to effect 0 and Glow Blue and White, unless a variable is set on the object.
#include "x0_i0_destroy"
void main()
{
object oEntering = GetEnteringObject();
int nShadowed = CountAllObjectsInAreaByTag("o_Shadowed", oEntering);
int nIced = CountAllObjectsInAreaByTag("o_Iced", oEntering);
int nBarked = CountAllObjectsInAreaByTag("o_Barkskin", oEntering);
int nStoned = CountAllObjectsInAreaByTag("o_Stoned", oEntering);
int nVFXtotal = CountAllObjectsInAreaByTag("o_VFX", oEntering);
int nShadowIndex, nIceIndex, nBarkIndex, nStoneIndex, nVFXIndex;
for (nShadowIndex=1; nShadowIndex<=nShadowed; nShadowIndex++)
{
object oTarget = GetNearestObjectByTag("o_Shadowed", oEntering, nShadowIndex);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_PROT_SHADOW_ARMOR), oTarget);
}
for (nIceIndex=1; nIceIndex<=nIced; nIceIndex++)
{
object oTarget = GetNearestObjectByTag("o_Iced", oEntering, nIceIndex);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_ICESKIN), oTarget);
}
for (nBarkIndex=1; nBarkIndex<=nBarked; nBarkIndex++)
{
object oTarget = GetNearestObjectByTag("o_Barkskin", oEntering, nBarkIndex);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_PROT_BARKSKIN), oTarget);
}
for (nStoneIndex=1; nStoneIndex<=nStoned; nStoneIndex++)
{
object oTarget = GetNearestObjectByTag("o_Stoned", oEntering, nStoneIndex);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_DUR_PROT_STONESKIN), oTarget);
}
for (nVFXIndex=1; nVFXIndex<=nVFXtotal; nVFXIndex++)
{
object oTarget = GetNearestObjectByTag("o_VFX", oEntering, nVFXIndex);
int nVFXref = GetLocalInt(oTarget, "nVFX");
effect eVis = EffectVisualEffect(nVFXref);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, oTarget);
}
}
I haven't implemented the colored glows, and don't have any plans to right now. If you feel like building on the general template I've got here, feel free to go for it and post back.
Edit:
Important thing I forgot to mention! Objects must not be static! If they're static the script won't work on them at all.
Took me like 3 hours to figure that out.