Cannot Call Custom Function Defined on a Magic Effect

Post » Thu Jun 21, 2012 2:46 am

Putting together some transport spells and I want them all to use one common function. The initial spell works fine. But I can't get my other spells to use the transport function in that initial one. Here's the code that tries to call the common function:

Scriptname AenRRPMScript extends activemagiceffect  ObjectReference Property DestinationProperty  Auto  AenRRBHScript Property CommonEffect Auto  EVENT OnEffectStart(Actor Target, Actor Caster)	CommonEffect.TeleportTo(Caster, DestinationProperty)endevent

It compiles fine and even casts but doesn't work. The trace tells me:

[04/20/2012 - 11:32:56PM] Info: AenRRPMScript.OnEffectStartstack:	.Debug.TraceStack() - "" Line ?	[None].AenRRPMScript.OnEffectStart() - "AenRRPMScript.psc" Line 12[04/20/2012 - 11:32:56PM] error: Cannot call TeleportTo() on a None object, aborting function callstack:	[None].AenRRPMScript.OnEffectStart() - "AenRRPMScript.psc" Line 13[04/20/2012 - 11:32:56PM] warning: Assigning None to a non-object variable named "::temp6"

CommonEffect is declared as the effect I made for the working spell. So I'm not sure why the game is assigning the None value to it. Anyone know how to get around this?
User avatar
Dustin Brown
 
Posts: 3307
Joined: Sun Sep 30, 2007 6:55 am

Post » Wed Jun 20, 2012 5:17 pm

TeleportTo() must be elsweyr to be called remotely, like on an ObjectReference or Quest script. An ActiveMagictEffect script as a property doesn't have anything to target so the property won't be filled.
User avatar
Kelsey Anna Farley
 
Posts: 3433
Joined: Fri Jun 30, 2006 10:33 pm

Post » Thu Jun 21, 2012 12:17 am

TeleportTo() must be elsweyr to be called remotely

Elsweyr? You mean I have to define the function out with the Khajiit? :biggrin:

Thanks for the insight. I do see a number of people attaching scripts they want to call from multiple places on Quests. Guess this is why. It seems tacky since I don't need a quest for this mod. Have to get used to it I suppose.

Edit: is there a better place? Is there a defacto standard object that other modder's are attaching global scripts to?
User avatar
jenny goodwin
 
Posts: 3461
Joined: Wed Sep 13, 2006 4:57 am

Post » Wed Jun 20, 2012 9:49 pm

Well, you could put all your functions on an activator with M'aiq in his "Holding Cell" or wherever, then make a property for the activator script, point it to that REF and all should work with 'YourActivatorScript.YourFunction()' used in any other script.

You could even add an OnActivate() event that gives M'aiq salmon if/when he activates it. I'm not sure if he would activate it and he'd probably lie about it if asked. :shrug:
User avatar
Albert Wesker
 
Posts: 3499
Joined: Fri May 11, 2007 11:17 pm

Post » Thu Jun 21, 2012 6:01 am

Well, you could put all your functions on an activator with M'aiq in his "Holding Cell" or wherever, then make a property for the activator script, point it to that REF and all should work with 'YourActivatorScript.YourFunction()' used in any other script.

You could even add an OnActivate() event that gives M'aiq salmon if/when he activates it. I'm not sure if he would activate it and he'd probably lie about it if asked. :shrug:

LOL! Thanks JustinOther. I'm now going to take away M'aiq's Skooma and add extra salmon to Kharjo's inventory.

Since I'm feeling crazy I might even make an interior cell with dwemer clutter everywhere... one bowl for each script that I don't want to attach to an empty quest. :banana:
User avatar
Sarah Unwin
 
Posts: 3413
Joined: Tue Aug 01, 2006 10:31 pm


Return to V - Skyrim