Player Resource Consortium

 

Author Topic: VFX Scripting  (Read 2309 times)

0 Members and 1 Guest are viewing this topic.

January 28, 2012, 05: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);
        }

HEATSTROKE


January 28, 2012, 09:07:08 AM
Reply #1
  • Developer
  • *****
  • Posts: 1439
  • Karma: +27/-0
  • Gender: Male
    • View Profile

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).


January 28, 2012, 02:47:48 PM
Reply #2

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?
HEATSTROKE


January 28, 2012, 03:52:38 PM
Reply #3
  • Developer
  • *****
  • Posts: 1439
  • Karma: +27/-0
  • Gender: Male
    • View Profile

*facepalm*


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.
« Last Edit: January 28, 2012, 04:11:12 PM by xwarren »


January 28, 2012, 04:47:01 PM
Reply #4

*facepalm*


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!

HEATSTROKE


January 28, 2012, 05:07:00 PM
Reply #5
  • Developer
  • *****
  • Posts: 1439
  • Karma: +27/-0
  • Gender: Male
    • View Profile

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)