Best way to do this is via a trigger, not the OnAreaEnter script. Just place the trigger over the whole area.
OK, the script:
First of all you make sure it only runs once
Code:
if ( GetLocalInt( OBJECT_SELF, "done" ) == TRUE ){
return;
}
else{
SetLocalInt( OBJECT_SELF, "done", TRUE )
}
You then create the effect
Code:
effect eSkin = EffectVisualEffect( VFX_DUR_PROT_SHADOW_ARMOR );
You loop through the area and apply the effect
Code:
object oArea = GetArea( OBJECT_SELF );
object oObject = GetFirstObjectInArea( oArea );
while ( GetIsObjectValid( oObject ) ) {
if ( GetTag( oObject ) == "PaintThis" ){
ApplyEffectToObject( DURATION_TYPE_PERMANENT, eSkin, oObject );
}
oObject = GetNextObjectInArea( oArea );
}
And finally you remove the trigger. Not 100% sure if you need to look at the timing. Theoretically you should be able to remove the trigger right after the "GetArea( OBJECT_SELF )" statement, but you never know.
Code:
DestroyObject( OBJECT_SELF, 1.0 );