The final barriers tohttp://i591.photobucket.com/albums/ss358/RedwoodElf/CKTeleport02.jpg are:
1: The reference variable "TeleportHere" doesn't keep it's value between events. I can get it to come up under certain circumstances (Hit an Actor with the first spell) but the value is apparently erased by the time the second spell goes off. Variables are supposed to be places to store data, but apparently not in Papyrus. This means I absolutely MUST get FindClosestReferenceOfTypeFromRef to work, since there is no other way I can think of to get a reference to the projectile or light created by the first spell, since I can't just save it.
2: I can't get FindClosestReferenceOfTypeFromRef to work at all. I know what I have to do is make a dummy object of the type I'm searching for and send it far, far away before calling this function, but I can't get PlaceAtMe to create said objects for this purpose...I know I've heard that the EditorID is NOT the actual reference you need to use to have a script create an item of a new type you've created, but I still don't know what I DO need to use to create said dummy item.
The script is here (See the above link for a screenshot of the magic effects it's in, and the two objects I'm trying to search for, highlighted in the object pane) - See comments in the code for currently observed behavior.
Scriptname PlayerTeleportScript extends ActiveMagicEffect {A script to teleport the player to a destination node.}import gameimport utilityObjectReference playerObjectReference TeleportHere ; A variable that cannot store a value. Every time the Event is instanced, it appears to come back "None"Event OnEffectStart(Actor Target, Actor Caster) if Target == Caster; This case means it was called from the self cast teleport effect, not the spell effect that fires the projectile Debug.MessageBox("Teleport Node entering Teleport Self Effect: " + TeleportHere); Always returns "None" player = (game.getPlayer() as ObjectReference) if TeleportHere Utility.Wait(0.5) player.MoveTo(TeleportHere) else ; Try to find the TeleportSpellProjectile or light. TeleportHere = (FindClosestReferenceOfTypeFromRef(TeleportSpellProjectile,Game.Getplayer(),10000000) as ObjectReference) if !TeleportHere TeleportHere = (FindClosestReferenceOfTypeFromRef(MagicLightTeleportSpell,Game.Getplayer(),10000000) as ObjectReference) endif if !TeleportHere TeleportHere = (FindClosestReferenceOfTypeFromRef(MagicLightTeleportSpell,Game.Getplayer(),10000000) as ObjectReference) endif if !TeleportHere Debug.MessageBox("Unable to locate any teleport node by any means.") else player.MoveTo(TeleportHere) Debug.MessageBox("Node Assigned to:" + TeleportHere) endif endif else ; Called from the missile launching effect, when it strikes an Actor. Debug.MessageBox("Old Node: " + TeleportHere) ; Always comes back "None" TeleportHere = (Target as ObjectReference) Debug.MessageBox("Node Assigned: " + TeleportHere) ; This shows a value...but it is lost by the time the next event comes around. endifEndEventLight Property MagicLightTeleportSpell auto ; Doesn't actually allow use of the type to create an item instance. Need to know how.Projectile Property TeleportSpellProjectile autoSpell Property TeleportLaunch AutoSpell Property TeleportMove AutoCould someone please tell me what's going wrong? I'm a C++/Java programmer, so I am pretty familiar with how variables are supposed to work, and this isn't it.
I could get around the variable problem, if only I could figure out how to instance a Light of the type the spell uses, move it a long way away, then use the finding function to find the closest one. Or the projectile type...either should work if the function works as advertized.



but the idea is to delay the teleport until you cast a second spell, and I want to have the possibility of teleporting to the projectile while it's still in transit and hasn't hit anything yet.
) but I don't know if I've tested http://www.creationkit.com/FindClosestReferenceOfTypeFromRef_-_Game or one of its more closely related functions.