Author Topic: Vfx for placeables and items?  (Read 446 times)

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Vfx for placeables and items?
« on: August 02, 2015, 12:19:34 am »


               

I'm guessing that this question has already been asked dozens of times but I can't seem to find any topics related in previous threads.


 


I know that different servers use different methods for applying vfxs to things like items especially, tag based, non-tag based etc, probably other things too. I'm just wondering what's generally the easiest way to do it, or perhaps if someone could show me how it's done as a tag based script and also without since the guy I'm scripting for disallows tag based scripts apparently.


 


I'm interested in vfx's that fire for onhit as well as onEquip, to provide fnf and duration auras respectively.


 


Also is it the same kind of thing for placeables? Do you have to use a variable?



               
               

               
            

Legacy_The Mad Poet

  • Hero Member
  • *****
  • Posts: 715
  • Karma: +0/-0
Vfx for placeables and items?
« Reply #1 on: August 02, 2015, 01:08:41 am »


               

I haven't done it in awhile, but I remember doing something using the heartbeat placeable script. Went through, applied a VFX, added a variable to the object that stopped the heartbeat from doing it again. Probably not the best solution though.



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Vfx for placeables and items?
« Reply #2 on: August 02, 2015, 08:47:02 am »


               

Duration VFX typically work on placeables (much the same as creatures) provided you work around the known bug.


 


In my limited experience, FNF effects don't work on placeables, because they don't have the same nodes as creatures.



               
               

               
            

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Vfx for placeables and items?
« Reply #3 on: August 02, 2015, 07:14:09 pm »


               

I've tried putting a vfx on a placeable by its tag, and I had it firing with a trigger when a player stepped over a portion of ground. Does anyone know why it only applies the vfx to one instance of the object and not all of them?



               
               

               
            

Legacy_The Mad Poet

  • Hero Member
  • *****
  • Posts: 715
  • Karma: +0/-0
Vfx for placeables and items?
« Reply #4 on: August 02, 2015, 07:19:38 pm »


               

I think its because the script finds the one object and then finishes. If you want to find all things tagged something you have to do a loop through the area I'd imagine.



               
               

               
            

Legacy_Tchos

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +0/-0
Vfx for placeables and items?
« Reply #5 on: August 02, 2015, 07:20:53 pm »


               

Unless you create a loop that increments with each pass, the usual "get" functions will only get the first copy they find of the object matching that tag, not all of them.



               
               

               
            

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Vfx for placeables and items?
« Reply #6 on: August 02, 2015, 08:21:17 pm »


               

void main()

{


    object oTarget;

    effect eVFX;

    eVFX = SupernaturalEffect(EffectVisualEffect(VFX_DUR_PROT_SHADOW_ARMOR));


int i;

for(i = 1; i < 100; i++)

    {

    oTarget = GetObjectByTag("OnyxObelisk");

    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVFX, oTarget);

    }

    }


 


so something like this? '<img'> but doesn't seem to do it though.


 


---


 


also I'm curious as to how people incorporate variables to make the vfx script fire? Do they just set up a thing to get the number associated with the variable and then match it to a vfx?



               
               

               
            

Legacy_Tchos

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +0/-0
Vfx for placeables and items?
« Reply #7 on: August 02, 2015, 08:50:03 pm »


               Change it to
oTarget = GetObjectByTag("OnyxObelisk", i);
Except it should start from 0, or it'll skip the first one.
               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
Vfx for placeables and items?
« Reply #8 on: August 02, 2015, 09:26:42 pm »


               

Also, unless you have exactly 100 items with that tag, use a while loop. No point in running the loop more often than you need to:



void main()
{
    int i;
    object oTarget = GetObjectByTag("OnyxObelisk", i);
    effect eVFX = SupernaturalEffect(EffectVisualEffect(VFX_DUR_PROT_SHADOW_ARMOR));
 
    while (GetIsObjectValid(oTarget))
    {
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVFX, oTarget);
        oTarget = GetObjectByTag("OnyxObelisk", ++i);
    }
}


               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
Vfx for placeables and items?
« Reply #9 on: August 02, 2015, 09:32:53 pm »


               


also I'm curious as to how people incorporate variables to make the vfx script fire? Do they just set up a thing to get the number associated with the variable and then match it to a vfx?




 


In the case of an OnHeartbeat script, you'd do something like this:



if (GetLocalInt(OBJECT_SELF, "DoVFX"))
{
    // create and apply your vfx here
}

Note that this is not a solution for permanently applied VFX. This is for when you have an effect you want to apply each heartbeat (say, an electrical arc surging between two pylons) which you may want to turn off. When you did want to turn it off, you just call



SetLocalInt(oTarget, "DoVFX", FALSE);


               
               

               
            

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
Vfx for placeables and items?
« Reply #10 on: August 02, 2015, 11:09:51 pm »


               


 


Also, unless you have exactly 100 items with that tag, use a while loop. No point in running the loop more often than you need to:



void main()
{
    int i;
    object oTarget = GetObjectByTag("OnyxObelisk", i);
    effect eVFX = SupernaturalEffect(EffectVisualEffect(VFX_DUR_PROT_SHADOW_ARMOR));
 
    while (GetIsObjectValid(oTarget))
    {
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVFX, oTarget);
        oTarget = GetObjectByTag("OnyxObelisk", ++i);
    }
}



thanks, this worked. I'm pretty terrible at coding :/


               
               

               
            

Legacy_The Mad Poet

  • Hero Member
  • *****
  • Posts: 715
  • Karma: +0/-0
Vfx for placeables and items?
« Reply #11 on: August 02, 2015, 11:40:07 pm »


               

Hey, if you can make a door open and close with a script without help on this board I'm pretty impressed. '<img'>