Can you loop FNF visual effects, on a creature?
-
I'm pretty bad at scripting.
Anyway, was wondering if it was possible to loop a fire and forget (FNF) viausl effect, on a creature. So, once the effect has run, it runs again, and again, and again, until the monsters deaderised.
I haven't really tried, but the ways I think of involve while loopsin on spawn scripts….and that just sounds like TMI error central.
-
Moloch did it with his Flaming Corpses. And I know Seth did it on many occasions when he created new monsters, but as to how it should be scripted, I have no clue about.
-
Recursive functions FTW. I think CoA's Hold Person works this way, for a concrete reference. Basically, it's a function that calls itself.
Example:
void FlashThisHomie(object oCreature, int nRoundsDuration); void main() { object oFlasher = OBJECT_SELF; int nLevel = GetHitDice(oFlasher); FlashThisHomie(oFlasher, nLevel); } void FlashThisHomie(object oCreature, int nRoundsDuration) { effect eFlashpan = EffectVisualEffect(THE EFFECT); if(!GetIsDead(oCreature) && nRoundsDuration > 0) { ApplyEffectToObject(DURATION_TYPE_TEMPORARY/INSTANT ..., ...); nRoundsDuration--; DelayCommand(6.0f, FlashThisHomie(oCreature, nRoundsDuration)); } }
Note how the FlashThisHomie function contains a call to itself. It will decrement the number of rounds for which to subsequently fire, then re-apply with the new duration value. This is usually for spells; for an indefinite value the duration parameter is simply removed, and the function just calls itself on a delay each round (or seconds, depending how much the effect lasts).
-
[Flashes this Homie]
-
Oh. thanks, yeah, Azzmodan told me about this way of doing it. Cheers for the help though, and maybe someone else will find this useful in the future.