MoveTo

Post » Sun Nov 18, 2012 9:02 am

Hi!
Help me with function MoveTo. This function work fine but when i use it my npc always teleportation on marker without stopping how to do to my npc teleportation only one time?
User avatar
Alba Casas
 
Posts: 3478
Joined: Tue Dec 12, 2006 2:31 pm

Post » Sun Nov 18, 2012 5:39 pm

I suppose you added the function inside a while loop, an onupdate or another event kicking regularly. If you place the function in a code chunk only executing once, the teleportation will only happen once.
User avatar
Astargoth Rockin' Design
 
Posts: 3450
Joined: Mon Apr 02, 2007 2:51 pm

Post » Sun Nov 18, 2012 6:29 pm

I suppose you added the function inside a while loop, an onupdate or another event kicking regularly. If you place the function in a code chunk only executing once, the teleportation will only happen once.
My code:
Event OnUpdate
if(MR001.GetStage()==56)
Game.GetPlayer().MoveTo(PlayerMarker)
Telset.TryToMoveTo(TelsetMarker)
Captain.TryToMoveTo(CaptainMarker)
Game.SetPlayerAIDriven(false)
MR001Applodesmenti.Stop()
UnRegisterForUpdate()
endif
endEvent
User avatar
Stay-C
 
Posts: 3514
Joined: Sun Jul 16, 2006 2:04 am

Post » Sun Nov 18, 2012 1:24 pm

Surelly the problem is the registerforupdate function being called too often, that's the part of the code you should check. By the way, not related to this, it's better to use registerforsingleupdate. Even when you use unregisterforsingleupdate, if scripts are slowed, onupdate instances could acumulate, something that didn't happen with registerforsingleupdate.
User avatar
Janine Rose
 
Posts: 3428
Joined: Wed Feb 14, 2007 6:59 pm

Post » Sun Nov 18, 2012 10:39 am

Surelly the problem is the registerforupdate function being called too often, that's the part of the code you should check. By the way, not related to this, it's better to use registerforsingleupdate. Even when you use unregisterforsingleupdate, if scripts are slowed, onupdate instances could acumulate, something that didn't happen with registerforsingleupdate.
Thanks, i'll try registerforsingleupdate :)
User avatar
Heather M
 
Posts: 3487
Joined: Mon Aug 27, 2007 5:40 am

Post » Sun Nov 18, 2012 2:26 pm

Also:

if(MR001.GetStage()==56)

In the rest of the script, you do not set the stage to higher than 56.

So every game update that is still true. And so the move will keep happening until it is not true.

You could use STATES to handle this, if you can't set the Quest Stage higher. http://www.creationkit.com/States_%28Papyrus%29
User avatar
Danielle Brown
 
Posts: 3380
Joined: Wed Sep 27, 2006 6:03 am

Post » Sun Nov 18, 2012 1:49 pm

Also:

if(MR001.GetStage()==56)

In the rest of the script, you do not set the stage to higher than 56.

So every game update that is still true. And so the move will keep happening until it is not true.

You could use STATES to handle this, if you can't set the Quest Stage higher. http://www.creationkit.com/States_%28Papyrus%29
I thought about it but i've never been used it. Thanks i'll try it
User avatar
naome duncan
 
Posts: 3459
Joined: Tue Feb 06, 2007 12:36 am


Return to V - Skyrim