Jump to content

[LE] Make an actor walk to a destination using PathToReference with its own script?


SamHe11

Recommended Posts

How would I make an Actor walk, for example to the player, with a script attached to said Actor? I'm trying to use the function PathToReference, but the script is getting a single compiler error. What I have so far is this:

 

Scriptname myActorSCRIPT extends ObjectReference  


ACTOR PlayerRef


EVENT ONINIT()

    PlayerRef = Game.GetPlayer()
    RegisterForSingleUpdate(1.0)

ENDEVENT




EVENT ONUPDATE()

    self.PathToReference(PlayerRef, 0.5)

ENDEVENT

...and this gives the error:

 PathToReference is not a function or does not exist

Can I not use "self" in this way? How do I get the Actor to refer to itself within its own script?

 

Thanks

 

 

Link to comment
Share on other sites

Change the script extension to Actor and it should compile. In the future when attaching scripts to actors, extend Actor and not ObjectReference. Yeah Actors are "children" of ObjectReference, but some actor functions will only accept the caller being an actor and wont allow casting(if you attempt to cast self, it'll error saying script type is not compatible).

Edited by Rasikko
Link to comment
Share on other sites

  • Recently Browsing   0 members

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