HUH? MoveTo is not a function?

Post » Thu Jun 21, 2012 1:46 am

WHY IN THE WORLD would I be getting this error:


Starting 1 compile threads for 1 files...
Compiling "aadpAquireActors"...
c:\games\steamapps\common\skyrim\Data\Scripts\Source\temp\aadpAquireActors.psc(9,12): MoveTo is not a function or does not exist
No output generated for aadpAquireActors, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on aadpAquireActors


for this script:

Scriptname aadpAquireActors extends activemagiceffect  STATIC Property aadpXMarker  Auto  Event OnEffectStart(Actor akTarget, Actor akCaster)actor Playerref = Game.getplayer()aadpXMarker.MoveTo(playerref)endevent

That is ALL of the code not just a "snip" of a bigger one. And the really ridiculous thing is that that SAME MOVETO command complies just fine in other magic effect scripts I have.
User avatar
Laura Wilson
 
Posts: 3445
Joined: Thu Oct 05, 2006 3:57 pm

Post » Thu Jun 21, 2012 2:29 am

you need to reference a specific ObjectReference.

right now your aadpXMarker is cast as a Base object (static) not a reference that exists in the world.

placeatme might work for base objects, but moveto has to be called on references
User avatar
Kevin S
 
Posts: 3457
Joined: Sat Aug 11, 2007 12:50 pm

Post » Wed Jun 20, 2012 2:44 pm

Thanks, yes that worked, but why the confusing error message?


you need to reference a specific ObjectReference.

right now your aadpXMarker is cast as a Base object (static) not a reference that exists in the world.

placeatme might work for base objects, but moveto has to be called on references
User avatar
Max Van Morrison
 
Posts: 3503
Joined: Sat Jul 07, 2007 4:48 pm

Post » Wed Jun 20, 2012 8:27 pm

because these functions are native to the types of form that they are.

moveto is native to objectreference type forms and it does not exist for a base object form like Static.

you can check for which functions exist for which forms by searching them in the CK (most of them are listed)


like for example if you search ObjectReference Script, it will bring up all the native functions for that type of form.

and if you search Actor Script it will bring up all the native functions.



something like AddItem() is native only to Actor and i think ReferenceAlias

so if you have a property that is not cast as an actor and you call AddItem() it will say it does not exist because that function only exists for actors
User avatar
gary lee
 
Posts: 3436
Joined: Tue Jul 03, 2007 7:49 pm


Return to V - Skyrim