Player Resource Consortium

Neverwinter Nights => Builders => Topic started by: DM Heatstroke on January 28, 2012, 12:53:14 AM

Title: VFX Scripting
Post by: DM Heatstroke on January 28, 2012, 12:53:14 AM
VFX Scripting question.  Is there a way to apply a vfx (like a glow, or stoneskin & shadow effects) to a creatures corpse?  Not the generic body that you can make spawn like a bag, but the actual dead & raisable body of a creature.

I use a lot of VFXs OnSpawn for my creatures & I hate the way that the VFXs go away when a creature dies.

Example current OnSpawn script:
Code: [Select]
int nShadowy = GetLocalInt(OBJECT_SELF,"SHADOWY");
    if (nShadowy)
        {
            effect eVis = EffectVisualEffect(VFX_DUR_PROT_SHADOW_ARMOR);
            eVis = SupernaturalEffect(eVis);
            eVis = ExtraordinaryEffect(eVis);
            ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF);
        }

    int nStony = GetLocalInt(OBJECT_SELF,"STONY");
    if (nStony)
        {
            effect eVis = EffectVisualEffect(VFX_DUR_PROT_STONESKIN);
            eVis = SupernaturalEffect(eVis);
            eVis = ExtraordinaryEffect(eVis);
            ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF);
        }

    int nWoody = GetLocalInt(OBJECT_SELF,"WOODY");
    if (nWoody)
        {
            effect eVis = EffectVisualEffect(VFX_DUR_PROT_BARKSKIN);
            eVis = SupernaturalEffect(eVis);
            eVis = ExtraordinaryEffect(eVis);
            ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,OBJECT_SELF);
        }

Title: Re: VFX Scripting
Post by: xwarren on January 28, 2012, 04:07:08 AM
Duration effects (VFX_DUR_*) won't work on dead creatures (even if supernatural).
Impact effects will work, but they can only be applied as instantaneous :/

I was unable to convert VFX_DUR_PROT_SHADOW_ARMOR from duration to impact vfx.  The part that applies shadow texture is hardcoded (ProgFX_Duration = 1040, no model files for vfx).
Title: Re: VFX Scripting
Post by: DM Heatstroke on January 28, 2012, 09:47:48 AM
Duration effects (VFX_DUR_*) won't work on dead creatures (even if supernatural).
Impact effects will work, but they can only be applied as instantaneous :/

I was unable to convert VFX_DUR_PROT_SHADOW_ARMOR from duration to impact vfx.  The part that applies shadow texture is hardcoded (ProgFX_Duration = 1040, no model files for vfx).

Hardcoded as there isn't actually a VFX file for it?
Title: Re: VFX Scripting
Post by: xwarren on January 28, 2012, 10:52:38 AM
*facepalm*

(http://img215.imageshack.us/img215/5531/wolfyq.jpg)
I applied the effect from OnDeath event with this:
Code: [Select]
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_PROT_SHADOW_ARMOR),OBJECT_SELF));DelayCommand is important - this won't work without it.

Hardcoded = there is no *.mdl file for this vfx.

Edit: Works with shadowshield and stonesking vfx ;)

A tip about your script:
Code: [Select]
int nVFX = GetLocalInt(OBJECT_SELF,"SpawnVFX");
if(nVFX)
{
    ApplyEffectToObject(DURATION_TYPE_PERMANENT,SupernaturalEffect(EffectVisualEffect(nVFX)),OBJECT_SELF);
}
This way you set only one int on all your creatures (which is the line number of the vfx from visualeffects.2da) and apply the effect if the valu is > 0.
Title: Re: VFX Scripting
Post by: DM Heatstroke on January 28, 2012, 11:47:01 AM
*facepalm*

(http://img215.imageshack.us/img215/5531/wolfyq.jpg)
I applied the effect from OnDeath event with this:
Code: [Select]
DelayCommand(0.0f, ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectVisualEffect(VFX_DUR_PROT_SHADOW_ARMOR),OBJECT_SELF));DelayCommand is important - this won't work without it.

Hardcoded = there is no *.mdl file for this vfx.

Edit: Works with shadowshield and stonesking vfx ;)

A tip about your script:
Code: [Select]
int nVFX = GetLocalInt(OBJECT_SELF,"SpawnVFX");
if(nVFX)
{
    ApplyEffectToObject(DURATION_TYPE_PERMANENT,SupernaturalEffect(EffectVisualEffect(nVFX)),OBJECT_SELF);
}
This way you set only one int on all your creatures (which is the line number of the vfx from visualeffects.2da) and apply the effect if the valu is > 0.

Oh that is great.  And the coding tip is great too, I didn't even think of that.  Thanks!

Title: Re: VFX Scripting
Post by: xwarren on January 28, 2012, 12:07:00 PM
I really thought this is impossible. Duration effects without DelayCommand() simply don't work in this case.
I'm happy I was wrong ;)

Another tip:
I've added modified shadowsield/stoneskin effects in latest PRC release - those will also work on large creatures (by default 'circling rock' and 'shadowy circle' were applied)