How to use MoveTo properly?

Post » Thu Jun 21, 2012 12:31 am

Right now I am using PlaceAtMe and just getting to ObjectReference to that object and using that. I want to use MoveTo and just have one object that I use. This object is just for getting positions, so it will be invisible like a marker. I have never used MoveTo, so what is the best way to set this up in the CK?
User avatar
James Hate
 
Posts: 3531
Joined: Sun Jun 24, 2007 5:55 am

Post » Wed Jun 20, 2012 3:21 pm

Set up a property and then define in the properties window. Then you can call it normally in your script:

Scriptname TEST extends ActiveMagicEffectObjectReference Property aReference AutoEvent OnEffectStart(Actor akTarget, Actor akCaster) ; this example is a spell.	 aReference.MoveTo(akTarget) ;Moves the reference to the spells targetEndEvent

Alternatively you can define the property in the script:

Scriptname TEST extends ActiveMagicEffectObjectReference Property aReference AutoEvent OnEffectStart(Actor akTarget, Actor akCaster) ; this example is a spell.aReference = Game.GetPlayer() ;Sets aReference to the player	 aReference.MoveTo(akTarget) ; Moves the player to the spells target.EndEvent
User avatar
Kelly Upshall
 
Posts: 3475
Joined: Sat Oct 28, 2006 6:26 pm

Post » Wed Jun 20, 2012 7:40 pm

Set up a property and then define in the properties window. Then you can call it normally in your script:

Scriptname TEST extends ActiveMagicEffectObjectReference Property aReference AutoEvent OnEffectStart(Actor akTarget, Actor akCaster) ; this example is a spell.	 aReference.MoveTo(akTarget) ;Moves the reference to the spells targetEndEvent

Alternatively you can define the property in the script:

Scriptname TEST extends ActiveMagicEffectObjectReference Property aReference AutoEvent OnEffectStart(Actor akTarget, Actor akCaster) ; this example is a spell.aReference = Game.GetPlayer() ;Sets aReference to the player	 aReference.MoveTo(akTarget) ; Moves the player to the spells target.EndEvent

I see, so will that object reference always be valid if I define it in papyrus? I will always be able to call on it from anywhere in the game?
User avatar
Chris Johnston
 
Posts: 3392
Joined: Fri Jul 07, 2006 12:40 pm

Post » Wed Jun 20, 2012 4:12 pm

I see, so will that object reference always be valid if I define it in papyrus? I will always be able to call on it from anywhere in the game?
Yes.

There seems to be a bug with travel from some custom interiors to towns, but there is a http://www.gamesas.com/topic/1362739-grey-screen-on-coc-to-towns/page__fromsearch__1 for that.
User avatar
Rachel Eloise Getoutofmyface
 
Posts: 3445
Joined: Mon Oct 09, 2006 5:20 pm

Post » Thu Jun 21, 2012 12:26 am

Sorry folks, but there seems to be more to the http://www.creationkit.com/MoveTo function than meets the eye...
.
It is possible that some objects need a little extra persuasion; as shown in the wiki
User avatar
The Time Car
 
Posts: 3435
Joined: Sat Oct 27, 2007 7:13 pm

Post » Thu Jun 21, 2012 12:10 am

Sorry folks, but there seems to be more to the http://www.creationkit.com/MoveTo function than meets the eye...
.
It is possible that some objects need a little extra persuasion; as shown in the wiki

That page is the console command version of MoveTo().
User avatar
Naazhe Perezz
 
Posts: 3393
Joined: Sat Aug 19, 2006 6:14 am

Post » Wed Jun 20, 2012 11:46 pm

That page is the console command version of MoveTo().
.
Funny that, eh? You do have a point, though.
.
myObject.disable
myObject.moveTo [location]
myObject.enable
set xp to myObject.getPos x
myObject.setPos x xp
.
The above example is the sort of thing I'd expect to see in a regular script (bar the lack of brackets) - and mind, if the script command has shortcomings in Console, then is it not reasonable to expect to see the same shortcomings when fired from a scripts under similar circumstances?
.
However, I hope I'm wrong about this...
User avatar
Hilm Music
 
Posts: 3357
Joined: Wed Jun 06, 2007 9:36 pm

Post » Wed Jun 20, 2012 1:35 pm

Just wanted to add an Observation I made after several hours of trying to find out why I had a perfectly working script one day then the next it would not work.

Turns out the script would not work if I was in an area where z pos was less than 0, it sometimes would and sometimes would not. I made debug messages in the script and found my GetPos Z was sometimes Reporting 0,0,0 but a moment later it would read properly.

There may be a serious issue with using "get position" on a custom Xmarker object after you use MoveTo in the same frame where in one moment GetPosition reports accurately but the next moment it reports as 0,0,0. The strange thing is that it seems to only happen when you are BELOW 0 (such as POS z -6000) .



.
Funny that, eh? You do have a point, though.
.
myObject.disable
myObject.moveTo [location]
myObject.enable
set xp to myObject.getPos x
myObject.setPos x xp
.
The above example is the sort of thing I'd expect to see in a regular script (bar the lack of brackets) - and mind, if the script command has shortcomings in Console, then is it not reasonable to expect to see the same shortcomings when fired from a scripts under similar circumstances?
.
However, I hope I'm wrong about this...
User avatar
natalie mccormick
 
Posts: 3415
Joined: Fri Aug 18, 2006 8:36 am


Return to V - Skyrim