I've been trying to figure this out all night. I added an effect to an object.
This part works.
void main()
{
object oNPC = GetObjectByTag("NPC_TAG"); effect eEffect = EffectNWN2SpecialEffectFile("fx_succubus_eyes", oNPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oNPC);
}
Now I can't get rid of it. I've tried looping through the effects the standard way.
--------
effect eEffect = GetFirstEffect(oNPC);
while ( GetEffectVaild(eEffect) )
{
RemoveEffect(oNPC,eEffect)
eEffect = GetNextEffect(oNPC)
}
This gets rid of regular effects but not the one I'm trying to get rid of.
I've also tried
RemoveSEFFromObject
That didn't work.
Do you have to do something special to remove EffectNWN2SpecialEffectFile?
Thanks
Remove EffectNWN2SpecialEffectFile
Débuté par
Hilltop2012
, nov. 09 2011 03:12
#1
Posté 09 novembre 2011 - 03:12
#2
Posté 09 novembre 2011 - 06:15
try changing this:
while ( GetEffectVaild(eEffect) )
{
RemoveEffect(oNPC,eEffect)
eEffect = GetNextEffect(oNPC)
}
to this
while ( GetEffectVaild(eEffect) )
{
RemoveEffect(oNPC,eEffect)
eEffect = GetFirstEffect(oNPC)
}
About 18 months ago, when I was making TWA1, I had a similar problem. Of course I can't remember how I solved it now. I seem to remember that somehow the effect was getting added more than once to the PC, but the loop should take care of that.
while ( GetEffectVaild(eEffect) )
{
RemoveEffect(oNPC,eEffect)
eEffect = GetNextEffect(oNPC)
}
to this
while ( GetEffectVaild(eEffect) )
{
RemoveEffect(oNPC,eEffect)
eEffect = GetFirstEffect(oNPC)
}
About 18 months ago, when I was making TWA1, I had a similar problem. Of course I can't remember how I solved it now. I seem to remember that somehow the effect was getting added more than once to the PC, but the loop should take care of that.
Modifié par M. Rieder, 09 novembre 2011 - 06:17 .
#3
Posté 09 novembre 2011 - 06:19
Also, you can try giving yourself some feedback to see what is going on in the script.
There is a function that returns the integer of an effect. Turn that integer into a string and have it pop up over the PC's head when the script runs to let you see what effects the script is seeing when it looks for effects to remove.
You can also write another quick script (i've done this) that just goes through all the effects and displays their integers to let you know what you are working with. When debugging, I find that the more information I can give myself from within the script, the quicker I find the problem.
There is a function that returns the integer of an effect. Turn that integer into a string and have it pop up over the PC's head when the script runs to let you see what effects the script is seeing when it looks for effects to remove.
You can also write another quick script (i've done this) that just goes through all the effects and displays their integers to let you know what you are working with. When debugging, I find that the more information I can give myself from within the script, the quicker I find the problem.
#4
Posté 09 novembre 2011 - 07:28
Im not sure if it applies, but i remember applying a visual effect (that lasts over time) as an Instant effect causes it not being able to be removed later. You should try applying it whit temporary or permanent duration and then check if it can be removed.
#5
Posté 09 novembre 2011 - 09:04
M Rieder,
So you have to go back to the first effect in the loop? I found a thread about that last night. I'll try it. The debugging is a good idea also, Thanks
mogroman,
Thats also a good thing to try out. I'll try temporary first. Thanks.
So you have to go back to the first effect in the loop? I found a thread about that last night. I'll try it. The debugging is a good idea also, Thanks
mogroman,
Thats also a good thing to try out. I'll try temporary first. Thanks.
#6
Posté 09 novembre 2011 - 10:32
mogromon wrote...
Im not sure if it applies, but i remember applying a visual effect (that lasts over time) as an Instant effect causes it not being able to be removed later. You should try applying it whit temporary or permanent duration and then check if it can be removed.
That's absolutely true. I didn't catch that the OP used DURATION_TYPE_INSTANT when I looked at it the first time (been away from coding for a while).
If you use DURATION_TYPE_INSTANT for an effect, that effect applies and is then gone. This is fine for effects that don't have a duration, like damage or one-shot VFX/SEFs. Any effect that doesn't have a duration can't be removed later because it instantly removes itself.
#7
Posté 18 novembre 2011 - 02:28
MasterChanger wrote...
mogromon wrote...
Im not sure if it applies, but i remember applying a visual effect (that lasts over time) as an Instant effect causes it not being able to be removed later. You should try applying it whit temporary or permanent duration and then check if it can be removed.
That's absolutely true. I didn't catch that the OP used DURATION_TYPE_INSTANT when I looked at it the first time (been away from coding for a while).
If you use DURATION_TYPE_INSTANT for an effect, that effect applies and is then gone. This is fine for effects that don't have a duration, like damage or one-shot VFX/SEFs. Any effect that doesn't have a duration can't be removed later because it instantly removes itself.
I concur ... I was nearly caught out doing the same thing.
RemoveSEFFromObject works fine if you ensure the original SEF is applied as a DURATION_TYPE_PERMANENT.
Lance.





Retour en haut






