Calling a summons to a target location in a tag-based script

Assume that an item is intended to summon a custom creature as an associate of the PC using the item. A tag-based script runs when a PC activates the item and targets a spot on the ground. Is there a way to get that summons to appear at the targeted location?

If I use ApplyEffectAtLocation() with the EffectSummonCreature() effect, no creature appears. Note that ApplyEffectToObject() works fine, except that it creates the summons next to the PC, instead of at the target location.

I suspect that this is because the OnActivate event is owned by the module and not the PC. So, ApplyEffectAtLocation() is trying to create a summons that is an associate of the module, which isn’t a thing, so it fails.

I know that creating a second script that applies the effect and calling that script using ExecuteScript() can work, setting the PC as the caller. But, that is kind of a clumsy solution, having a second script floating around.

Anyway, this isn’t a show-stopper. But, it would be nice to know if there is a good way to get a tag-based script to summon a creature to a target location, without resorting to having a second script and calling ExecuteScript().

an object (PC) can be assigned as the owner of a function w/ AssignCommand()

eg. write a subfunction with the summons-effect stuff and assign it to oPC – the result is very similar to using ExecuteScript(oPC)

1 Like


I had previously tried using AssignCommand, but not calling a separate local function. I used it with ApplyEffectAtLocation(). I am not sure why that did not work. But, your approach did. Thanks!

1 Like