Difference between revisions of "Talk:MoveTo - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Elec0
(Created page with "If I try this script on an object with the reference placed in the worldspace and named. Scriptname E0HelloWorld extends ObjectReference Event onActivate(ObjectRefere...")
 
imported>Skrew-rag
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
If I try this script on an object with the reference placed in the worldspace and named.
If I try this script on an object with the reference placed in the worldspace and named.


  Scriptname E0HelloWorld extends ObjectReference   
<source lang="Papyrus">Scriptname E0HelloWorld extends ObjectReference   
  Event onActivate(ObjectReference akActivate)
Event onActivate(ObjectReference akActivate)
      Debug.Notification("Teleporting...")
    Debug.Notification("Teleporting...")
      akActivate.MoveTo(WhiterunCOCREF)
    akActivate.MoveTo(WhiterunCOCREF)
  EndEvent
EndEvent</source>
And it gives me the error that WhiterunCOCREF isn't defined, when I've set the name of the reference to that.
And it gives me the error that WhiterunCOCREF isn't defined, when I've set the name of the reference to that.


--[[User:Elec0|Elec0]] 00:20, 8 February 2012 (EST)
--[[User:Elec0|Elec0]] 00:20, 8 February 2012 (EST)
: In Papyrus, forms can no longer be referenced directly by their editorIDs. Instead, you need to create a property, and assign the value of that property to the form you're trying to access in the Creation Kit.
: For example:
<source lang="Papyrus">ScriptName E0HelloWorld extends ObjectReference
ObjectReference property WhiterunCOCREF auto
Event onActivate(ObjectReference akActivate)
    Debug.Notification("Teleporting...")
    akActivate.MoveTo(WhiterunCOCREF)
EndEvent</source>
: -- [[User:Cipscis|Cipscis]] 03:34, 8 February 2012 (EST)
::This is mightly inconvient, especially if I have whole load of stuff to refer.
:: [[User:AoshimaMichio|AoshimaMichio]] 14:45, 18 February 2012 (EST)
::: As an experienced scripter, I beg to differ - it's one of my favourite new features of Papyrus. This enables us to write scripts for general usage, and then let the specific forms that it deals with be set up in the Creation Kit.
::: If you need to refer to a lot of stuff by their editorIDs, then all you need to do is add one more short line for each and use the Creation Kit's "Auto-fill all" button. You might not like this, but it is ''well'' worth the added power we get from being able to use Properties.
::: -- [[User:Cipscis|Cipscis]] 00:51, 19 February 2012 (EST)
== Dropped Object ==
[[Talk:SetPosition_-_ObjectReference#Dropped_Objects|Bug with dropped objects]]<br>
--[[User:Fg109|Fg109]] 11:24, 2 May 2012 (EDT)
== Latent Function ==
As this is a latent function, there might be no function calls until the object or the player is finished moving. [[User:Lisselli|Lisselli]] ([[User talk:Lisselli|talk]]) 2016-11-15T14:40:27 (EST)
I just wanted to say, for actors who refuse to move in a cell, even with DisableNoWait, translating them at a speed of 10000 worked.  Not sure how much faster I could have gone but that was good enough.

Latest revision as of 16:03, 11 January 2021

If I try this script on an object with the reference placed in the worldspace and named.

Scriptname E0HelloWorld extends ObjectReference  
Event onActivate(ObjectReference akActivate)
    Debug.Notification("Teleporting...")
    akActivate.MoveTo(WhiterunCOCREF)
EndEvent

And it gives me the error that WhiterunCOCREF isn't defined, when I've set the name of the reference to that.

--Elec0 00:20, 8 February 2012 (EST)

In Papyrus, forms can no longer be referenced directly by their editorIDs. Instead, you need to create a property, and assign the value of that property to the form you're trying to access in the Creation Kit.
For example:
ScriptName E0HelloWorld extends ObjectReference

ObjectReference property WhiterunCOCREF auto

Event onActivate(ObjectReference akActivate)
    Debug.Notification("Teleporting...")
    akActivate.MoveTo(WhiterunCOCREF)
EndEvent
-- Cipscis 03:34, 8 February 2012 (EST)
This is mightly inconvient, especially if I have whole load of stuff to refer.
AoshimaMichio 14:45, 18 February 2012 (EST)
As an experienced scripter, I beg to differ - it's one of my favourite new features of Papyrus. This enables us to write scripts for general usage, and then let the specific forms that it deals with be set up in the Creation Kit.
If you need to refer to a lot of stuff by their editorIDs, then all you need to do is add one more short line for each and use the Creation Kit's "Auto-fill all" button. You might not like this, but it is well worth the added power we get from being able to use Properties.
-- Cipscis 00:51, 19 February 2012 (EST)

Dropped Object[edit source]

Bug with dropped objects
--Fg109 11:24, 2 May 2012 (EDT)

Latent Function[edit source]

As this is a latent function, there might be no function calls until the object or the player is finished moving. Lisselli (talk) 2016-11-15T14:40:27 (EST)

I just wanted to say, for actors who refuse to move in a cell, even with DisableNoWait, translating them at a speed of 10000 worked. Not sure how much faster I could have gone but that was good enough.