SamHe11 Posted December 21, 2017 Posted December 21, 2017 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 existCan I not use "self" in this way? How do I get the Actor to refer to itself within its own script? Thanks
Evangela Posted December 21, 2017 Posted December 21, 2017 (edited) 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 December 21, 2017 by Rasikko
Recommended Posts