Aller au contenu

Photo

Vfx for placeables and items?


  • Veuillez vous connecter pour répondre
11 réponses à ce sujet

#1
Imperator

Imperator
  • Members
  • 66 messages

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?



#2
The Mad Poet

The Mad Poet
  • Members
  • 425 messages

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.


  • Proleric et Squatting Monk aiment ceci

#3
Proleric

Proleric
  • Members
  • 2 354 messages

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.


  • Squatting Monk aime ceci

#4
Imperator

Imperator
  • Members
  • 66 messages

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?



#5
The Mad Poet

The Mad Poet
  • Members
  • 425 messages

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.


  • Squatting Monk aime ceci

#6
Tchos

Tchos
  • Members
  • 5 075 messages

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.


  • Squatting Monk aime ceci

#7
Imperator

Imperator
  • Members
  • 66 messages

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? :D 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?



#8
Tchos

Tchos
  • Members
  • 5 075 messages
Change it to
oTarget = GetObjectByTag("OnyxObelisk", i);
Except it should start from 0, or it'll skip the first one.
  • Squatting Monk aime ceci

#9
Squatting Monk

Squatting Monk
  • Members
  • 446 messages

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);
    }
}

  • kalbaern et Imperator aiment ceci

#10
Squatting Monk

Squatting Monk
  • Members
  • 446 messages

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

  • Imperator aime ceci

#11
Imperator

Imperator
  • Members
  • 66 messages

 

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 :/



#12
The Mad Poet

The Mad Poet
  • Members
  • 425 messages

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


  • Squatting Monk aime ceci