Create effect - doesn't work

I am trying to create an effect near (or possibly at) a creature in an area through a script. The effect in question that I’m trying to use is “fx_ghost_dematerialize_l”. I tried this by making a custom placed effect that I saved as a campaign object.

effectdem

Then I scripted it like this (this is just the function inside a larger script):

void PseudoHeartbeat()
{
	if(GetGlobalInt("progressvoidgone")) return;
	object oPC = GetFirstPC();
	object oSpirit = GetObjectByTag("spirit");
	
	object oArea = GetArea(oPC);
	
	location lNearThePC = GetLocation(oSpirit);

	//effect eLightning = EffectVisualEffect(VFX_CAST_SPELL_SPIRIT_EMERGE_GOOD);
	//ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eLightning, lNearThePC);

	CreateObject(OBJECT_TYPE_PLACED_EFFECT,"fx_spirit_em2",lNearThePC,FALSE);
	
	DelayCommand(3.0f, PseudoHeartbeat());
}

I have other effects at play here as well that all work, but this one doesn’t for some reason. I think this is a creature effect, so that might have something to do with it. Thing is, I already have an effect on this creature, and I want this scripted effect to appear, not be there all the time.

The effect I’m trying to achieve here, I guess, is a kind of flickering effect on a creature, so that it seems like the creature is about to disappear.

Despite not getting this to work, I have made the whole scene look ok in other ways.

However, now there’s another effect I would like to have that doesn’t seem to exist. I would like a creature to fade out when I destroy it. In an old thread we discussed how to make a fade in effect, but now I would like the opposite. Someone know how to make a .sef like that? I’ve tried for a bit in the Visual Effects Editor without success.

Best exemples are in spells scripts.

here hw to do it:

effect Myeffect = new EffectVisualEffect(int nVisualEffectId, int nMissEffect=FALSE);

and then use ApplyEffectToObject or ApplyEffectToObject

1 Like

Unfortunately I can’t do it like that with this particular effect since the nVisualEffectId isn’t to be found for this particular effect. If you look under Globals in the Script Assist, fx_ghost_dematerialize_l isn’t there.

In this overall script where I have other effects too, I do it like that, so I know that that method works for the most part, but not in this case.

Try using something like this :

string sFx = "fx_ghost_dematerialize_l"; // .SEF filename w/ or w/out extension
effect eVFX = EffectNWN2SpecialEffectFile(sFx); // see NwScript.nss doc
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVFX, lNearThePC);

Thanks. Tried it out but it doesn’t seem to work either. Great idea otherwise. It looked like it could have worked.

I also tried it but it didn’t work either. Maybe an issue with that specific vfx …

Have you tried with this one ?

string sFx = "fx_ambient_fade"; // .SEF filename w/ or w/out extension
effect eVFX = EffectNWN2SpecialEffectFile(sFx); // see NwScript.nss doc
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);