Getting the effect object from ApplyEffectAtLocation()

I can think of a couple ways around this, but I would like to get the effect object produced by ApplyEffectAtLocation(). Is there a way to do that directly? Or should I be monkeying around with GetNearestObjectToLocation(), etc. to find the effect object after it has been created (possibly using TagEffect() before creating the effect…). My hope is that this can be done without looping through objects and testing them, as would be the case if ApplyEffectAtLocation() did the obvious thing and returned the effect object. But, I am not seeing that…

https://github.com/Shad000w/community-patch/blob/main/copy%20into%20game’s%20installation%20folder/ovr/70_inc_spells.nss line 852

but in EE GetObjectTag should return latest created object, so assuming this behavior is reliable simple GetObjectByTag(“VFX_*”); will do the trick. Note, if you don’t know, tag of AOE is equal to that AOE’s value inside LABEL column in vfx_persistent.2da

1 Like

That’s very useful. I didn’t know that some effects automatically have a certain tag. I am looking to get this working with persistent AoE spell effects. Do you know what the tag would be for an AoE spell effect, like Blade Barrier. My quick testing leads me to think it will not just be AOE_PER_WALLBLADE?

No it will be “VFX_PER_WALLBLADE” tag equals to LABEL in vfx_persistent not the toolset constants for AOE numeric ID.

Blaargh. Looking for BLADE_something in vfx_persistent, I skipped right past that. Thank you! That does the job.

I still assume the engine (in GetObjectByTag() or GetNearestObjectByTag() when a location is needed, since there can be more than one of an AoE spell running at a time) is looping over objects. But, maybe that is unavoidable without a direct reference to the object from the creating function.