Jump to content

Trying to teleport an NPC to the player with a script.


Undivide

Recommended Posts

Basically, I'm attempting to use a script to teleport my custom follower to the player upon activation, but all the script does is make my player hop.

Scriptname ReiTeleport extends Activemagiceffect

Activemagiceffect property teleportrei auto

EVENT OnEffectFinish(Actor Reiko, Actor akCaster)
akCaster = Game.GetPlayer()
Reiko.MoveTo(akCaster, 5.0 * Math.Sin(akCaster.GetAngleZ()), 5.0 * Math.Cos(akCaster.GetAngleZ()), akCaster.GetHeight() - 0)

EndEvent

http://s21.postimg.org/61va76n47/prob1.png

I've tried both target actor and target self.

 

 

Any clue on what I'm doing wrong?

Link to comment
Share on other sites

Try this

 

  Reveal hidden contents

 

Link to comment
Share on other sites

Duh!

 

Why didn't I see it?

You changed the target inside the event call and you didn't set up a property for your follower. The below compiles. It may (and should) work for you.

 

What I did was setup a property for your NPC actor, a property for the player, a property for current follower.

When the effect starts, the follower is compared to your NPC actor. If it is a match, the follower should teleport to the player with the coordinates that you've calculated.

 

 

  Reveal hidden contents

Be sure to click the properties button and fill out the information properly.

Link to comment
Share on other sites

Thanks for the help, Ishara. Now I have another issue. The script only works when I'm near the follower and teleports inconsistently, but it's a huge step up from where I started. Haha.

In papyrus logs, it gives me this:

[10/21/2013 - 09:45:04PM] ae::monitor: Reiko registered with AE
[10/21/2013 - 09:45:04PM] Error: Cannot call Is3DLoaded() on a None object, aborting function call
stack:
[
Link to comment
Share on other sites

There is no Is3dLoaded() call in the script I provided. Where is that coming from?

 

I used teleport locally to move the player and then the follower from one location to an internal cell. The follower wouldn't port till after the player moved out of a trigger in the internal cell so I know the MoveTo command can function without the follower being near.

Link to comment
Share on other sites

it was near the Reiko Script in the log, so I thought it had something to do with it. I was very wrong.

Anywho, I've figured something out.

 

  Reveal hidden contents

 

 

I took a look at the way Haven Bag handled teleportation, so I created a marker that moves when the effect is activated .

 

Thank you very much for your assistance! I'll be putting you in the credits section of my mod if you don't mind. :laugh:

Edited by Undivide
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...