Jump to content

PathToReference is not a function or does not exist


Recommended Posts

Posted

I'm attempting to make an actor (In this case, a cow) move to me after the room is loaded. To do this, I thought this would be a valid script:

 

Scriptname CowMove extends ObjectReference  
{Moving the cow}

ObjectReference property MyRef auto


Event onLoad()
MyRef.PathToReference(Game.GetPlayer(), 0.5)
endEvent

 

This results in a "PathToReference is not a function or does not exist" error.

 

This is what I'm trying to use, as I believe it will do what I want. Is this a valid use of this function, or is there a better way to do this?

Posted

Notice from that page you linked that PathToReference is a function of Actor, not ObjectReference. (The Actor object extends ObjectReference)

 

So either of these changes should work...

Actor property MyRef auto

 

or

 

(MyRef as Actor).PathToReference(Game.GetPlayer(), 0.5)

Posted

It compiles, but my cow just sits there and doesn't follow me.

 

I've rewritten it slightly, and threw in a messagebox so I know it at least starts the event, but is there something I'm missing to make this cow move to me?

 

Scriptname CowMove extends ObjectReference  
{Moving the cow}

Actor property MyRef auto

Event OnCellAttach()
Debug.MessageBox("Activated")
MyRef.PathToReference(Game.GetPlayer(), 0.5)
endEvent

Posted

It could be a navmesh issue.

If that's okay, then look into timing. ie. put a utility.wait() into the above, or create an activator onject so you can test at will that your cow can move.

  • Recently Browsing   0 members

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