zerther Posted July 18, 2016 Share Posted July 18, 2016 (edited) So 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. 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 if i try to compile this i get an error that moveto is not a valid function or does not exist. how would i properly do this? Edited July 18, 2016 by zerther Link to comment Share on other sites More sharing options...
AnuH1 Posted July 23, 2016 Share Posted July 23, 2016 I think after MyNPC and Game.GetPlayer() you shoud call a GetRef() function. You are trying to call a MoveTo function an alias. But aliases don't move. Only References do. MyNpc.GetRef().MoveTo(Game.GetPlayer().GetRef())I think its the case but I'm not 100% sure. Link to comment Share on other sites More sharing options...
NexusComa Posted July 23, 2016 Share Posted July 23, 2016 I would put down a Xmarker (the red X's you see in the CK) and have the NPC port to the Xmarker. A small script I use while editing to be able to jump to the part of my mod I'm working on ...(sure it can be modified to do what you're looking for) Scriptname _PortToMarker extends ObjectReferenceObjectReference Property PortMarker Auto ; this is set to an Xmarker in the cell. Event OnInit() GoToState("XPort")EndEvent ;-----------------------State XPort Event OnActivate(ObjectReference akActionRef) Game.GetPlayer().MoveTo(PortMarker) EndEventEndState Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 24, 2016 Share Posted July 24, 2016 Quick and dirty to test if teleportation works: Assign the trigger box that has the script attached to the TeleSpot property. If that works, place an Xmarker where you want the NPC to appear and assign it to the TeleSpot property. Edited your posted code: Quest Property MyQuest Auto Int RunOnce Actor Property PlayerREF Auto Alias Property MyNPC Auto ObjectReference Property TeleSpot Auto Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == Game.GetPlayer() If MyQuest.IsStageDone(10) If RunOnce == 0 MyNPC.GetRefence().MoveTo(TeleSpot) RunOnce = 1 EndIf EndIf EndIf EndEvent FYI - GetRef() may be shorter to write but GetReference() is faster to perform. Why? GetRef() calls GetReference() Link to comment Share on other sites More sharing options...
Recommended Posts