Jump to content

Photo

Teleport a NPC to a location


  • Please log in to reply
4 replies to this topic

#1
MoonlightArcher

MoonlightArcher

    Regular

  • Members
  • PipPip
  • 64 posts

How can I teleport a NPC to a specific location(or XMarker) when a quest stage has been done?

What script do I need to use? Or what Package?

I tried to make a scene for it but it didn't work and also the scriptline alias_NPC.ForceToRef(XMarker) did not work. Also the line game.GetPlayer().PlaceAtMe(XMarker) did not work.

I really need help with this.



#2
Korodic

Korodic

    Resident poster

  • Premium Member
  • 2,625 posts

forcetoref is changing what reference the alias is using. You want to use the moveto() function.

http://www.creationk...ObjectReference



#3
MoonlightArcher

MoonlightArcher

    Regular

  • Members
  • PipPip
  • 64 posts

I tried that option but it says that it isn't a function. And when I tried again it said that there was no input generated.



#4
bwins95

bwins95

    Fan

  • Members
  • PipPipPip
  • 356 posts

This is a script from one of my mods it's attached to a spell, but you should be able to change it to work for you.

This is untested, but I think it's at least close to what you want.

Scriptname FR_AelaTheHuntress extends activemagiceffect  

ObjectReference property AelaTheHuntressREF auto
Quest property questnamebelow Auto

Event OnEffectFinish(Actor target, Actor caster)
   if (SideQuestProperty.GetStageDone(10))
                    AelaTheHuntressREF.MoveTo(Game.GetPlayer(), 120 * Math.Sin(Game.GetPlayer().GetAngleZ()), 120 * Math.Cos(Game.GetPlayer().GetAngleZ()), Game.GetPlayer().GetHeight() + 2)
    endif
EndEvent

Change AelaTheHuntressREF to who ever you want to teleport.
Change game.getplayer to the marker reference.
Change SideQuestProperty to your quest.

Don't forget to set them in the script property or it won't work.

 

The math part the moveto line will set the teleported npc slightly infront of and a bit above the marker, so you'll want to play around with hte number.
Placeatme just create clones instead of moving who you want.



#5
MoonlightArcher

MoonlightArcher

    Regular

  • Members
  • PipPip
  • 64 posts

Thanks, but none of it worked :( I just used a simple disableat stage function and enable it as a "spawn at XMarker".






Page loaded in: 0.919 seconds