Ok, Without tracing it out in the VM, something I just do not have time to do right now.
So here are My guess.
First an effect is nothing more then a structure.
The Lable for the Effect is nothing more then a pointer that holds the location in memory fo where the first data field is in the Effect Structure. All other Field entrys will be found from an offset from the begining of the effect structure.
When the Effect is first created several of the Fields are blank. And do not get filed in untill it is applyed. i.e. Duration, ExpireDay, ExpireTime.
When you first create the Effect it is located on the stack.
When you Apply the Effect it gets added to the structure of the object you are applying it to. (most likely indirectly)
At this point the Effect is valid. It has not yet expired and is on an object.
Now the Compairison operator does not care where the effects are located and most likely only checks a sub set of the structures fields to see if they match. I dout for one that it checks the lists in the structure to see if the are the same.
Now the GetIsEffectValid would for sure check if the Effect has expired yet of not. I dout the compairson (==) would.
Also the newly created effect is on the stack where the applyed effect is on an object.
For you function passing the effect, well, NWScript only passes Argument by value. so even if you effect is on an object you have just pusjed it right back to the stack with the function call.
Now to you code snipit.
ApplyEffectToObject(nDurationType,eEffect,oPC,fDuration);
eEffect = EffectLinkEffects(eEffect,EffectTurnResistanceIncrease(1));
ApplyEffectToObject(nDurationType,eEffect,oPC,fDuration);
RemoveEffect(oPC,eEffect);
Not suprision that it works you are removing the same effect that you applyed.
Question is would
ApplyEffectToObject(nDurationType,eEffect,oPC,fDuration);
eEffect1 = EffectLinkEffects(eEffect,EffectTurnResistanceIncrease(1));
ApplyEffectToObject(nDurationType,eEffect1,oPC,fDuration);
eEffect2 = EffectLinkEffects(eEffect,EffectTurnResistanceIncrease(1));
RemoveEffect(oPC,eEffect2);
I dout it.
In effect (heh) what you are asking it to do is remove eEffect2 from the stack.
Modifié par Lightfoot8, 31 janvier 2012 - 01:27 .