Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Removing Visual Effects

Page: 1 of 1
 Silveredge9
11-27-2006, 2:08 PM
#1
void main() {

object oAdin=GetObjectByTag("droid_mand1");
object oAdin1=GetObjectByTag("droid_mand2");
object oAdin2=GetObjectByTag("droid_mand3");


effect efVisual = EffectVisualEffect(8001, 0);


effect eEffect = EffectVisualEffect(8002);
effect eEffect2 = EffectVisualEffect(8000);

DelayCommand(0.5, RemoveEffect(oAdin, eEffect));
DelayCommand(0.5, RemoveEffect(oAdin, eEffect2));
DelayCommand(0.5, RemoveEffect(oAdin1, eEffect));
DelayCommand(0.5, RemoveEffect(oAdin1, eEffect2));
DelayCommand(0.5, RemoveEffect(oAdin2, eEffect));
DelayCommand(0.5, RemoveEffect(oAdin2, eEffect2));

DelayCommand(0.5, AssignCommand (oAdin,ApplyEffectToObject(1, efVisual, GetObjectByTag("droid_mand1"), 5.0)));
DelayCommand(0.5, AssignCommand (oAdin1,ApplyEffectToObject(1, efVisual, GetObjectByTag("droid_mand2"), 5.0)));
DelayCommand(0.5, AssignCommand (oAdin2,ApplyEffectToObject(1, efVisual, GetObjectByTag("droid_mand3"), 5.0)));

}
I'm using the above code to remove the stealth field visual effect, but it doesn't work. :/

I'm wondering where the problem is? Any help would be appreciated. :)
 Emperor Devon
11-27-2006, 2:10 PM
#2
Are you just trying to remove it in one specific instance, or everywhere? :)
 Silveredge9
11-27-2006, 2:11 PM
#3
I'm trying to remove it from 3 NPC's forever.
 stoffe
11-27-2006, 2:17 PM
#4
(snip)
I'm using the above code to remove the stealth field visual effect, but it doesn't work. :/
I'm wondering where the problem is? Any help would be appreciated. :)

You are not removing the actual effect from the creature. You declare a new effect, which you do not apply to anything, and then try to remove it. You will have to remove the effect that is already applied to the object instead of declaring a new one.

For non-visual effects you can most of the time do this by iterating through the effects on an object with the GetFirstEffect() and GetNextEffect() functions until you find the effect you want to remove and then call RemoveEffect() on that one.

If you want to flush out all scripted effects from an object regardless of type you can use the ClearAllEffects() function.

For visual effects, which I get the impression you are after here, you can use the RemoveEffectByID() function instead. Like:


void ApplyAndRemove(effect efVisual, object oTarget) {
RemoveEffectByID(oTarget, 8000);
RemoveEffectByID(oTarget, 8002);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, efVisual, oTarget, 5.0);
}

void main() {
effect efVisual = EffectVisualEffect(8001);

DelayCommand(0.5, ApplyAndRemove(efVisual, GetObjectByTag("droid_mand1")));
DelayCommand(0.5, ApplyAndRemove(efVisual, GetObjectByTag("droid_mand2")));
DelayCommand(0.5, ApplyAndRemove(efVisual, GetObjectByTag("droid_mand3")));
}
 Silveredge9
11-27-2006, 4:52 PM
#5
You are not removing the actual effect from the creature. You declare a new effect, which you do not apply to anything, and then try to remove it. You will have to remove the effect that is already applied to the object instead of declaring a new one.

For non-visual effects you can most of the time do this by iterating through the effects on an object with the GetFirstEffect() and GetNextEffect() functions until you find the effect you want to remove and then call RemoveEffect() on that one.

If you want to flush out all scripted effects from an object regardless of type you can use the ClearAllEffects() function.

For visual effects, which I get the impression you are after here, you can use the RemoveEffectByID() function instead. Like:


void ApplyAndRemove(effect efVisual, object oTarget) {
RemoveEffectByID(oTarget, 8000);
RemoveEffectByID(oTarget, 8002);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, efVisual, oTarget, 5.0);
}

void main() {
effect efVisual = EffectVisualEffect(8001);

DelayCommand(0.5, ApplyAndRemove(efVisual, GetObjectByTag("droid_mand1")));
DelayCommand(0.5, ApplyAndRemove(efVisual, GetObjectByTag("droid_mand2")));
DelayCommand(0.5, ApplyAndRemove(efVisual, GetObjectByTag("droid_mand3")));
}


The effect I apply to the NPC's is the visual effect that occurs when you deactivate a stealth field. Which works perfectly.

It's just that you can't see it because the invisibility stealth effect that has been declared on the NPC's in a previous script has not been deactivated. I just need a script that removes this effect permanently, effect VFX_DUR_DISTORTION/8000 and effect VFX_DUR_STEALTH_FIELD/8002
 stoffe
11-27-2006, 5:33 PM
#6
It's just that you can't see it because the invisibility stealth effect that has been declared on the NPC's in a previous script has not been deactivated. I just need a script that removes this effect permanently, effect VFX_DUR_DISTORTION/8000 and effect VFX_DUR_STEALTH_FIELD/8002

Eh, does the script I posted above not work? It should do what you describe. If not: try delaying applying the "decloak" effect by a tenth of a second or so so the invisibility effect is gone when it is applied.

If they still stay invisible check that your NPC does not have the "WillNotRender" flag set. If they do you'll have to deactivate that as well.
 Silveredge9
11-27-2006, 7:21 PM
#7
The script itself doesn't compile in KOTOR TOOL, the error given is -

Error: Undeclaired Identifiyer "RemoveEffectByID"

In both of the instances in which it is used, lines 2 and 3. :/
 stoffe
11-27-2006, 7:37 PM
#8
The script itself doesn't compile in KOTOR TOOL, the error given is -
Error: Undeclaired Identifiyer "RemoveEffectByID"
In both of the instances in which it is used, lines 2 and 3. :/

That script function only exists in The Sith Lords (which I default to if someone does not mention which game their question relates to). Thus make sure you set the script compiler to compile for TSL, not KotOR1. :)
 Silveredge9
11-30-2006, 6:00 PM
#9
So I assume the script doesn't work in KOTOR1? What would I use to acheive the same effect?
Page: 1 of 1