Help please: issue with ga_effect, during conversation

Hi all,
Just been going around in circles a bit here trying to get this working properly.
I have a conversation, that I want both PC’s and NPC’s to freeze in place (on the conversation node after they initiate an animation), so that it looks like they are frozen in motion. Rather than standing with their arms by their side, frozen…

I’ve got the node set up like this, for example:

So for me, parameter “352” in my visualeffect.2da, is “VFX_DUR_FREEZE_ANIMATIONS”
I’ve set the duration to 90 seconds, only because I’m unsure if setting it to “P” permanent, would make things more difficult. Even though its all been difficult anyway lol

In short, it all works as intended, but what I am having difficulty with, is disabling this “frozen effect” during a conversation & at the end of a conversation…
At the moment, the conversation ends with a battle and all the PC’s and NPC’s are running around with their arms frozen by their side (default no-animation pose).

I tried using the script ga_clear_actions right before the conversation ends, but I don’t think its quite what is needed here, as it doesn’t do anything. Still the issue of no-animation poses.

Any tips/advice welcomed!
Thanks.

I think I have a script for this. Not 100 % sure it works because I’ve had trouble before cancelling effects on creatures. I believe the script was made by Lance at some point. Let me look it up. Be back in a few minutes.

Ok, I found the script but I don’t think it will work in this instance. I found an old thread of mine though. You could maybe copy the scripts from there:

1 Like

Like you see in this thread you could use travus’ script like this:

// Remove VFX. Script by travus.
void main()
{
	object oPC = GetFirstPC();
	effect eEffect;
	
	object oFM = GetFirstFactionMember(oPC, FALSE);
	while (GetIsObjectValid(oFM))
	{
		
		eEffect = GetFirstEffect(oFM);
		while (GetIsEffectValid(eEffect))
		{
			if (GetEffectSpellId(eEffect) < 0) RemoveEffect(oFM, eEffect);
			eEffect = GetNextEffect(oFM);
		}

		oFM = GetNextFactionMember(oPC, FALSE);
	}
}
1 Like

@tfunke - Perhaps this will be a problem to use if you don’t want to remove all effects from the party.

So perhaps use Aqvilinus’ script and then edit it a bit to something like this when applying the effect on the PC and the companions:

void main()
{
	object oPC = GetFirstPC();
	effect eVis = EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION);
	eVis = SetEffectSpellId(eVis, 9999); //9999 <-- just for example here, you can use
                                         //any valid id that doesn't conflict with
                                         //existing ones in spells.2da or in other scripts

	
	object oFM = GetFirstFactionMember(oPC, FALSE);
	while (GetIsObjectValid(oFM))
	{
		ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, oPC);

		oFM = GetNextFactionMember(oPC, FALSE);
	}
	
	
}

And maybe use this (I might have done something wrong in this script, I don’t know, @kevL_s will have to correct me) for removing the effect:

#include "nw_i0_spells"

void main()
{
	object oPC = GetFirstPC();
	
	object oFM = GetFirstFactionMember(oPC, FALSE);
	
	effect eSearch = GetFirstEffect(oFM);
	
	while (GetIsObjectValid(oFM))
	{
	
		 while (GetIsEffectValid(eSearch))
    	{
        	if (GetEffectSpellId(eSearch) == 9999) //your custom spell id
        	{
         	   RemoveEffect(oFM, eSearch);
         	   eSearch = GetFirstEffect(oFM);
        	}
        	else
            	eSearch = GetNextEffect(oFM);
    	}
	
		eSearch = GetFirstEffect(oFM);
		oFM = GetNextFactionMember(oPC, FALSE);
	}
	
   
	
}

EDIT: I’m doing a while loop inside another while loop here which makes me a bit scared. I’m only half sure about the code in the latter script here. Somehow I think that one should maybe “reassign” the eSearch to GetFirstEffect when switching to the next faction member but I’m not sure if I’ve done that correctly.

1 Like

that (almost) works but i find this way more straightforward (and one less line of code)

void main()
{
	object oPC = GetFirstPC();

	object oFM = GetFirstFactionMember(oPC, FALSE);
	while (GetIsObjectValid(oFM))
	{
		effect eSearch = GetFirstEffect(oFM);
		while (GetIsEffectValid(eSearch))
    	{
        	if (GetEffectSpellId(eSearch) == 9999) //your custom spell id
        	{
         	   RemoveEffect(oFM, eSearch);
         	   eSearch = GetFirstEffect(oFM);
        	}
        	else
            	eSearch = GetNextEffect(oFM);
    	}
		oFM = GetNextFactionMember(oPC, FALSE);
	}
}
3 Likes

Since your situation appears to be more specific, use a custom action script like this. Just put it on the last node (or whichever node is the most prudent for you) of the dialog and add the tag:

// ga_remove_visual_effect
/*
	Removes visual effects on sTag.
	
	sTag = Tag of object. If blank then OWNER. Use $PC for PC_SPEAKER. 
*/

#include "ginc_param_const"	

void main(string sTag)
{
	object oTarget = GetTarget(sTag);	
	effect eEffect = GetFirstEffect(oTarget);

	while (GetIsEffectValid(eEffect))
	{
		if (GetEffectType(eEffect) == EFFECT_TYPE_VISUALEFFECT)
		{
			RemoveEffect(oTarget, eEffect);
		}
		
		eEffect = GetNextEffect(oTarget);
	}
}
3 Likes

But if there’s more than one visual effect on the character then you would need to use kevL_s’ version of the script, I believe. Otherwise your script is perfect, @travus.

1 Like

@andgalf , @kevL_s , @travus
Thanks you all for your contributions and solutions. Tested now and it works a charm, thanks for that!

2 Likes