Help scripting an npc to teleport to me.

Post » Sat Jul 23, 2016 11:51 pm

I'm trying to make an npc teleport to me after I hit a triggerbox, so that the npc can appear and talk to another npc I see.\



Coming here after checking forums and various google searches.



this code gives me an error that mthe moveto command is not defined or does not exist... how would one properly do this?



Quest Property MyQuest Auto
Int RunOnce
Actor Property PlayerREF Auto
Alias Property MyNPC Auto

Event OnTriggerEnter(ObjectReference akActionRef)
If akActionRef == Game.GetPlayer()
If MyQuest.IsStageDone(10)
If RunOnce == 0
MyNPC.moveto(game.getplayer())
RunOnce = 1
EndIf
EndIf
EndIf
EndEvent
User avatar
Nicholas C
 
Posts: 3489
Joined: Tue Aug 07, 2007 8:20 am

Post » Sun Jul 24, 2016 12:24 am

Change

Alias property MyNPC auto
to
ReferenceAlias property MyNPC auto
.


Then change

MyNPC.moveto(Game.GetPlayer())
to
(MyNPC.GetReference() as Actor).moveto(Game.GetPlayer())
User avatar
Stace
 
Posts: 3455
Joined: Sun Jun 18, 2006 2:52 pm

Post » Sun Jul 24, 2016 3:28 am

A shot of vodka to you sir. that worked thank you.



if you feel like it, could you explain why these changes work? I'm not a natural at scripting and I still don't understand exactly what is needed for the game to communicate with scripts.

User avatar
Harry Hearing
 
Posts: 3366
Joined: Sun Jul 22, 2007 6:19 am

Post » Sun Jul 24, 2016 8:17 am

You never use Alias as a property. That's all I know about that.



For the other, GetReference returns rather the Alias is filled or not. Casting to Actor, tells MoveTo that it's being called on an actor, and Actor extends ObjectReference.

User avatar
Samantha Wood
 
Posts: 3286
Joined: Sun Oct 15, 2006 5:03 am


Return to V - Skyrim