Skip to content

Swinging Blade Woes

ZephiriusZephirius Member Posts: 419
edited November 2022 in Builders - Scripting
I've stripped this bit of code down to just the VFX part for testing purposes. I can't for the life of me, get the effect to work! No blades. No Jack. Bupkis!
With the same bit of code, it worked in the past. I wonder what's happening so that the blades don't even show up??? Thanks guys,

;)
void main()
{
    object oPC = GetEnteringObject();
    if (!GetIsPC(oPC)) return;

    effect eSwing = EffectVisualEffect(VFX_FNF_SWINGING_BLADE);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eSwing, oPC);
}

I've coded it this way. Still nothing.
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect
(VFX_SWINGING_BLADE_TRAP), oPC);

This way -
location lLoc = GetLocation(GetWaypointByTag("WP_BLADES"));
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect
(VFX_SWINGING_BLADE_TRAP), lLoc);

Still nothing after applying effect at location lLoc. Can anyone think of a reason why it's a no show. Is the code correct. I do believe it is.
Post edited by Zephirius on

Comments

  • 4BOLTMAIN4BOLTMAIN Member Posts: 90
    The first code should work, 2nd and 3rd code should have shown errors when compiling since VFX_SWINGING_BLADE_TRAP does not exist as a constant in the toolset.

    It looks like the script either hasn't been compiled or the script has not been called for in the on_enter slot for the object (assuming it is a generic trigger).


  • ProlericProleric Member Posts: 1,316
    If you're trying to use the official VFX, the constant is VFX_FNF_SWINGING_BLADE.
  • MelkiorMelkior Member Posts: 204
    edited November 2022
    I'm wondering if the problem might be that you're applying the effect the instant the PC is in the area. Perhaps the PC is prematurely reported as being "in" the area when they're actually still in transition, so the effect can't be applied at that time?
    I suggest you try adding the effect using a DelayCommand of around a quarter second (0.25) and see if that makes a difference.

    Edit: I tried it in a test module with no delay and I got not one but four swinging blades, alternately swinging in different directions. It looks like that's the way it's supposed to work, though.
    Second edit: My next guess is that the screen is taking more than a second to display after the PC enters the area, so by the time the display returns the FNF effect has finished (it only runs for one second by default). Maybe try longer delays before applying the effect (one second or more)?
    Post edited by Melkior on
  • TarotRedhandTarotRedhand Member Posts: 1,481
    edited November 2022
    Instead of DURATION_TYPE_INSTANT try DURATION_TYPE_TEMPORARY instead like so.
    void main()
    {
        object oPC = GetEnteringObject();
    
        if(GetIsPC(oPC))
        {
            effect eSwing = EffectVisualEffect(VFX_FNF_SWINGING_BLADE);
            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSwing, oPC, 5.0f);
        }
    }
    

    That should display the blades for 5 seconds. DURATION_TYPE_INSTANT is intended for either effects that are immediate, permanent and that cannot be removed or fire once and forget effects.

    TR
  • ZephiriusZephirius Member Posts: 419
    Instead of DURATION_TYPE_INSTANT try DURATION_TYPE_TEMPORARY instead like so.
    I've tried that bit of code Tarot, still nothing. Something else must be happening. Hmmm...
  • ZephiriusZephirius Member Posts: 419
    Proleric wrote: »
    If you're trying to use the official VFX, the constant is VFX_FNF_SWINGING_BLADE.

    Typo. I'm using the correct constant, - VFX_FNF_SWINGING_BLADE

    I'm really at a loss. Befuddled. Perplexed, confounded.
  • ZephiriusZephirius Member Posts: 419
    I've tried a number of variations involving delays. First using 0.25, then trying 1 .0, 2.0. Nothing. :#
  • ZephiriusZephirius Member Posts: 419
    edited November 2022
    Hmmm, opened up a new module and it works fine. I wonder if one of my haks messes with spells.2da. Is that where it resides?

    Code I used.
    void main()
    {
    
        object oPC = GetEnteringObject();
        if (!GetIsPC(oPC)) return;
    
        int nOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));
        if (nOnce == TRUE)
        {
            return;
        }
        SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
    
        ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect
        (VFX_FNF_SWINGING_BLADE), oPC);
    
    }
    
  • ZephiriusZephirius Member Posts: 419
    edited November 2022
    Solved! The visual effects .2da from LOK tileset was being naughty! Removed it from the hak and it works now. Not sure what I'll be missing by deleting it though. Proleric would probably know. ;)
  • MelkiorMelkior Member Posts: 204
    It was probably overriding the correct .2da file and didn't have the swinging blades in the list of effects.
  • ProlericProleric Member Posts: 1,316
    Zephirius wrote: »
    Solved! The visual effects .2da from LOK tileset was being naughty! Removed it from the hak and it works now. Not sure what I'll be missing by deleting it though. Proleric would probably know. ;)

    No idea why a tileset would override visualeffects.2da. I imagine it ships with scripts that apply VFX - if you're not using them, the impact will be zero.

    A text file comparison of the two versions of visualeffects.2da (using WinMerge Compare or whatever) would reveal which effects are unique to LOK. If they matter, you could make a merged 2da for your top hak.

    In general, older haks like LOK may contain 2da files that are missing lines from more recent versions of NWN.
Sign In or Register to comment.