Aller au contenu

Photo

Removing specific *visual* effects


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
 <looking appalled at the ragged edge...>

There is no way to determine *which* visual effects are on an object?

From the Lexicon on RemoveEffect:
you must loop through effects on the creature, and remove the effect(s) of the correct type, and possibly the correct creator and subtype. View the codesample below for information on how to do this. 

and 

It was previously mentioned that visual effects have no effecttype. This is incorrect, this function will return EFFECT_TYPE_VISUALEFFECT for visual effects. 


So my only choice in removing the visual effects are to remove *all* visual effects?

effect eLoop=GetFirstEffect(oPC);

while (GetIsEffectValid(eLoop))
{
   if (GetEffectType(eLoop)==EFFECT_TYPE_VISUALEFFECT)
      RemoveEffect(oPC, eLoop);

   eLoop=GetNextEffect(oPC);
}

<... of an incomplete incantation scroll of enormous power>

Modifié par Rolo Kipp, 29 novembre 2011 - 09:37 .


#2
Shadooow

Shadooow
  • Members
  • 4 470 messages
Yep, unfortunately the nwn functions are missing GetEffectInteger that would allowed it.

Possibilities are:
1) NWNX has this function (think its nwnx_effect for unix or nwnx_funcs for win)
2) if its spell, check GetEffectSpellId();
3) if its not spell, you have to assign the creation of the effect to some plot object in your module with unique tag beforehand ( AssignCommand(GetObjectByTag("EC_MYVFX"), ApplyEffect...); ) and then check in your script fot the tag of GetEffectCreator();

#3
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<punches...>

Ahh. Number three is the ticket, I think. Just have the Torc create the effect and check for effects created by the Torc.

Thank you ShadoOow. :-)

<...a T ticket>

#4
Shadooow

Shadooow
  • Members
  • 4 470 messages
Oh, I forgot to make clearer example for the effect application:

AssignCommand(GetObjectByTag("EC_MYVFX"), ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(nVFX), oPC, 60.));

point is that you must not declare the effect into variable beforehand otherwise the creator will be OBJECT_SELF!

#5
Rolo Kipp

Rolo Kipp
  • Members
  • 2 791 messages
<grins...>

Well, that explains why it didn't work :-P

Trying again.

Edit: WooHOO! Worked like a charm =)

Except... ;-P
1) Can't link effects... but that's ok.
2) The little bubbles continue for about 6 seconds after everything is removed... wierd :-)

<...with happiness>

Modifié par Rolo Kipp, 29 novembre 2011 - 10:56 .


#6
Shadooow

Shadooow
  • Members
  • 4 470 messages
1) you can you just have to do it in one line like EffectLinkEffect(Effect1,Effect2)
2) yes I also noticed this, its a model issue I guess

#7
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Sure you can link the effects.   Just assing it is the object to create and link the effects.




effect eEffectsLinked ()
{
  effect Effect1 = EffectVisualEffect(nVFX);
  effect Effect2 = EffectVisualEffect(nVFX2);
  return EffectLinkEffects( Effect1,Effect2);
}

void main()
{
  AssignCommand(GetObjectByTag("EC_MYVFX"), ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffectsLinked ()
, oPC, 60.));
}

Or a little cleaner


void  eEffectsApplyed to ( object oTarget)
{
      effect Effect1 = EffectVisualEffect(nVFX);
      effect Effect2 = EffectVisualEffect(nVFX2);
      effect eEffect =  EffectLinkEffects( Effect1,Effect2);
     ApplyEffectToObject(DURATION_TYPE_TEMPORARY,  eEffect, oTarget, 60.)     
}

void main()
{
  object oPC = GetEnteringObject();
 AssingCommand(GetObjectByTag("EC_MYVFX"),eEffectsApplyed to(oPC));
}

Modifié par Lightfoot8, 29 novembre 2011 - 11:32 .