My idea was creating an aimed or target location spell that places an activator and then uses the FindClosestReference functions to find the closest door that, ehem, needs to be opened

My progress and issues so far:
1. The self version of the spell using FindClosestReferenceOfAnyTypeInList works like a charm. So I have a spell that opens the closest door to the player if it is in the FormList of course...It would be cooler to not have to add the doors in the FormList, but it's a beginning
Spoiler
scriptName ShanaOpenSelfTestScript extends ActiveMagicEffect{Scripted magic effect blablabla.}import utilityimport gameFormList property ShanaThingsOpenable auto;======================================================================================;; VARIABLES /;=============/objectReference CastFromHereReffloat RadiusToFindDoor = 100.0;======================================================================================;; EVENTS /;=============/Event OnInit() Debug.Trace(" ShanaOpenSelfTestScript OnInit ")EndEventEvent OnEffectStart(Actor Target, Actor Caster) Debug.Trace(" Looking for doors") CastFromHereRef = Caster ObjectReference closestDoor = Game.FindClosestReferenceOfAnyTypeInListFromRef(ShanaThingsOpenable, CastFromHereRef, RadiusToFindDoor ) if ( closestDoor == None) Debug.Notification("There is no door near!") else Debug.Trace("The closest door is: " + closestDoor) if( closestDoor.isLocked() ) Debug.Notification("Opening door!!!") closestDoor.Lock(false) endif endifEndEvent2. I have managed to create an activator with PlaceAtMe and modify the previous script to find references closest to it, but it only works when I shoot the spell at some actor feet....My guess is that it needs a target actor, which is not exactly what I was thinking...
Spoiler
scriptName ShanaAimedOpenTestScript extends ActiveMagicEffect{Scripted magic effect Placing and activator and then removing it.}import utilityimport game;======================================================================================;; PROPERTIES /;=============/activator property FXEmptyActivator auto{The name of the placed Activator that the spell will come from. (REQUIRED!)}FormList property ShanaThingsOpenable auto;======================================================================================;; VARIABLES /;=============/ObjectReference closestDoorobjectReference ActivatorReffloat RadiusToFindDoor = 1000.0;======================================================================================;; EVENTS /;=============/Event OnInit() Debug.Trace(" ShanaAimedOpenTestScript OnInit ")EndEventEvent OnEffectStart(Actor Target, Actor Caster) Debug.Trace(" ShanaAimedOpenTestScript OnEffectStart begins") ActivatorRef = Target.placeAtMe(FXEmptyActivator) Debug.Trace("After placeAtMe") if ( ActivatorRef != None) Debug.Trace("Activator has been placed") Else Debug.Trace("Activator has NOT been placed!") endif Debug.Trace(" Looking for doors...hopefully") closestDoor = Game.FindClosestReferenceOfAnyTypeInListFromRef(ShanaThingsOpenable, ActivatorRef, RadiusToFindDoor ) Debug.Trace(" ShanaAimedOpenTestScript : After FindClosestReferenceOfAnyTypeInListFromRef") if ( closestDoor == None) Debug.Trace("There is no door near!") Debug.Notification("There is no door near!") else Debug.Trace("The closest door is: " + closestDoor) if( closestDoor.isLocked() ) Debug.Trace("Opening door!!!") Debug.Notification("Opening door!!!") closestDoor.Lock(false) else Debug.Notification("The door is not closed!") Debug.Trace("The door is not closed!") endif endif Debug.Trace(" ShanaAimedOpenTestScript OnEffectStart ends")EndEventEvent OnEffectFinish(Actor Target, Actor Caster) if (ActivatorRef != none) ActivatorRef.disable() ActivatorRef.delete()endifEndEvent3. I have been trying to use FindClosestReferenceOfTypeFromRef instead of the FormList version to see if it could make a difference, but whatever I try, I always get the runtime error error: None or invalid form type as Base object for FindClosestReferenceOfType
even when I trace the form and it looks ok WRShackDoor01 : [Form < (0000028A)>]
Spoiler
scriptName ShanaOpenSelfTest2Script extends ActiveMagicEffect{Scripted magic effect blablabla.}import utilityimport gameForm property WRShackDoor01 auto;======================================================================================;; VARIABLES /;=============/objectReference CastFromHereRefObjectReference closestDoorfloat RadiusToFindDoor = 500.0;======================================================================================;; EVENTS /;=============/Event OnInit() Debug.Trace(" ShanaOpenSelfTest2Script OnInit ") Debug.Trace(" WRShackDoor01 : " + WrShackDoor01)EndEventEvent OnEffectStart(Actor Target, Actor Caster) Debug.Notification(" ShanaOpenSelfTest2Script OnEffectStart ") Debug.Trace(" ShanaOpenSelfTest2Script OnEffectStart ") Debug.Trace(" Looking for doors...hopefully") Debug.Notification(" Looking for doors...hopefully") CastFromHereRef = Caster closestDoor = Game.FindClosestReferenceOfTypeFromRef(WRShackDoor01, CastFromHereRef, RadiusToFindDoor ) if ( closestDoor == None) Debug.Trace("There is no door near!") Debug.Notification("There is no door near!") else Debug.Trace("The closest door is: " + closestDoor) if( closestDoor.isLocked() ) Debug.Trace("Opening door!!!") Debug.Notification("Opening door!!!") closestDoor.Lock(false) endif endif Debug.Trace(" ShanaOpenSelfTest2Script OnEffectStart End")EndEventSo my questions are,
- Is there a way to place an activator or whatever type of object in a spell without having a target or a workaround to do what I want? Maybe following a magic projectile last known location and run the FindClosestReference part when it's disabled?
- What's the right way of passing a parameter to FindClosestReferenceOfAnyTypeFromRef? It looks like passing it a Form as it says in the wiki doesn't work, or that I'm missing something...
- (Fixed lol ) THE MOST IMPORTANT: How do I pretty print the code inside the Spoiler tags? lol

.